  Java jar files and corruptions? 
 The Question is:
 
I'm trying to utilise a jar file in my java code, without a succes. I have
 problems with correctly specifying the classpath.
 
Here follows an example. I have the following class file:
 
luokkapolku/example/run.class
 
(the package is luokkapolku.example).
 
Then, I have a jar-file:
coreO.jar
 
in the directory /luokkapolku
 
The jar file contains class JSci/maths/DoubleMatrix. The application
 (run.class) prints out "Ok" and tries to create a new DoubleMatrix:
 
package luokkapolku.example;
 
public class run {
 
    public static void main(String[] args)
    {
        System.out.println("Ok");
        JSci.maths.DoubleMatrix d = new JSci.maths.DoubleMatrix(10,10);
    }
 
 
The application runs fine in windows environment using the command:
java -cp ".;luokkapolku\coreO.jar" luokkapolku.example.run
 
When I try to run it in your OpenVMS testdrive environment with the command:
$ java -cp ".:luokkapolku/coreO.jar" luokkapolku.example.run
 
or
 
$ java -cp ".:luokkapolku.dir/coreO.jar" luokkapolku.example.run
 
I get the error message:
Exception in thread "main" java.lang.NoClassDefFoundError:
 JSci/maths/DoubleMatrix
        at luokkapolku.example.run.main(run.java)
 
What went wrong? I have checked your tip number 5051 about classpath, but
 that's not about using the -classpath option with the java command.
 
Here is some debug information from the java launcher:
 
$ java -cp ".:luokkapolku/coreO.jar" luokkapolku.example.run
----_JAVA_LAUNCHER_DEBUG----
JRE path is /sys$common/java$142/jre
jvm.cfg[0] = -&gt;-classi
jvm.cfg[1] = -&gt;-nativ
jvm.cfg[2] = -&gt;-gree
1 micro seconds to parse jvm.cfg
Does `java$jvm_shr' exist ... yes.
JVM path is java$jvm_shr
1 micro seconds to LoadJavaVM
JavaVM args:
    version 0x00010002, ignoreUnrecognized is JNI_FALSE, nOptions is 3
    option[ 0] = '-Djava.class.path=.'
    option[ 1] = '-Djava.class.path=.:luokkapolku/coreO.jar'
    option[ 2] = '-Dsun.java.command=luokkapolku.example.run'
1 micro seconds to InitializeJVM
Main-Class is 'luokkapolku.example.run'
Apps' argc is 0
1 micro seconds to load main class
----_JAVA_LAUNCHER_DEBUG----
Exception in thread "main" java.lang.NoClassDefFoundError:
 JSci/maths/DoubleMatrix
        at luokkapolku.example.run.main(run.java)
 
------------------------------
 
$ java -cp ".:luokkapolku.dir/coreO.jar" luokkapolku.example.run
----_JAVA_LAUNCHER_DEBUG----
JRE path is /sys$common/java$142/jre
jvm.cfg[0] = -&gt;-classi
jvm.cfg[1] = -&gt;-nativ
jvm.cfg[2] = -&gt;-gree
1 micro seconds to parse jvm.cfg
Does `java$jvm_shr' exist ... yes.
JVM path is java$jvm_shr
1 micro seconds to LoadJavaVM
JavaVM args:
    version 0x00010002, ignoreUnrecognized is JNI_FALSE, nOptions is 3
    option[ 0] = '-Djava.class.path=.'
    option[ 1] = '-Djava.class.path=.:luokkapolku.dir/coreO.jar'
    option[ 2] = '-Dsun.java.command=luokkapolku.example.run'
1 micro seconds to InitializeJVM
Main-Class is 'luokkapolku.example.run'
Apps' argc is 0
1 micro seconds to load main class
----_JAVA_LAUNCHER_DEBUG----
Exception in thread "main" java.lang.NoClassDefFoundError:
 JSci/maths/DoubleMatrix
        at luokkapolku.example.run.main(run.java)
 The Answer is :
 
  As was reported in a later missive from the questioner, the root
  cause of the problem seen was an error in the record structure
  chosen for the jar file.  With the following command:
 
    $ set file/attr=(rfm:stmlf,ra:cr) coreo.jar
 
  issued on the jar-file, the jar file has the correct format,
  the operation then succeeds.
 
  Do also check the settings for Java, as C itself offers various
  format default settings on recent OpenVMS releases.
 
 
 Answer written or last revised on  29-NOV-2004 
