Reputation: 29
I'm trying to execute java program from mainframe using JCL.But the problem is the path specification in java file. I have mentioned to read properties file from current directory "./abc.properties" in java code. But it couldn't find the properties file from current directory, even though it is there in mainframe current directory. Does this "./" notation compatible with mainframe? or any other notation i need to specify for mainframe?
Somehow i tried to mock the procedure followed in JCL here. Below is the sample jcl code which calls java program. The config(properties) files are placed in the path “/TEST/AAAA/BBBBB” .This path has added in the classpath as well, as shown below.
//JZVM01 PROC JAVACLS=, < Fully Qfied Java class..RQD
// ARGS=, < Args to Java class
// VERSION='60', < Version of JZOSVM module
// LOGLVL='+I', < Debug LVL: +I(info) +T(trc)
// REGSIZE='0M', < EXECUTION REGION SIZE
// LEPARM=''
//JAVAJVM EXEC PGM=JVMLDM&VERSION,REGION=®SIZE,
// PARM='&LEPARM/&LOGLVL &JAVACLS &ARGS'
//
export CLASSPATH="$CLASSPATH:/TEST/AAAA/BBBBB"
Upvotes: 0
Views: 1564
Reputation: 316
If I'm understanding you correctly, you've successfully started the java program, but when it tries to open a properties file that you've placed in the classpath, the class loader is not finding it. So the theory is that the classpath does not contain the directory wherein the file lives, so you attempted to resolve that by adding it to the classpath and exporting CLASSPATH.
That idea looks basically correct to me, but your snippet is of course incomplete. Make sure that you are doing that in DD STDENV though. E.G.
...
//JAVA EXEC PROC=JVMPRC60,JAVACLS='myclass'
//STDIN DD DSN=my.whatever.dataset,DISP=SHR
//STDENV DD *
export CLASSPATH="$CLASSPATH:/TEST/AAAA/BBBBB"
Note that there's often/usually much more than just that in STDENV. At least in my experience.
And to answer your other question, yes the relative directory names . and .. work fine in the context of the Unix file systems (zFS or HFS, doesn't matter).
Upvotes: 1