(9921) Java jar files and corruptions?
Posted: Sun Nov 28, 2004 8:26 am
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:
(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:
The application runs fine in windows environment using the command:
When I try to run it in your OpenVMS testdrive environment with the command:
or
I get the error message:
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:
Here follows an example. I have the following class file:
Code: Select all
luokkapolku/example/run.class
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:
Code: Select all
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);
}
Code: Select all
java -cp ".;luokkapolku\coreO.jar" luokkapolku.example.run
Code: Select all
$ java -cp ".:luokkapolku/coreO.jar" luokkapolku.example.run
Code: Select all
$ java -cp ".:luokkapolku.dir/coreO.jar" luokkapolku.example.run
Code: Select all
Exception in thread "main" java.lang.NoClassDefFoundError:
JSci/maths/DoubleMatrix
at luokkapolku.example.run.main(run.java)
Here is some debug information from the java launcher:
Code: Select all
$ java -cp ".:luokkapolku/coreO.jar" luokkapolku.example.run
----_JAVA_LAUNCHER_DEBUG----
JRE path is /sys$common/java$142/jre
jvm.cfg[0] = ->-classi
jvm.cfg[1] = ->-nativ
jvm.cfg[2] = ->-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] = ->-classi
jvm.cfg[1] = ->-nativ
jvm.cfg[2] = ->-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)