ApplicationBaseGLFWGL3 (ClassNotFoundException)

This is essentially a self-help guide for an issue that mysteriously popped up for me in the past month. If the moderators would prefer this to be moved to StackOverflow, I’m happy to do so.

Background

I have used OPENRNDR for a few years on both Intel and Apple Silicon chips and it has always worked great. I am currently using a setup that is extremely similar to the openrndr-template. Recently for no apparent reason (no OS updates, no dependency updates, no configuration updates), I started getting this error trying to run any OPENRNDR sketch:

/Users/eric/Library/Java/JavaVirtualMachines/azul-13.0.14/Contents/Home/bin/java [...elided for clarity]
Warning: Running on macOS without -XstartOnFirstThread JVM argument. Restarting JVM with -XstartOnFirstThread.
SLF4J: No SLF4J providers were found.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See https://www.slf4j.org/codes.html#noProviders for further details.


│  sketch.S55_Synthesizer1Kt.main(S55_Synthesizer1.kt:-1)
├─ sketch.S55_Synthesizer1Kt.main(S55_Synthesizer1.kt:25)
│  org.openrndr.ApplicationBuilderKt.application(ApplicationBuilder.kt:86)
│  org.openrndr.ApplicationBuilderJVM.<init>(ApplicationBuilder.kt:106)
│  org.openrndr.ApplicationBase.Companion.initialize(ApplicationBase.kt:21)
│  org.openrndr.ApplicationBase.Companion.loadApplicationBase(ApplicationBase.kt:36)
├─ java.lang.ClassLoader.loadClass(ClassLoader.java:522)
├─ jdk.internal.loader.ClassLoaders.AppClassLoader.loadClass(ClassLoaders.java:178)
├─ jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
│
↑ org.openrndr.internal.gl3.ApplicationBaseGLFWGL3 (ClassNotFoundException) 


Process finished with exit code 0

Where S55_Synthesizer1 is the name of the file I was trying to run. It wasn’t clear to me why something wouldn’t be on the classpath, but I inspected closely and determined it was a line from OPENRNDR causing the issue, because I didn’t have org.openrndr.internal.gl3 on my classpath.

I have to assume something changed in my computer’s GL library, I’m not sure, I’ve never touched that.

The fix

I had to just change 3 lines in my build.gradle.kts file to fix the issue.

  1. Remove this line
  2. Change these two lines from
runtimeOnly(openrndr("gl3"))
runtimeOnly(openrndrNatives("gl3"))

to

implementation(openrndr("gl3"))
implementation(openrndrNatives("gl3"))

I didn’t test all of these changes independently, so it is possible only one of these changes is required.

Then, I rebuilt my Gradle project, and now the OPENRNDR applications run as expected. I hope this is useful for someone else.

1 Like

Discourse limited the number of links I could post in the OP, but this is the line that was causing the issue in the OPENRNDR application

Hi! Thanks a lot for taking the time to share your discovery! :+1: :slight_smile:

I’ll mention it in Slack in case something needs to be updated.

And welcome to the forum :wink:

I was wondering… what if you clone the openrndr-template and try ./gradlew run there? does it work without any changes?

Hm, strangely cloning openrndr-template and running ./gradlew run works just fine. This definitely makes me think I mistakenly touched something fragile in my repo, but I’m not sure what. Almost certainly user error :slight_smile:

What if you clone your own project in a new folder and try to build it without the changes you just did? I’ve seen sometimes funny behavior with something odd being cached in Idea… (in case it’s related to Gradle / Idea and not your code).

Well. That’s disappointing. Re-cloning my own project builds just fine. I guess you’re correct that it was a Gradle/Idea caching issue rather than an issue with the template or configuration.

Sorry to raise this issue, although perhaps it will still help someone else if this pops up. Thank you for the thorough replies and help!

No need to be sorry. It’s very valuable to know that this can happen.

It’s a pity that it’s not easy to reproduce so we could tell the JB / Gradle people about it. It’s not even easy to write a “if X happens” post because I think X can manifest in various ways, not always with the same error message :disappointed:

I any case great that it’s back working for you! :partying_face:

I’m seeing this issue as well. Is there an easy way to fix other than re-cloning? I’ve tried File > Invalidate Caches in Idea and manually deleting the gradle cache folder in ~/.gradle/caches, both to no avail.

The solution I posted in the OP did work for me, under the heading “The fix”

Ultimately I chose to re-clone because I wasn’t really sure what was the implication of the changes I was making to the build.gradle.kts, and I didn’t want to cause other unintended consequences

An update on this problem in case other people keep running into it (because I keep running into it): I solved it recently by closing Idea and deleting the (.gradle, .idea, and build) folders, and reopening. Idea will take a while to set stuff up like you’re opening it for the first time and re-create those folders. This to me is easier than re-cloning and moving everything over. I’m also sure I only needed to delete one of those folders, so next time this happens I’ll experiment one by one.

Also in terms of reproduction steps: I left Idea open and put my computer to sleep, and when it woke up this morning it wasn’t working.

1 Like