0

I am using jpype with Python 2.7 (jpype distribution from the university of california) and I'm trying to use a Java class from a jar file.

It works fine if I start the JVM with

startJVM(getDefaultJVMPath(), "-ea", "-Djava.class.path=D:/jmf.jar")

However, if I am using

startJVM(getDefaultJVMPath(), "-ea", "-cp", "D:/jmf.jar")

or

startJVM(getDefaultJVMPath(), "-ea", "-cp D:/jmf.jar")

the classes from that jar are not found... I also tried setting the classpath with

set CLASSPATH=".;D:\jmf.jar"

which didn't work neither.

What is more, using jars which include other jars does not seem to work. Is this a problem with my distribution or is this a general problem with JPype?

user2035039
  • 961
  • 3
  • 16
  • 30

1 Answers1

0

JPype doesn't call the java binary directly. It uses the jni libraries. Probably -cp is just a option of the java binary. The same will probably apply for the CLASSPATH env.

If you want to use more than one jar file or directories in the classpath you can use -Djava.class.path and concatenate the elements with the system's path separator. You can use os.path.pathsep.join for that purpose.

bastian
  • 1,122
  • 11
  • 23