TechTip: Selecting a JDK

Java
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

OS/400 V4R5 already ships with five different,

optionally installable versions of the AS/400 Java Development Kit: JDK 1.1.6, JDK 1.1.7, JDK 1.1.8, JDK 1.2., and JDK 1.3. With all of those installed, how do you determine which to use?

I had to tackle that problem myself because I use several open source Java products that require either JDK 1.2 or JDK 1.3. The easiest solution is to qualify the JDK in the Java command with the java.version option:

java -Djava.version=1.2 TheJavaClassName

However, as with IBM's SQLj utilities, you sometimes don't have access to the Java command. Moreover, adding that option can become tiresome if you want a specific JDK as your default. You can avoid having to manually specify which JDK to use each time by adding java.version=1.2 to a text file called SystemDefault.properties.

That file can exist in one of two places in the OS/400 Integrated File System (IFS): your user home directory or the Java home directory. Your user home directory is qualified in your user profile, so use the Display User Profile (DSPUSRPRF) command to see what yours is set to. (Here's a hint: It defaults to a directory of your profile name underneath the /home directory.) The Java home directory is /QIBM/UserData/Java400/.

The easiest way to modify the SystemDefault.properties file in your AS/400 IFS (or, if it doesn't yet exist, create it) is to use the Edit File (EDTF) command:

EDTF '/home/Denoncourt/SystemDefault.properties'

Then, add this entry:

java.version=1.3

First, Java looks to the Java command options. Then, it looks to the user home SystemDefault.properties file. Next, it looks to the Java home SystemDefault.properties file. Finally, it looks to an environment variable for the setting of the JDK.

Note that you can also create a SystemDefault.properties in the /etc directory so the default JDK is set for everyone rather than for an individual, as when you place the properties file in the user's home directory.



Don Denoncourt

Don Denoncourt is a freelance consultant. He can be reached at This email address is being protected from spambots. You need JavaScript enabled to view it..


MC Press books written by Don Denoncourt available now on the MC Press Bookstore.

Java Application Strategies for iSeries and AS/400 Java Application Strategies for iSeries and AS/400
Explore the realities of using Java to develop real-world OS/400 applications.
List Price $89.00

Now On Sale

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  •  

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: