0

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=&REGSIZE,        
//   PARM='&LEPARM/&LOGLVL &JAVACLS &ARGS'                 
//
export CLASSPATH="$CLASSPATH:/TEST/AAAA/BBBBB"
Praveena
  • 29
  • 3
  • 2
    Please show us your JCL and shell script. The "./" notation is compatible with z/OS. – cschneid Sep 22 '15 at 11:18
  • Are you using HFS or ZFS? Are you attempting to execute under Unix System Services, plain z/OS or on a Linux system that happens to be running on the Mainframe? You don't know? Nor do we. Start with what @cschneid has requested. Also include links to the relevant parts of the manuals you have used to come up with your code, please. – Bill Woodger Sep 22 '15 at 12:22
  • You've shown a PROC. You need to show the JCL which EXEC'ed that PROC, including the output. /TEST/AAAA/BBBB certainly does not exist on z/OS itself, but may exist on OMVS, which is case sensitive. You didn't include the links to the documentation you have been using. Is this a class exercise? Your tutor should be consulted. If it is a work task, your colleagues/technical support should be consulted. – Bill Woodger Sep 23 '15 at 11:28

1 Answers1

1

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).

randomScott
  • 306
  • 2
  • 8