jdf / Processing.py-Bugs

A home for all bugs and feature requests about Python Mode for the Processing Development Environment.
41 stars 8 forks source link

java.lang.ClassCastException thrown when calling add_library(...) #381

Open tomsiw opened 11 months ago

tomsiw commented 11 months ago

A call to add_library(...) always throws ClassCastException no mater which library I'm trying to add. Callstack:

java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap')
    at jycessing.LibraryImporter.addJarToClassLoader(LibraryImporter.java:315)
    at jycessing.LibraryImporter.recursivelyAddJarsToClasspath(LibraryImporter.java:164)
    at jycessing.LibraryImporter.addLibrary(LibraryImporter.java:140)
    at jycessing.LibraryImporter$1.__call__(LibraryImporter.java:82)
    at org.python.core.PyObject.__call__(PyObject.java:480)
    at org.python.core.PyObject.__call__(PyObject.java:484)
        ...

Example code:

add_library('minim')
from ddf.minim import Minim, Controller
RMMeerding commented 6 months ago

I've got the same problem as 'tomsiw'. Trying to add Box2D and JBox2D in a way as suggested long time ago --https://forum.processing.org/two/discussion/25473/box2d-for-python-mode.html-- in order to explore chapter 5 in 'the Nature of Code' by Daniel Schiffman. But it doesn't work, all I get is the same java.lang.ClassCastException ...

villares commented 6 months ago

Hi @tomsiw and @RMMeerding!

I'm afraid Processing Python Mode currently lacks a maintainer, at this point.

If you, like me, enjoy using the Processing graphics vocabulary with Python, you can do it with Python 3, using p5py (which is all new and does not depend on Processing/Java, you would need to use only libraries from the Python ecossystem) or py5 (which uses Processing 4 jars, many Processing Java libraries work).

For 2D Physics I use https://pymunk.org, for audio I'm still looking around.