Setting up Eclipse for Maximo / ICD Jython development

Introduction

When you start developing Jython scripts in context of Maximo & ICD the first question is where to edit the scripts. The provided editor in the Web-interface of the product can only be seen as a “Paste-In” area, since it absolutely lacks any needed development features. Better alternatives at this point can be the usage of more professional editors like UltraEdit or Notepad++. If you only want to develop a small set of short Jython scripts this can be a starting point for you. If you plan to do a bit more development I would highly encourage the usage of a professional development environment. In this article I would like to show you how you can set up the Eclipse platform to perfectly act as a Maximo & ICD development environment. I will guarantee you that the benefits of this platform over time are major, even if it is a bit work to setup at the beginning.

Required Software

So before we start let’s figure out, which software is needed for the installation:

  • Eclipse Luna (Download) (64 Bit)
  • Java JRE or SDK V1.7 or V1.8 (64 Bit) *** please see notices below
  • Jython Interpreter V2.5.2 (Download) – Even it is quit old – this is the used Version in the product.

Notices on Java:
For the development of Jython scripts the used JRE or SDK is really important. For Maximo/SCCD 7.5.x (TPAE 7.5) you need at least a JRE Level of Version 1.6 for Maximo 7.6 (TPAE 7.6) you need at least a JRE Level Version 1.7. I personally always try to use the IBM Java in the version 1.7 and set the JRE Compliance level to 1.6 if needed. I will show you later on how to set this – don’t care for the moment.

The download of the IBM Java is a bit tricky to find. The base download page is can be found here. For Windows you need to download the complete “IBM Development Package for Eclipse”, extract it and take out the JRE directory. You should use Version 5.0 64-bit which includes Java 7.1 (1.7).

Installing the Prerequisites

The installation of the software is described in this section.

  1. Eclipse installation

For Eclipse no special installation is required. It basically only needs to be extracted to a folder of your choose. On the first start you can select the folder where you would like to store your eclipse workspace (data-directory).

  1. Java JRE (optional – you may use your system JRE)

Depending on the Java Version you have to either run a setup program or just copy some files. The installed Java does not have to be the system Java! This is important to know if you use different software on your computer which requires a certain version of Java.

If you use the “IBM Development Package for Eclipse” just extract the “ibm_sdk71” subfolder to a folder on your local harddisk for later usage.

  1. Jython 2.5.2 Installation

Jython Installation is quit straight forward using the setup program. During installation you are asked for the Java Home directory where you should be careful to select the one provided by the Java JRE Installation.

 

Configuration of the Java Environment (optional)

At this point we need to set up the correct Java Environment Eclipse should use.

  1. In Eclipse go to “Window –> Preferences”.
  2. In the left navigation pane go to “Java –> Installed JRE’s”. In the window on the right you should see the currently installed JRE selected. If you have installed an additional JRE and want to make this the default JRE select the Add button on the right.
  3. Select “Standard VM” and “Next…”
  4. The next screen requires the definition of the new JRE. If you select the correct installation directory for your JRE home the rest of the Fields should be filled in automatically:
    eclipsejre1
  5. After selecting “Finish” a new SDK is available. The SDK which is checked and bold is the default SDK.

At the end the right Java compiler must be selected:

  • Maximo 6: Java 1.4
  • Maximo 7: Java 1.5
  • Maximo 7.5.x: Java 1.6
  • Maximo 7.6: Java 1.7

Set it in Eclipse preferences: Windows –> Preferences –> Java –> Compiler  –> Compile compliance level.

eclipsejre2

Installing the maximo.ear

The maximo.ear contains most of the Java method’s to operate on all kinds of Mbo’s and MboSet’s within TPAE. One of the best features of using Eclipse in comparison to a simple text editor is, that we can include the businessobjects JAR file from your Maximo/ICD installation and that we have some syntax checking and input features for these classes. I will show you in a later post how we can utilize these features to make our life easier.

