[SOLVED] PeasyCam raises NoSuchMethodError for PApplet::registerDraw when using Intellij

Hi, trying to move my project into Intelij*, but I can’t get PeasyCam to work.
I’ve added the library to the project, and it correctly recognizes the PeasyCam type, but when I run the sketch I get the following runtimeException:

java.lang.RuntimeException: java.lang.NoSuchMethodError: processing.core.PApplet.registerDraw(Ljava/lang/Object;)V
	at processing.opengl.PSurfaceJOGL$2.run(PSurfaceJOGL.java:412)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NoSuchMethodError: processing.core.PApplet.registerDraw(Ljava/lang/Object;)V
	at peasy.DampedAction.<init>(DampedAction.java:42)
	at peasy.DampedAction.<init>(DampedAction.java:35)
	at peasy.PeasyCam$5.<init>(Unknown Source)
	at peasy.PeasyCam.<init>(Unknown Source)
	at peasy.PeasyCam.<init>(Unknown Source)
	at ExampleApplet.setup(ExampleApplet.java:36)
	at processing.core.PApplet.handleDraw(PApplet.java:2404)
	at processing.opengl.PSurfaceJOGL$DrawListener.display(PSurfaceJOGL.java:866)
	at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:692)
	at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:674)
	at jogamp.opengl.GLAutoDrawableBase$2.run(GLAutoDrawableBase.java:443)
	at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1293)
	at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1147)
	at com.jogamp.newt.opengl.GLWindow.display(GLWindow.java:759)
	at com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:81)
	at com.jogamp.opengl.util.AnimatorBase.display(AnimatorBase.java:452)
	at com.jogamp.opengl.util.FPSAnimator$MainTask.run(FPSAnimator.java:178)
	at java.util.TimerThread.mainLoop(Timer.java:555)
	at java.util.TimerThread.run(Timer.java:505)

Seems to be related to OpenGL, but without PeasyCam I have no problem running P3D sketches, and the jogl libs are available in the project.

*Not the most reccomended path for beginners, I know, but since my job uses Intelij I’ve grown quite accustumed…

2 Likes

Hi, I just tried add it to my current project and it works. I have peasycam.jar and peasy-math.jar added to Global Libraries. I add

private PeasyCam cam;

to my main class which extends PApplet, and

cam = new PeasyCam(this, 400);

inside setup() (not inside settings()!). That’s all.

2 Likes

I somehow missed the peasy-math.jar… Oops.
Thanks! Hope it’ll be helpful to some other poor fools in the future :wink:

1 Like

To avoid that problem, when adding a Processing library in IntelliJ Idea, I normally add the whole folder that contains the jar (instead of selecting a specific jar file), because this searches for any jars or system dependent binaries found in that folder and adds them to the project.

The exception to that is when I add the Processing core libraries (or libraries that have OS dependent versions), because I do not want to add Mac or Windows libraries since I’m on Linux. Then I manually select only these:

core.jar
gluegen-rt.jar
jogl-all.jar
gluegen-rt-natives-linux-amd64.jar
jogl-all-natives-linux-amd64.jar

The last two will depend on the OS you are targeting.

2 Likes