the JZOS batch launcher does work as designed - it allows you to use a z/OS Unix shell script to configure everything including CLASSPATH.
What it doesn't do is what the new "java" command line launcher for the JVM does: it expands directory wildcards in CLASSPATH to point to all jars in that directory (something easy to do in the JZOS shell script). I see it as a nice convenience since it is a common thing to do and most Java users don't know their shell :-) Kirk Wolf Dovetailed Technologies http://dovetail.com On Thu, Apr 27, 2017 at 1:31 PM, Carmen Vitullo <[email protected]> wrote: > Funny I'm looking at both right now, getting ready for a migration of an > application from Java on Unix to Java on z/OS, I've been testing the BCD > batch process and the JZOS proc, the scripting seems to work as designed, > and seeing how it works with a small test I wonder if that's overkill to > allow Java to load all the class libraries ? > I'll need some real testing with an application right now using the > defaults I set > > > > APP_HOME=$JAVA_HOME <--- change > CLASSPATH=$APP_HOME:"${JAVA_HOME}"/lib:"${JAVA_HOME}"/lib/ext > # Add Application required jars to end of CLASSPATH > for i in "${APP_HOME}"/*.jar; do > CLASSPATH="$CLASSPATH":"$i" > done > export CLASSPATH="$CLASSPATH": > > > Carmen > > ----- Original Message ----- > > From: "Kirk Wolf" <[email protected]> > To: [email protected] > Sent: Thursday, April 27, 2017 12:23:27 PM > Subject: Re: JZOS Java CLASSPATH > > Yes, this is a feature of the "java" command JVM launcher that is not > present in the JZOS batch launcher and the "java" command launcher. > > Both launchers invoke the JVM launcher API and pass in "-Djava.class.path=" > as an option using $CLASSPATH, but the "java" command launcher seems to be > enhanced (somewhat recently) to expand an entry with a basename of "*" to > include all of the jar files in that directory: > http://docs.oracle.com/javase/6/docs/technotes/tools/ > windows/classpath.html > > And yet I fail to see why this is an issue since the JZOS sample JCL shows > how to use the shell language to handle this - with more flexibility. > > For example, the "java" command launcher can't do this: > > for i in "${MYDIR}"/foo*.jar; do > CLASSPATH="$CLASSPATH":"$i" > done > > > > Kirk Wolf > Dovetailed Technologies > http://dovetail.com > > On Thu, Apr 27, 2017 at 7:22 AM, Andrew Rowley < > [email protected] > > wrote: > > > On 27/04/2017 09:49 PM, Peter Hunkeler wrote: > > > >> You need to escape the * so that the shell will assign it to the > >> environment variable instead of "resolving" it. Try: > >> > >> I don't think so. I have a small Java program to display the CLASSPATH > > environement variable and what it resolves to: > > > > import java.net.URL; > > import java.net.URLClassLoader; > > > > public class ClassPath { > > public static void main (String args[]) { > > System.out.println(System.getenv("CLASSPATH")); > > ClassLoader cl = ClassLoader.getSystemClassLoader(); > > URL[] urls = ((URLClassLoader)cl).getURLs(); > > for(URL url: urls){ > > System.out.println(url.getFile()); > > } > > } > > } > > > > Under JZOS: > > > > JVMJZBL1023N Invoking ClassPath.main()... > > JVMJZBL1024N ClassPath.main() completed. > > JVMJZBL1021N JZOS batch launcher completed, return code=0 > > /home/andrewr/java/target:/usr/lpp/java/J8.0/lib:/usr/lpp/ > > java/J8.0/lib/ext:/home/andrewr/java/lib/*: > > /home/andrewr/java/target/ > > /VERSYSB/usr/lpp/java/J8.0/lib/ > > /VERSYSB/usr/lpp/java/J8.0/lib/ext/ > > /home/andrewr/java/lib/* > > /home/andrewr/ > > > > Under BPXBATCH: > > > > java/target:java/lib/* > > /home/andrewr/java/target/ > > /home/andrewr/java/lib/easysmf-je-1.5.2.jar > > /home/andrewr/java/lib/easysmf-je-samples-1.5.2.jar > > /home/andrewr/java/lib/javax.mail.jar > > /home/andrewr/java/lib/slf4j-api-1.7.21.jar > > /home/andrewr/java/lib/slf4j-simple-1.7.21.jar > > /home/andrewr/java/lib/jsoup-1.10.2.jar > > > > In both cases I can see the asterisk in the CLASSPATH variable. Under > > BPXBATCH the jars in that directory are in the classpath as expected. > Under > > JZOS the asterisk itself ends up as an entry. > > > > > > ---------------------------------------------------------------------- > > For IBM-MAIN subscribe / signoff / archive access instructions, > > send email to [email protected] with the message: INFO IBM-MAIN > > > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to [email protected] with the message: INFO IBM-MAIN > > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to [email protected] with the message: INFO IBM-MAIN > ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
