Is Java truly write once run everywhere? In years past, it was often not the case but in the modern day it is more or less true. And you can run your Plex Java apps on many platforms with good performance, given a supported database and JRE. This is a very nice situation for the ISV or corporate developer who needs to rehost.

In practice is is advisable and desirable to run and debug a CA Plex java app on a Windows or another platform during the development process, such as Mac OS, Linux, iOS, Unix (Aix), or zOS. By far the easiest way to accomplish this is by using the free Eclipse IDE, or if you already have IBM Rational – then you can use this version. The Eclipse (Rational) product runs on virtually every major computing platform, from PC’s to the big iron iOS or zOS. If you do purchase a Rational version, you will have the added benefit of being able to debug not only Java, but RPG and COBOL as well. This is nice if you are trying to debug a full featured multitiered web app, running both in the web container and back end server. WebClient supports this style of application architecture.

The examples below use Eclipse for Mac and CA Plex 7.0, but the steps are the same regardless of platform or version. Mac OS is particularly useful for mobile device development, for example you can run your CA Plex WebClient apps on iOS devices such as iPhone and iPad by using Xcode and Phonegap.

First Step – Install the Eclipse or Rational IDE

Before installing, download and install a matching JDK from Oracle using this link. The JavaSE version is appropriate for most cases.

Next, download and install Eclipse or Rational IDE. You can download a open source version of Eclipse from this link to match your target platform, or go to IBM for a version that runs on an IBM host (PowerSystems, zOS) (warning, fees may apply). We recommend downloading the J2EE version so you get most necessary tooling included.

Second Step – Create a Java Project and Link your Plex source

Go to menu File / New, select other, then select Java project

FileNew

NewJavaProject

Give it a name of your choosing

NewProject2

Perspective

Third Step – Add ObRun and JDBC / Third Party Jars

Copy and paste any external jar files you may need into the project root. This includes both CA Plex product jars and JDBC jars for database access. Note – you can leave the jar files in place and add to the class path or reference by path. However, if you do this the resulting Java project is easily not portable between machines.

If you are not using WebClient, you will need to make sure the ObRun.jar is copied from the Plex product files. If you are using WebClient, then this will happen automatically when you add the WebClient nature to the project. See the WebClient user manual

After you copy and paste the jars into the project, you need to configure the build path to use the jars.

Jars

BuildPath

Select the jars you copied from the first step

BuildPath

Final Result

NewImage

Fourth Step – Link to your CA Plex generated source

In this step simply link to the CA Plex generated source directory (under your model GEN folder). First remove the src directory from the build path and from the project. Next you will  link the Src subdirectory (with an exclusion to Res), and then link the Res directory.

Go to the build path and start with an empty screen. If you see a src folder, first remove from this screen then go back and delete the directory from the project itself.

NewImage

If you get the message “directory exists with a different case” later it is because you need to remove the default src directory first!

Next, add a source folder for Plex bitmaps / GIFs. Copy the Plex BMP3 files into this directory

NewImage

Next, use the link button to link to your CA Plex Gen/Src directory, where your Java source resides

NewImage

Add an exclusion pattern to exclude the Res source directory (it will be added in the next step)

NewImage

Link the Res directory in the same manner as Src

NewImage

Your final build path for source should look like this:

NewImage

Fifth Step – Compile and check for errors

Eclipse will automatically and incrementally build your CA Plex source as you generate – and will do so much faster that you can generate!

Check the “Problems” tab for any errors. Usually these errors are the result of C++ code injected into the java code. You will need to variant / clean up any native C++.

NewImage

Sixth Step – Set up a run configuration

Click on the green “Play” button drop down to access the “Configurations” menu. Select this.

NewImage

Type in the Name, Project (or browse), and the main class “ObRun.ObPanel.ObLaunch”

NewImage

Click on the arguments tab

Type in the package.class name followed by “path= “, e.g. MobileApp.ConfMenu “path= “. Note the space between the = and final quote.

NewImage

Congratulations, you are running Plex Java natively (in this case on Mac OSX Lion accessing MySQL)

NewImage