Java 22 mac osx native access - how?

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Java 22 mac osx native access - how?

imakerobots
This post was updated on .
Hello,

I tried to build and run Makleangelo Software (https://github.com/marginallyclever/makelangelo-software/) and Robot-Overlord (https://github.com/MarginallyClever/Robot-Overlord-App) in IDEA with Oracle's OpenJDK 25 and got a hard JVM crash.  

I got a warning about "--enable-native-access".  Research didn't lead to success.

How do I set up my app so that it runs (a) in debug and (b) when jpackaged?

Thank you!

PS: wow, i post a lot to this forum!
Reply | Threaded
Open this post in threaded view
|

Re: Java 22 mac osx native access - how?

gouessej
Administrator
Have you tried --enable-native-access=ALL-UNNAMED?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Java 22 mac osx native access - how?

imakerobots
Yes, both as a VM option in IDEA and as a command line argument.  It made the warning go away but didn't fix the issue.

Someone else suggested using -XstartOnFirstThread, apparently that's a thing LWJGL has to do.

> You should now be ready to develop and launch an LWJGL application. Following is a simple example that utilizes GLFW to create a window and clear the background color to red, using OpenGL.
> MacOS users should start their application passing "-XstartOnFirstThread" as a VM option.

Reply | Threaded
Open this post in threaded view
|

Re: Java 22 mac osx native access - how?

hharrison
The --enable-native-access shouldn't have any effect yet other than warning about jni use, it's not enforcing anything yet (as far as I've been able to tell from the jaamsim side so far). I just added the enable-native access = ALL-UNNAMED to the manifest for our executable jar to avoid the warning for now.

Harvey

Reply | Threaded
Open this post in threaded view
|

Re: Java 22 mac osx native access - how?

gouessej
Administrator
In reply to this post by imakerobots
imakerobots wrote
Yes, both as a VM option in IDEA and as a command line argument.  It made the warning go away but didn't fix the issue.
Please can you post a stacktrace of the crash?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Java 22 mac osx native access - how?

imakerobots
I upgraded to 2.6.0.  My minimal Gl2 example works, but the gl3 and gl4 do not.
Now they produce a black rectangle.  display() is definitely being called.  even glClear() does nothing.

> Please can you post a stacktrace of the crash?

of the JVM crash?  It doesn't offer a stacktrace, it offers a memory dump log file thing.

I'm working in https://github.com/MarginallyClever/Robot-Overlord-App/tree/dev
And the minimal tests are
src/test/java/com/marginallyclever/ro3/apps/viewport/MinimalOpenGL2.java
src/test/java/com/marginallyclever/ro3/apps/viewport/MinimalOpenGL3.java
src/test/java/com/marginallyclever/ro3/apps/viewport/MinimalOpenGL4.java
Reply | Threaded
Open this post in threaded view
|

Re: Java 22 mac osx native access - how?

hharrison
The log file may at least provide the faulting location if not a full stack trace, I think without any actual information to go on it's going to be very hard to help you out ;-)
Reply | Threaded
Open this post in threaded view
|

Re: Java 22 mac osx native access - how?

imakerobots
I know what you mean.  The computer I can test on is also where I have very limited access.  I don't have immediate way to deliver the log file from there.  That's why I offered instead the entire project in the hopes someone better connected than I could assist.  I'm still trying to get the file.