py5generator icon indicating copy to clipboard operation
py5generator copied to clipboard

Improve error message for when py5 is unable to properly add its own jars

Open hx2A opened this issue 9 months ago • 4 comments

Reference:

https://github.com/py5coding/py5generator/issues/605#issuecomment-2676998006

py5 needs to add its jars to the classpath. When using pyinstaller, the jar files need to be included in the install package. If they are not, the user will get this error. We can check for this exception here and output a more helpful error.

hx2A avatar Feb 23 '25 18:02 hx2A

When using pyinstaller, the jar files need to be included in the install package.

What if we'd prefer py5 to use the system's own JDK from $JAVA_HOME instead?

GoToLoop avatar Feb 23 '25 20:02 GoToLoop

When using pyinstaller, the jar files need to be included in the install package.

What if we'd prefer py5 to use the system's own JDK from $JAVA_HOME instead?

Sure, that's fine. You don't have to package up the JDK or JRE with pyinstaller if you know your end users will have it already and you know that jpype will be able to find it on their machines.

You always need to include the jars though. py5 won't be able to run if the jars in the Python package are missing.

hx2A avatar Feb 24 '25 00:02 hx2A

You always need to include the jars though. py5 won't be able to run if the jars in the Python package are missing.

I'm confused w/ your last statements... Will "jpype" be able to recognize Java via system variable $JAVA_HOME?

GoToLoop avatar Feb 24 '25 01:02 GoToLoop

You always need to include the jars though. py5 won't be able to run if the jars in the Python package are missing.

I'm confused w/ your last statements... Will "jpype" be able to recognize Java via system variable $JAVA_HOME?

Yes, it will do that. py5's Jars are not stored at $JAVA_HOME though, they are in a directory inside the Python module. py5 needs to explicitly add them to the JVM's classpath before starting the JVM. If pyinstaller is misconfigured, it will give JPype the wrong path and the Jars will not be properly added to the classpath.

hx2A avatar Feb 24 '25 01:02 hx2A

Fixed with #649

hx2A avatar May 19 '25 20:05 hx2A