Lilah Sahay
Lilah Sahay

Reputation: 33

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:

Upvotes: 3

Views: 1658

Answers (1)

Rick Ridley
Rick Ridley

Reputation: 583

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.)

Upvotes: 6

Related Questions