Hi, I'm trying to run some code from python accessing a JAR file with some a Java class that I wrote. I start the Java gateway like this:
classpath = '/path/to/jar/file.jar'
self.javagateway = JavaGateway.launch_gateway(classpath=cp, javaopts=['-Xmx4096m'], die_on_exit=True)
This works, and I can access standard Java classes within the JVM. However, I am unable to access the class within the jar.I get the following error:
TypeError: 'JavaPackage' object is not callable
As far as I can tell this means either py4j can't find the constructor I'm calling, or the JVM can't find it. Strangely, I can query the JVM for its classpath and my jar shows up. I do this using:
self.javagateway.jvm.java.net.URLClassLoader.getSystemClassLoader().getURLs()[1].getFile()
I'm doing this on an Ubuntu system, and I've gotten the same exact code to work on a different Ubuntu system, with same version of Java, python, py4j. I've now tried it on an additional Ubuntu system and run into the same problem. Does anyone have any suggestions for how I might be able to fix or debug this?
Henry