Make sure these subroutines are called BEFORE anything in the job starts a JVM by calling a java class. Once the JVM is started, the classpath is set and can't be influenced by environment variables.
I've had very poor results attempting to set classpath from RPG on V7R1. There's something new going on there. I spent a solid week trying to get an application working on V7R1 that had been working on previous OS releases and never did get it to work. I replaced it with an "all java" version that worked fine. Running the job with RPG in debug, breaking just after the JVM started up, and displaying java from the display job screen showed the class path I wanted, but I'd still get "class not found" errors.
From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of Sonin,Nikolai
Sent: Thursday, September 27, 2012 11:14 AM
Subject: J9 JVM not compliant?
I am trying to use the 32 bit J9 JVM that is 1.6 of java on V5R4M5 from an ILE RPG program:
The following code:
D q s 1a inz('''')
Exec_Command('CHGCURDIR DIR(' + q + '/java/' + q + ')');
Exec_Command('ADDENVVAR ENVVAR(CLASSPATH) REPLACE(*YES) ' +
Exec_Command('ADDENVVAR ENVVAR(JAVA_HOME) REPLACE(*YES) ' +
'VALUE('+ q + '/QOpenSys/QIBM/ProdData/JavaVM/jdk60/32bit'
+ q + ')');
Is supposed to set the JAVA_HOME ENVVAR and the CLASSPATH ENVVAR for the JVM before using the Java Mail API.
It does this:
CLASSPATH '.:/Java/*.jar:/Java/lib/*.jar:/Jav' >
JAVA_HOME '/QOpenSys/QIBM/ProdData/JavaVM/jdk' >
But this is what I get in the Job Log:
Message ID . . . . . . : RNX0301 Severity . . . . . . . : 50
Message type . . . . . : Escape
Date sent . . . . . . : 09/27/12 Time sent . . . . . . :
Message . . . . : Java exception received when calling Java method.
Cause . . . . . : RPG procedure RPGMAIL_NE in program
received Java exception "java.lang.NoClassDefFoundError:
when calling method "<init>" with signature "()V" in class
According to Oracle in Java 6 specifying the directory or *.jar in the classpath is supposed search all of the jar files in the directory.
Obviously I am doing something wrong or IBM did not get the message.
What am I doing wrong?
Thanks in advance for your time and effort.
This is the Java Programming on and around the IBM i (JAVA400-L) mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/java400-l
As an Amazon Associate we earn from qualifying purchases.