|
Hi all,
I wrote a get JVM system properties RPGLE program by calling Java method to
sharing with you,
When you want to set JVM runtime version, you could use environment
variable,
There are a couple of different things you can do depending on who you want
to effect.
1). To affect just your compile, and only adjusting the javac command:
javac -J-Djava.version=1.3 ...
NOTE: You do not qualify the path name to javac - specifying the java
version to use via -J-Djava.version=1.3 picks up things correctly for you.
2). To affect just you compiles, without adjusting javac command each time:
Create file SytemDefault.properties in directory
/home/yourUserProfile (or whatever directory is specified for your
user.home) and add the line "java.version=1.3" (without the double
quotes).
E.g.:
mkdir '/home/yourUserProfile' where yourUserProfile is your
As/400 user profile name
edtf '/home/yourUserProfile/SystemDefault.properties
java.version=1.3
PF3 twice to save and exit
3). To effect everyone on the system, add (or change) the line
"java.version=1.3" (without the double quotes) to file
/QIBM/UserData/Java400/SystemDefault.properties (create the file using
editf if it does not exist).
if you didn't installed PTF for RPG_JAVA_PROPERTIES, you could just used
SystemDefault.properties
to specified your Java version, then running following PGM to list your java
system properties,
then see what's different between your specified JVM version.
Source: QRPGLESRC/JAVASYSR
*********************************************************************
* *
* Get Java VM version System Properties *
* first check V5R2 5722SS1 PTF SI13932 *
* V5R1 5722SS1 PTF SI10069 *
* Then use following command specify run time JVM version: *
* *
* ADDENVVAR ENVVAR(QIBM_RPG_JAVA_PROPERTIES) *
* VALUE('-Djava.version=1.3;') *
* or *
* ADDENVVAR ENVVAR(QIBM_RPG_JAVA_PROPERTIES) *
* VALUE('-Djava.version=1.4;') *
* *
*********************************************************************
H DEBUG OPTION(*SRCSTMT:*NODEBUGIO)
H dftactgrp(*no) thread(*serialize)
*********************************************************************
*s6* * Java String method
*********************************************************************
FQSYSPRT O F 132 PRINTER
D newString PR O EXTPROC(*JAVA:
D 'java.lang.String':
D *CONSTRUCTOR)
D Class(*JAVA:'java.lang.String')
D value 65535A CONST VARYING
D stringBytes PR 100A VARYING
D EXTPROC(*JAVA
D :'java.lang.String'
D :'getBytes')
D stringLength PR 10I 0
D EXTPROC(*JAVA
D :'java.lang.String'
D :'length')
* java.lang.trim() --------------------------------------------------
D trimString PR O ExtProc(*JAVA:'java.lang.String'
D :'trim')
D Class(*JAVA:'java.lang.String')
D newProp PR O
ExtProc(*JAVA:'java.util.Properties'
D :*CONSTRUCTOR)
D
Class(*JAVA:'java.util.Properties')
D prop O
Class(*java:'java.util.Properties')
D getSysProp PR O ExtProc(*JAVA:'java.lang.System'
D :'getProperties')
D STATIC
D
Class(*java:'java.util.Properties')
D propertyNames PR O
ExtProc(*JAVA:'java.util.Properties'
D :'propertyNames')
D
Class(*java:'java.util.Enumeration')
D getProperty PR O
ExtProc(*JAVA:'java.util.Properties'
D :'getProperty')
D Class(*java:'java.lang.String')
D O Class(*java:'java.lang.String')
D hasMoreElts PR N
D ExtProc(*JAVA:
D 'java.util.Enumeration':
D 'hasMoreElements')
D nextElement PR O
D ExtProc(*JAVA:
D 'java.util.Enumeration':
D 'nextElement')
D Class(*java:
D 'java.lang.Object')
D objToString PR O
D ExtProc(*JAVA:
D 'java.lang.Object':
D 'toString')
D Class(*java:
D 'java.lang.String')
D
D obj S O Class(*java:'java.lang.Object')
D p_String S O Class(*java:'java.lang.String')
D p_Value S O Class(*java:'java.lang.String')
D properties S O
Class(*java:'java.util.Properties')
D enumeration S O
Class(*java:'java.util.Enumeration')
D pname S 35
D pvalue S 97
/free
properties = getSysProp();
enumeration = propertyNames(properties);
Except Header;
dow hasMoreElts(enumeration);
obj = nextElement(enumeration);
p_string = objToString(obj);
pname = stringBytes(p_string);
p_value = getProperty(properties : p_string);
pvalue = stringBytes(p_value);
Except Detail;
enddo;
// dump;
*InLr = *On;
/end-free
****************************************************************
OQSYSPRT E Header 1
O 50 'Java System Properties'
O E Detail 1
O pname 35
O pvalue 132
Best Regards,
Vengoal
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.