The best way to make the JAR file available is to create an own project in Eclipse for the referenced Java libraries.

  • Select “File –> New –> Java Project” in the Eclipse Workbench with the name “MaximoLibs”.
  • Copy [SMPDIR]\maximo\deployment\default\maximo.ear from your admin workstation into the new project.
  • Extract the following files from the maximo.ear file:
    • jar
    • war and extract the content to a directory named maximouiweb
    • lib/*.jar files to a directory lib
  • Refresh the project tree in Eclipse (F5). Your project should now looks like follow:
    eclipsejre3

Installing the PyDev Plug-In in Eclipse

After the initial start of Eclipse and the selection of a workspace directory you find yourself in the Welcome screen, which should be closed using the “Workbench” symbol in the upper right corner.

To install PyDev select the Menu “Help à Install new Software…”

  1. Enter the text http://pydev.org/updates into the Work with text box.
  2. Select only the PyDev checkbox
    pydev1
  3. Press the Next Button…
  4. You get the Installation Details displayed where you also can press “Next”
  5. Accept the License and press “Finish”. The installation starts.
  6. At the end of the installation you are asked to restart Eclipse. Please answer with “Yes”.

Configuring PyDev in Eclipse

To configure PyDev perform the following steps:

  1. After Restart, click Window and then click Preferences.
  2. Find the entry “Jython Interpreter” as shown in the picture and select “New…”
    pydev2
  1. Enter “Jython 2.5.2” as the Interpreter Name and find the jython.jar file from your previous Jython installation. Select “OK”.
    pydev3
  2. The configuration starts. Select OK in the dialog which appears.

At the End your Jython Interpreter Configuration should look similar to this one:

pydev4

Create a new PyDev project

Now create a new PyDev project where you can store you Jython sources.

  • Select: File –> New –> Project
  • Select the wizard PyDev Project and select Next
  • Enter a project Name and select the correct Project Type Jython and the Grammar Version 2.5 with your defined Interpreter.
    eclipsejre4
  • Press Finish.

You get a question if the associated PyDev perspective should be opened. Select Yes.

Congratulations you have your first Python/Jython project. There is still one little piece missing…

Referencing the Maximo Java libraries

In a previous step we have extracted the Maximo related Java libraries. To use them in our Jython project we need to reference them.

  • Right click to your new project in the PyDev Package Explorer window and select properties.
  • In the property window select the option “PyDev – PYTHONPATH”
  • Select the tab “External Libraries”.
  • Using the “Add zip/jar/egg” button you can add all required libraries from the referenced project. At least the businessobjects.jar file should be added, but all other jar files could be added in addition. At the end your configuration looks like this:
    pydev5

Creating your first Jython Script

To create the first Jython script right click on your newly created project and select New –> File in the Popup Menu. Select a filename of your choose with the extension “.py” and click on Finish.

You are asked for the Default Eclipse preferences for PyDev. Just click ok.

You are now ready to create your first Jython script, but this is a story for another post.

15 comments

  • Does all this need to be installed on the maximo server?

  • I have had this working for a while and it is great.
    Unfortunately, recently the development server I am using
    was patched to not allow sslv3.

    Now I am getting an SSL handshake exception when I try to connect.

    It looks like jython 2.5 does not support TLS.

    Have you run into this? Any workaround?

  • Hi Matthias,

    How the autocomplete (to choose same mbo method) works using this configuration?

    I’ve tried these configs and the import statement pass through maximo’s folder, but how about the methods by the workorder class?

    • Hi Belfort,
      my experience is that autocompletion from java classes is still a bit limited in the PyDev environment. In some cases it works quit well, but in others not. Not sure what the real rule behind is…

      • Hello Matthias,

        first of all thank you for this nice site and all information you’ve shared.

        About the autocompletion from java classes. You could use docstring type hints to explicitly define type of a variable. We use this type of hinting in jython automation scripts.

        from psdi.app.workorder import WOChangeRemote
        changeMbo=mbo # @UndefinedVariable
        ”’
        @type changeMbo: WOChangeRemote
        ”’

        After this type hint PyDEV knows the type of changeMbo variable and offers full autocompletion.

  • Ravi Ramnarayan

    Somehow, I am stumped by “Installing the maximo.ear”. How does one “copy maximo.ear file into an Eclipse project”. I am using Eclipse Mars.2. What would be in the lib and maximouiweb folders (screen shot)?

  • Maybe my wording was a bit confusing. The Maximo.ear is not a file, but a directory within the application server profile directory. In this directory you will find as the most important file the businessobjects.jar file. This should be included as a jar file in eclipse. Other files can be added as needed.

  • Hello,

    My step – Configuring PyDev in Eclipse has some problem seems since I can’t find PyDev at Window and then click Preferences. All the steps before this step were successful.

    Please advise

    • Hello Sanjay,

      is the Java Version your Eclipse runs with compatible with PyDev? I have seen this effect before in that scenario. The newest PyDev requires Java 8 and will not run if you are using Java 7.

  • Hong Liang Zhang

    Hi Matthias,

    This is great! I’ve done with alll steps, so where is the “another post” ? 😉

    • Hi Hong,

      you will find a couple of post on how to create scripts with Jython and ICD/Maximo in this Blog. Maybe start with the “Basic Scripting Patterns” Section.

      Regards
      Matthias

  • to install jython in windows, using jython_installer-2.5.2.jar
    1- from windown start menu, type CMD for command prompt.
    2- navigate to jython folder.
    3- type
    java -jar jython_installer-2.5.2.jar
    4- Click Next in the coming screen.

Leave a Reply to Matthias Cancel reply

Your email address will not be published.