running stand alone jar file

General discussion on the JZOS batch launcher and toolkit
Post Reply
fmyers
Posts: 1
Joined: Thu Jun 06, 2019 11:10 am

running stand alone jar file

Post by fmyers » Thu Jun 06, 2019 11:19 am

Hi,

I attempted to run a jarfile:
//JAVAEXEC EXEC JVMPRC86,REGION=0M,
// LOGLVL='+T',JAVACLS='-jar /u/hb36667/RACF/lib/EventRpt.jar'
//*MLIN DD DISP=SHR,DSN=TSP.RACF.XML(0)
//XMLIN DD DISP=SHR,DSN=DSX.RACF.XMLEVENT
//STDENV DD *
#exec /bin/sh 2>jzos-debug.stderr
#set -x
export HOME=/u/hb36667
. /etc/profile
. /u/hb36667/.profile
export JAVA_HOME=/usr/lpp/java/J8.0_64
export PATH=/bin:"${JAVA_HOME}"/bin
LIBPATH=/lib:/usr/lib:"${JAVA_HOME}"/bin
LIBPATH="${LIBPATH}":"${JAVA_HOME}"/lib/s390x
LIBPATH="${LIBPATH}":"${JAVA_HOME}"/lib/s390x/j9vm
LIBPATH="${LIBPATH}":"${JAVA_HOME}"/bin/classic
LIBPATH="${LIBPATH}":/u/hb36667/RACF/lib
export LIBPATH="${LIBPATH}":
# Customize your CLASSPATH here
APP_HOME="/u/hb36667/RACF/lib"
CLASSPATH=${APP_HOME}:${JAVA_HOME}/lib:${JAVA_HOME}/lib/ext
# Add Application required jars to end of CLASSPATH
for i in `ls -m ${APP_HOME}/*.jar`; do
CLASSPATH="${CLASSPATH}":"$i"
done
export CLASSPATH="${CLASSPATH}:"
# Set JZOS specific options
# Use this variable to prevent JZOS from handling MVS operator commands
export JZOS_ENABLE_MVS_COMMANDS=false
# Configure JVM options
IJO="-Xms16m -Xmx128m"
# Uncomment the following to aid in debugging "Class Not Found" problems
IJO="$IJO -verbose:class"
export IBM_JAVA_OPTIONS="$IJO "
//

I get the response:
...
JVMJZBL2999T jarfile: /u/hb36667/RACF/lib/EventRpt.jar
JVMJZBL2999T Main-Class: 'EventRpt'
JVMJZBL2999T <- getMainClassFromJarFile()
JVMJZBL2999T javaClassName: 'EventRpt'
JVMJZBL1023N Invoking EventRpt.main()...
JVMJZBL2999T -> JniUtil.convert()
JVMJZBL2999T <- JniUtil.convert()
class load: sun/misc/URLClassPath$FileLoader from: /usr/lpp/java/J8.0_64/lib/rt.jar
JVMJZBL2008E Could not find or load class: EventRpt
JVMJZBL2999T -> JniUtil.writeStackTrace()
class load: java/io/PrintWriter from: /usr/lpp/java/J8.0_64/lib/rt.jar
class load: java/util/Collections$EmptyIterator from: /usr/lpp/java/J8.0_64/lib/rt.jar
JVMJZBL2007E Stack trace follows:
java.lang.NoClassDefFoundError: EventRpt
Caused by: java.lang.ClassNotFoundException: EventRpt
at java.net.URLClassLoader.findClass(URLClassLoader.java:609)
at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:926)
at java.lang.ClassLoader.loadClass(ClassLoader.java:871)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:343)
at java.lang.ClassLoader.loadClass(ClassLoader.java:854)
JVMJZBL2999T <- JniUtil.writeStackTrace()

I dumped the jarfile, which contains:
0 Wed Jun 05 16:48:20 EDT 2019 META-INF/
88 Wed Jun 05 16:48:20 EDT 2019 META-INF/MANIFEST.MF
6427 Wed Jun 05 16:48:18 EDT 2019 com/hnb/uaa/racf/EventRpt.class

The manifest contains:
Manifest-Version: 1.0
Main-Class: EventRpt

Any suggestions on what I am doing wrong?

dovetail
Site Admin
Posts: 1890
Joined: Thu Jul 29, 2004 12:12 pm

Re: running stand alone jar file

Post by dovetail » Fri Jun 07, 2019 10:30 am

In your jar file manifest:

Main-Class: EventRpt

You need a fully qualified classname.

Post Reply