apache / netbeans

Apache NetBeans
https://netbeans.apache.org/
Apache License 2.0
2.67k stars 854 forks source link

openjfx exception when creating new project on macos 12.6 - Apple Silicon #5167

Open flozano opened 1 year ago

flozano commented 1 year ago

Apache NetBeans version

Apache NetBeans 16

What happened

Fresh install of NB 16

When creating a new web project:

image

after clicking "Next", I get:

image

which contains an exception:

java.lang.RuntimeException: No toolkit found
    at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:276)
    at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:291)
    at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:163)
    at javafx.embed.swing.JFXPanel.lambda$initFx$1(JFXPanel.java:225)
[catch] at java.base/java.lang.Thread.run(Thread.java:833)
Loading library prism_es2 from resource failed: java.lang.UnsatisfiedLinkError: Can't load library: /Users/flozano/.openjfx/cache/17/libprism_es2.dylib
java.lang.UnsatisfiedLinkError: Can't load library: /Users/flozano/.openjfx/cache/17/libprism_es2.dylib
    at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2393)
    at java.base/java.lang.Runtime.load0(Runtime.java:755)
    at java.base/java.lang.System.load(System.java:1953)
    at com.sun.glass.utils.NativeLibLoader.installLibraryFromResource(NativeLibLoader.java:217)
    at com.sun.glass.utils.NativeLibLoader.loadLibraryFromResource(NativeLibLoader.java:197)
    at com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:138)
    at com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:54)
    at com.sun.prism.es2.ES2Pipeline.lambda$static$0(ES2Pipeline.java:63)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
    at com.sun.prism.es2.ES2Pipeline.<clinit>(ES2Pipeline.java:52)
    at java.base/java.lang.Class.forName0(Native Method)
    at java.base/java.lang.Class.forName(Class.java:375)
    at com.sun.prism.GraphicsPipeline.createPipeline(GraphicsPipeline.java:218)
    at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:92)
    at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)
    at java.base/java.lang.Thread.run(Thread.java:833)

How to reproduce

No response

Did this work correctly in an earlier version?

No / Don't know

Operating System

macos 12.6 monterrey - apple silicion

JDK

17.0.5 from Azul

Apache NetBeans packaging

Apache NetBeans provided installer

Anything else

No response

Are you willing to submit a pull request?

Yes

Code of Conduct

Yes

flozano commented 1 year ago
/Applications/NetBeans/Apache NetBeans 16.app/Contents/MacOS ❯ file netbeans
netbeans: Mach-O 64-bit executable x86_64
flozano commented 1 year ago

if I switch to a x86_64 JDK and use rosetta2, it works well.

gwinstanley commented 1 year ago

I've just encountered something very similar while building a Gradle project. My guess is the dependency classifier for the JavaFX resources is still set to be mac, when on Apple Silicon it should be mac-aarch64. While I don't use the JavaFX Gradle plugin, its source for JavaFXPlatform.java shows this clearly.

I'm fairly certain resolving these JavaFX dependencies in the new project module would resolve this.

neilcsmith-net commented 1 year ago

This should be fixed in NB19 by #6028 I believe.

When creating a new web project:

Also note that Java Frontend Application may not be what you're looking for here. It's a badly labelled project type IMO.

flozano commented 1 year ago

yeah, pretty misleading name... I was just exploring the options for curiosity and found this issue, but not interested in the "java(script) frontend application" type itself 👍

mbien commented 1 year ago

Also note that Java Frontend Application may not be what you're looking for here. It's a badly labelled project type IMO.

@neilcsmith-net I agree. We should fix this to make it less generic sounding and tell what project type it is.