Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

RPG JAVA integration: how to specify which version of the JDK to use?

198 views
Skip to first unread message

g...@foundation.be

unread,
Sep 23, 2007, 6:06:36 AM9/23/07
to
Hello All,

I am using the RPG Java integration which came along with version V5R1
of OS400.

I want to test my RPG/Java code with JDK1.5 on my iseries. We have
installed this version on our system without problems.

How do specify that RPG has to create a JVM with JDK 1.5 instead of
the one in use (JDK 1.4).

I have tried to use SystemDefault.properties, both in the home
directory of the user and within /QIBM/ProdData/Java but with no
success.

Within Qshell I can use -Djava.version to specify which version of the
installed jdk's I want to use.

How do I specify the JDK version for the JVM started by RPG when
calling java methods from within RPG?

kind regards,
Geert Van Landeghem
(long time ago I have been on this list)

CRPence

unread,
Sep 23, 2007, 4:08:46 PM9/23/07
to
Welcome back. I do not have _an_ answer, but offer...

For the properties file in the home directory, verify the HOMEDIR()
for the user is where the file was placed. The directory name suggested
as having been tried, seems suspect. I think the following are searched:
User Home : /home/userid/SystemDefault.properties
Java Home : /QIBM/UserData/Java400/SystemDefault.properties

I have seen some instances of an apparent properties file naming like
the following, but I have not seen any doc to suggest it is used by default:
?Java user?: /QIBM/UserData/Java400/usrprfname.properties

For the properties files that were created, be sure there is not an
authority issue for access. Review for an auditing T-AF [authority
failure] entry, which for *AUTFAIL audit logging being active, should
occur if lack of authority [to the directory or properties file] was an
issue.

All instances of the specification java.version=1.5 have never had
any blanks between the property, the equal sign, and the property value.
The properties file must have a text CCSID, i.e. other than binary
[not 65535]; and although any valid CCSID should suffice, most I have
seen are CCSID 1252.

Perhaps try the java.version environment variable instead. Prompt
WRKENVVAR or ADDENVVAR. These are checked before the User home and Java
home directories. For the job, before any java activity:
addenvvar 'java.version' '1.5' level(*job) ccsid(*job)

Also be aware of the caveat noted in "How RPGLE Starts the JVM When
Calling a Java Method" KB item 403163516 where it is suggested that the
first JVM started for the job is fixed/unchanging [and another warning
about the classpath used for RPG]:
http://www-912.ibm.com/s_dir/slkbase.NSF/1ac66549a21402188625680b0002037e/35c353a1ae9aab1f862570f9006b8791?OpenDocument&Highlight=2,rpg,java
If this is an issue, perhaps a QSH invocation to show the version
just before the

For reference, the above document was one of several found from
www.ibm.com/support and choosing System i, searching on: java rpg

Already aware of the properties file, I will still offer the
following document link which suggests how to for "using JDK 1.4", and
what the default JDK search path is on v5r1. Presumably following
instructions for setting up to use 1.4, enables an intuitive translation
for setting up to use 1.5 instead. The second link actually seems to be
/the same/ document except for Java 5.0 [1.5] on V5R3, plus the search
path, but that document is lacking some of the details found in the
former; like missing any equivalent heading of either "using JDK 1.5" or
"using JDK 5.0":
http://www-912.ibm.com/s_dir/slkbase.NSF/1ac66549a21402188625680b0002037e/0581029cdbcafcbd86256c4f00673b7d?OpenDocument&Highlight=2,java,environment,variable,version
http://www-912.ibm.com/s_dir/slkbase.NSF/1ac66549a21402188625680b0002037e/c0461687a97c805b86256fe40070108c?OpenDocument&Highlight=2,jdk,1.5

Regards, Chuck
--
All comments provided "as is" with no warranties of any kind
whatsoever and may not represent positions, strategies, nor views of my
employer

g...@foundation.be

unread,
Sep 24, 2007, 4:51:00 AM9/24/07
to
Chuck,

defining java.version as a environment variable does not help

Checking the other suggestions...


Geert

jacob....@gmail.com

unread,
Sep 24, 2007, 7:34:44 AM9/24/07
to


---------------------------------------------------------------------------
I had a similar problem once the JNI apparently had its own idea of
what JAVA version too use.

Adding the following code in my CL program that start my process fixed
the problem.

/* Force java version 1.4 */
ADDENVVAR ENVVAR(QIBM_RPG_JAVA_PROPERTIES) +
VALUE('-DJAVA.VERSION=1.4;') REPLACE(*YES


Barbara Morris

unread,
Sep 26, 2007, 7:21:47 PM9/26/07
to

That will work, except I believe the properties are case-sensitive, so
it should be "-Djava.version". Geert, try this to get version 1.5. You
will have to do it before the JVM is started.

ADDENVVAR ENVVAR(QIBM_RPG_JAVA_PROPERTIES) +
VALUE('-Djava.version=1.5;') REPLACE(*YES)


Thorbjoern Ravn Andersen

unread,
Sep 27, 2007, 1:48:03 AM9/27/07
to
Barbara Morris <bmo...@ca.ibm.com> writes:

> ADDENVVAR ENVVAR(QIBM_RPG_JAVA_PROPERTIES) +
> VALUE('-Djava.version=1.5;') REPLACE(*YES)

I agree with you that the value is case-sensitive, but I don't think
the semicolon goes in there.

--
Thorbjørn Ravn Andersen

Barbara Morris

unread,
Sep 27, 2007, 4:42:03 PM9/27/07
to
Thorbjoern Ravn Andersen wrote:
> Barbara Morris <bmo...@ca.ibm.com> writes:
>
>> ADDENVVAR ENVVAR(QIBM_RPG_JAVA_PROPERTIES) +
>> VALUE('-Djava.version=1.5;') REPLACE(*YES)
>
> I agree with you that the value is case-sensitive, but I don't think
> the semicolon goes in there.
>

The semicolon is necessary _for this environment variable_. The RPG
runtime uses the last character of the string as the separator between
the options. If you don't put the semicolon, it would use the '5' as
the separator character, and pass '-Djava.version=1.' as the first option.

If you have '-Djava.version=1.5;-Dsomething=whatever;') as the value
for this environment variable, then the RPG runtime will pass these
properties to Java:
-Djava.version=1.5
-Dsomething=whatever

g...@foundation.be

unread,
Sep 30, 2007, 2:09:18 PM9/30/07
to
Thanks to Barbara and the rest...

Made a customer happy last week with this.

Geert Van Landeghem
Java and iseries400 Consultant
www.foundation.be

0 new messages