Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java Processing ClassNotFound Exception

I'm trying to follow some simple tutorials for using Processing in Java with Eclipse (This one specifically), and I am coming up with a weird runtime error while trying to launch even the most basic of programs.

This is my code, basically an exact copy from the tutorial:

package processingTest;
import processing.core.PApplet;

public class UsingProcessing extends PApplet{

    public static void main(String[] args) {
        PApplet.main("UsingProcessing");
    }

    public void settings(){
        size(300,300);
    }

    public void setup(){
        fill(120,50,240);
    }

    public void draw(){
        ellipse(width/2,height/2,second(),second());
    }
}

There's no compiling errors, it all looks fine until I run it. When I do, though, it just spits this out:

java.lang.RuntimeException: java.lang.ClassNotFoundException: UsingProcessing
    at processing.core.PApplet.runSketch(PApplet.java:10706)
    at processing.core.PApplet.main(PApplet.java:10513)
    at processing.core.PApplet.main(PApplet.java:10495)
    at processingTest.UsingProcessing.main(UsingProcessing.java:7)
Caused by: java.lang.ClassNotFoundException: UsingProcessing
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at processing.core.PApplet.runSketch(PApplet.java:10699)
    ... 3 more

I'm pretty lost with this. I've researched around for a few hours and come up with nothing, I think I just don't know what to be looking for. If there's any more information needed, I'll be glad to give it.

Things I've tried:

  • Reinstalling Processing

  • Reinstalling Java

  • Reinstalling Eclipse

  • Including all the other misc packages from Processing

  • Messing around with syntax with PApplet.main("UsingProcessing");

like image 988
Lilah Sahay Avatar asked Aug 29 '26 11:08

Lilah Sahay


1 Answers

The link you posted includes the following sentence:

NOTE: If your class is part of a package other than the default package, you must call PApplet's main using the package name as well, like this: PApplet.main("packageName.ClassName");

instead of PApplet.main("UsingProcessing")

you should call PApplet.main("processingTest.UsingProcessing")

(Your package name is found at the top of your class declaration file.)

like image 131
Rick Ridley Avatar answered Sep 01 '26 00:09

Rick Ridley



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!