Keep getting noClassDefFoundError Errors on Mac

Got a quick little question.
This past week, I’ve been working on some Java projects on my windows PC at home using Processing for the graphics. I’ve been using the ItelliJ IDE to add the processing library to the project, and it’s been working just fine.

Today however, I was away from home, and wanted to try and see if I could work on my MacBook as well. I went through the same steps for downloading the IntelliJ IDE and Processing, and adding Processing to the project. But this time after I try to run my program, I keep getting “java.lang.NoClassDefFoundError” errors.

I made a small trial program that should just make the box to draw in and a small circle inside the box, but the same error occurs. The line it points to as the error is where I declare the PApplet.main(“Classname”);

I’m unsure if this is just a Mac problem, or if there’s something else I have to do that I didn’t have to on my windows PC. But if you can help shed some light on what could be causing this problem, that’d be greatly appreciated.

This is the little test program I made that should just draw a circle to the screen. The consul showed a java.lang.noClassDefFoundError at the one line in the main method.

import processing.core.PApplet;

public class Test extends PApplet
    public static void main()

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

    public void draw()
         ellipse(150, 150, 50, 50);

This is the Error message I received:

java.lang.NoClassDefFoundError: com/apple/eawt/QuitHandler
	at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
	at java.base/java.lang.Class.privateGetDeclaredMethods(
	at java.base/java.lang.Class.getMethodsRecursive(
	at java.base/java.lang.Class.getMethod0(
	at java.base/java.lang.Class.getMethod(
	at processing.core.PApplet.runSketch(
	at processing.core.PApplet.main(
	at processing.core.PApplet.main(
	at Test.main(
Caused by: java.lang.ClassNotFoundException:
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(
	at java.base/java.lang.ClassLoader.loadClass(
	... 9 more

1 Like

What jdk are you using? Anything greater than jdk8 will throw this error as


is proprietary and no longer available. Failing that (ie you are using jdk8) you may be missing the apple.jar on your classpath. The @sampottinger fork addresses this issue I know about this because I maintain ruby versions of processing namelyJRubyArt and propane, where I now compile my own java core to support use with OpenJDK11.


That was it. It set to the default of JDK 10.
I swapped in JDK 8, and everything works like a charm now. Thank you so much.

I’m very late to the party, but I found this post because I had the exact same issue in April 2021, running Java 11 on Mac with the latest 3.3.7 Processing core.jar. After digging around I found that the internal Mac APIs that Processing has been misusing to add a proper quithandler and set a dock icon has now been removed and replaced by official AWT APIS. There is a class inside Processing called ThinkDifferent that is loaded by reflection when Mac is detected and this class was calling the now removed APIs. To solve this I reimplemented this class using the new official APIs and just added a new processing.core.ThinkDifferent class to my project that solved the issue.

package processing.core;

import java.awt.Desktop;
import java.awt.Image;
import java.awt.Taskbar;
import java.awt.desktop.QuitEvent;
import java.awt.desktop.QuitHandler;
import java.awt.desktop.QuitResponse;

public class ThinkDifferent {

  // True if user has tried to quit once. Prevents us from cancelling the quit
  // call if the sketch is held up for some reason, like an exception that's
  // managed to put the sketch in a bad state.
  static boolean attemptedQuit;

  public static void init(final PApplet sketch) {
    Desktop desktop = Desktop.getDesktop();
        new QuitHandler() {
          public void handleQuitRequestWith(QuitEvent e, QuitResponse response) {
            if (PApplet.uncaughtThrowable == null && !attemptedQuit) {
              attemptedQuit = true;
            } else {

  public static void cleanup() {

  // Called via reflection from PSurfaceAWT and others
  public static void setIconImage(Image image) {