Open lfcnassif opened 3 years ago
Embedded manifest zipped below:
Jep has the concept of a ClassEnquirer which tells the python envionment which classes are available in python. I suspect your problem lies with the default implementation. I am not very familiar with this code but it appears to be reading the manifest of every jar in the classpath and processing every library specified int he manifest so it seems like your case should work. I recommend debugging into the ClassList to try to determine if it is processing your manifest and finding the referenced libraries.
@bsteffensmeier thank you for the answer, will try to debug when some time is available and report back here.
If I change current dir to lib folder and executes
java -jar ../app.jar
no error is thrown and the python script can access the java libraries. Default java classpath uses . directory.
I had the exact same issue when your application with all the dependencies was set up in a Linux environment using a regular user account. When the application and all the dependencies were set up using the root account the application could be launched from any directory without an error. Hope this info will be of some help in case you haven't solved this issue yet.
@bsteffensmeier sorry for late reply, just had time to debug it. The issue is in this line https://github.com/ninia/jep/blob/dev_3.9/src/main/java/jep/ClassList.java#L120
file.getParent()
is returning null because file is not absolute. Adding a simple check for null and using just relativePath or using file.getAbsoluteFile().getParent()
fixes this issue. I can send a PR if needed.
Unfortunately, this issue appears to have been missed and forgotten about. I think the fix would be a good fix in case others encounter this problem. @lfcnassif, are you still interested in submitting a pull request?
First, thank you all for this great project! My app has the following structure: ./app.jar ./lib/lib1.jar ./lib/lib2.jar ... My python script (called by java app) imports some classes from jars in lib folder. When executing
java -jar app.jar
, it throws jep.JepException: <class 'ModuleNotFoundError'>: No module named 'org.apache' for example. But all libraries are listed in app.jar manifest file and are used fine from app.jar embedded classes.If I change current dir to lib folder and executes
java -jar ../app.jar
no error is thrown and the python script can access the java libraries. Default java classpath uses . directory.Using jep-3.9.1 on Windows 10 with Oracle java 8 x64 and on Ubuntu 20.04 with Liberica OpenJDK 8 full.