Saturday, 4 May 2019

jpype simple jar import and run main()

I'm trying to open a jar file and execute it's main function, but jpype is throwing an error that doesn't make sense to me. Here is my code:

jpype.startJVM(jpype.getDefaultJVMPath(), '-Djava.class.path="%s"' % jar)
CommandLine = jpype.JPackage('phylonet').coalescent.CommandLine
CommandLine.main(['-i', input_file, '-o', output_file])
jpype.shutdownJVM()

I get this error: TypeError: Package phylonet.coalescent.CommandLine.main is not Callable

I've provided the absolute path to the jar file, and I've gotten the main function from META-INF/MANIFEST.MF:

cat tmp/META-INF/MANIFEST.MF | grep Main-Class
Main-Class: phylonet.coalescent.CommandLine

The jar file I'm trying to open is called astral, from here: https://github.com/smirarab/ASTRAL

Calling it like this works as expected:

java -Djava.class.path="./astral.jar"

So why not when I call it with jpype?



from jpype simple jar import and run main()

1 comment:

  1. https://www.wizweb.in

    Wizweb Technology is a leading software development company custom website design, software development, SMS Provider, Bulk sms, transactional sms, promotional sms, mobile app development, Hosting Solution, seo(search engine optimization) and Digital marketing etc.

    ReplyDelete