ClassNotFoundException
in
Contributed Library Questions
•
2 years ago
I know issues about this error have been posted elsewhere, on this forum and the old one, and from the multitude of posts (very few of which seem to give any clue as to what is going on), the issue seems to be packed around library jar's... so I posted here - hopefully it's the right place...
My error in question is being thrown when trying to create a new Object of a Class, but *only* when i'm doing this via the Network class - i.e. the following code, which creates a new Object from a Box2D Class, works fine when placed within
keyPressed(), for example...
- Box p = new Box(100, 100, boxindex);
- boxes.add(p);
- loadImage("blah.jpg");
- boxindex++;
but when I attempt to do something like
- c = s.available();
- if (c != null) {
- input = c.readString();
- input = input.substring(0, input.indexOf("\n"));
- Box p = new Box(100, 100, boxindex);
- boxes.add(p);
- loadImage("blah.jpg");
- boxindex++;
- }
then I get the error (the Class is called "Box", sketch is "kB_v4_7")
- processing.app.debug.RunnerException: ClassNotFoundException: kB_v4_7$Box
- at processing.app.Sketch.placeException(Sketch.java:1543)
- at processing.app.debug.Runner.findException(Runner.java:583)
- at processing.app.debug.Runner.reportException(Runner.java:558)
- at processing.app.debug.Runner.exception(Runner.java:498)
- at processing.app.debug.EventThread.exceptionEvent(EventThread.java:367)
- at processing.app.debug.EventThread.handleEvent(EventThread.java:255)
- at processing.app.debug.EventThread.run(EventThread.java:89)
- processing.app.debug.RunnerException: ClassNotFoundException: kB_v4_7$Box
- at processing.app.Sketch.placeException(Sketch.java:1543)
- at processing.app.debug.Runner.findException(Runner.java:583)
- at processing.app.debug.Runner.reportException(Runner.java:558)
- at processing.app.debug.Runner.exception(Runner.java:498)
- at processing.app.debug.EventThread.exceptionEvent(EventThread.java:367)
- at processing.app.debug.EventThread.handleEvent(EventThread.java:255)
- at processing.app.debug.EventThread.run(EventThread.java:89)
- Exception in thread "Animation Thread" java.lang.NoClassDefFoundError: kB_v4_7$Box
- at kB_v4_7.addImage(kB_v4_7.java:192)
- at kB_v4_7.draw(kB_v4_7.java:180)
- at processing.core.PApplet.handleDraw(PApplet.java:1606)
- at processing.core.PApplet.run(PApplet.java:1503)
- at java.lang.Thread.run(Thread.java:680)
- Caused by: java.lang.ClassNotFoundException: kB_v4_7$Box
- at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
- at java.security.AccessController.doPrivileged(Native Method)
- at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
- at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
- at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
- at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
- ... 5 more
I've thrown
println's inside and around the
if(c != null) statement, checking the length of the string, set and unset booleans, set all of this inside a function and call it from there, etc, etc,... and I know the network transmission is working fine, and I am getting the data that I expected to.
And because the Box2D Object instantiation is working in other instances/methods, I'm at a bit of a loss...
1