JavaFX 不适用于我的 macbook(m1 芯片组)
JavaFX not working on my macbook (m1 chipset)
我正尝试在我的带有 m1 芯片的 macbook 上的 intelij 中启动一个 javaFX 项目。
当我尝试 运行 我的主文件时,我的程序崩溃并显示“java 意外退出”
这是 java 退出时的日志:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x0000000115378ac8, pid=20632, tid=259
#
# JRE version: OpenJDK Runtime Environment Zulu16.32+15-CA (16.0.2+7) (build 16.0.2+7)
# Java VM: OpenJDK 64-Bit Server VM Zulu16.32+15-CA (16.0.2+7, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, bsd-aarch64)
# Problematic frame:
# J 343 c2 java.lang.StringLatin1.indexOf([BII)I java.base@16.0.2 (36 bytes) @ 0x0000000115378ac8 [0x0000000115378ac0+0x0000000000000008]
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# If you would like to submit a bug report, please visit:
# http://www.azul.com/support/
#
--------------- S U M M A R Y ------------
Command Line: --module-path=/Users/moemenhussein/.m2/repository/org/openjfx/javafx-base/18.0.1/javafx-base-18.0.1-mac-aarch64.jar:/Users/moemenhussein/.m2/repository/org/openjfx/javafx-base/18.0.1/javafx-base-18.0.1.jar:/Users/moemenhussein/.m2/repository/org/openjfx/javafx-controls/18.0.1/javafx-controls-18.0.1-mac-aarch64.jar:/Users/moemenhussein/.m2/repository/org/openjfx/javafx-controls/18.0.1/javafx-controls-18.0.1.jar:/Users/moemenhussein/.m2/repository/org/openjfx/javafx-fxml/18.0.1/javafx-fxml-18.0.1-mac-aarch64.jar:/Users/moemenhussein/.m2/repository/org/openjfx/javafx-fxml/18.0.1/javafx-fxml-18.0.1.jar:/Users/moemenhussein/.m2/repository/org/openjfx/javafx-graphics/18.0.1/javafx-graphics-18.0.1-mac-aarch64.jar:/Users/moemenhussein/.m2/repository/org/openjfx/javafx-graphics/18.0.1/javafx-graphics-18.0.1.jar --add-modules=javafx.base,javafx.controls,javafx.fxml,javafx.graphics Main
Host: MacBookAir10,1 arm64 1 MHz, 8 cores, 8G, Darwin 21.4.0, macOS 12.3.1 (21E258)
Time: Mon May 16 20:00:48 2022 CEST elapsed time: 0.886937 seconds (0d 0h 0m 0s)
--------------- T H R E A D ---------------
Current thread (0x000000015700e800): JavaThread "JavaFX Application Thread" [_thread_in_Java, id=259, stack(0x000000016ae14000,0x000000016ce14000)]
Stack: [0x000000016ae14000,0x000000016ce14000], sp=0x000000016c62bd10, free space=24671k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
J 343 c2 java.lang.StringLatin1.indexOf([BII)I java.base@16.0.2 (36 bytes) @ 0x0000000115378ac8 [0x0000000115378ac0+0x0000000000000008]
V [libjvm.dylib+0x4217e4] _ZN13InstanceKlass17allocate_objArrayEiiP6Thread+0x144
V [libjvm.dylib+0x80609c] _ZN11OptoRuntime11new_array_CEP5KlassiP10JavaThread+0x1ec
siginfo: si_signo: 11 (SIGSEGV), si_code: 2 (SEGV_ACCERR), si_addr: 0x000000016c617d10
Register to memory mapping:
x0=0x00000007403e7d88 is an oop: java.lang.String
{0x00000007403e7d88} - klass: 'java/lang/String'
x1=0x000000074034a248 is an oop: [B
{0x000000074034a248} - klass: {type array byte}
- length: 1
x2=0x000000000000003f is an unknown value
x3=0x0 is NULL
x4=0x0 is NULL
x5=0x0000000000000001 is an unknown value
x6=0x0000000740353a78 is an oop: java.lang.String
{0x0000000740353a78} - klass: 'java/lang/String'
x7=0x0 is NULL
x8=0x00000000000409f8 is an unknown value
x9=
当我尝试从 Maven 选项卡 运行 项目时。 “javafx:运行”。我收到此错误:
[INFO]
[INFO] --- javafx-maven-plugin:0.0.6:run (default-cli) @ El_Dorado ---
[INFO] Toolchain in javafx-maven-plugin null
Loading library prism_es2 from resource failed: java.lang.UnsatisfiedLinkError: /Users/moemenhussein/.openjfx/cache/18.0.1+2/libprism_es2.dylib: dlopen(/Users/moemenhussein/.openjfx/cache/18.0.1+2/libprism_es2.dylib, 0x0001): tried: '/Users/moemenhussein/.openjfx/cache/18.0.1+2/libprism_es2.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))
java.lang.UnsatisfiedLinkError: /Users/moemenhussein/.openjfx/cache/18.0.1+2/libprism_es2.dylib: dlopen(/Users/moemenhussein/.openjfx/cache/18.0.1+2/libprism_es2.dylib, 0x0001): tried: '/Users/moemenhussein/.openjfx/cache/18.0.1+2/libprism_es2.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))
at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:383)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:227)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:169)
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2383)
at java.base/java.lang.Runtime.load0(Runtime.java:746)
at java.base/java.lang.System.load(System.java:1857)
at javafx.graphics@18.0.1/com.sun.glass.utils.NativeLibLoader.installLibraryFromResource(NativeLibLoader.java:217)
at javafx.graphics@18.0.1/com.sun.glass.utils.NativeLibLoader.loadLibraryFromResource(NativeLibLoader.java:197)
at javafx.graphics@18.0.1/com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:138)
at javafx.graphics@18.0.1/com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:54)
at javafx.graphics@18.0.1/com.sun.prism.es2.ES2Pipeline.lambda$static[=11=](ES2Pipeline.java:63)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:312)
at javafx.graphics@18.0.1/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 javafx.graphics@18.0.1/com.sun.prism.GraphicsPipeline.createPipeline(GraphicsPipeline.java:218)
at javafx.graphics@18.0.1/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:92)
at javafx.graphics@18.0.1/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)
at java.base/java.lang.Thread.run(Thread.java:831)
Loading library prism_sw from resource failed: java.lang.UnsatisfiedLinkError: /Users/moemenhussein/.openjfx/cache/18.0.1+2/libprism_sw.dylib: dlopen(/Users/moemenhussein/.openjfx/cache/18.0.1+2/libprism_sw.dylib, 0x0001): tried: '/Users/moemenhussein/.openjfx/cache/18.0.1+2/libprism_sw.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))
java.lang.UnsatisfiedLinkError: /Users/moemenhussein/.openjfx/cache/18.0.1+2/libprism_sw.dylib: dlopen(/Users/moemenhussein/.openjfx/cache/18.0.1+2/libprism_sw.dylib, 0x0001): tried: '/Users/moemenhussein/.openjfx/cache/18.0.1+2/libprism_sw.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))
at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:383)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:227)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:169)
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2383)
at java.base/java.lang.Runtime.load0(Runtime.java:746)
at java.base/java.lang.System.load(System.java:1857)
at javafx.graphics@18.0.1/com.sun.glass.utils.NativeLibLoader.installLibraryFromResource(NativeLibLoader.java:217)
at javafx.graphics@18.0.1/com.sun.glass.utils.NativeLibLoader.loadLibraryFromResource(NativeLibLoader.java:197)
at javafx.graphics@18.0.1/com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:138)
at javafx.graphics@18.0.1/com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:54)
at javafx.graphics@18.0.1/com.sun.prism.sw.SWPipeline.lambda$static[=11=](SWPipeline.java:43)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:312)
at javafx.graphics@18.0.1/com.sun.prism.sw.SWPipeline.<clinit>(SWPipeline.java:42)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:375)
at javafx.graphics@18.0.1/com.sun.prism.GraphicsPipeline.createPipeline(GraphicsPipeline.java:218)
at javafx.graphics@18.0.1/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:92)
at javafx.graphics@18.0.1/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)
at java.base/java.lang.Thread.run(Thread.java:831)
Graphics Device initialization failed for : es2, sw
Error initializing QuantumRenderer: no suitable pipeline found
java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
at javafx.graphics@18.0.1/com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(QuantumRenderer.java:283)
at javafx.graphics@18.0.1/com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:253)
at javafx.graphics@18.0.1/com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:266)
at javafx.graphics@18.0.1/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:291)
at javafx.graphics@18.0.1/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:163)
at javafx.graphics@18.0.1/com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:659)
at javafx.graphics@18.0.1/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:410)
at javafx.graphics@18.0.1/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:364)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1071)
Caused by: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
at javafx.graphics@18.0.1/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:95)
at javafx.graphics@18.0.1/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)
at java.base/java.lang.Thread.run(Thread.java:831)
Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1071)
Caused by: java.lang.RuntimeException: No toolkit found
at javafx.graphics@18.0.1/com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:278)
at javafx.graphics@18.0.1/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:291)
at javafx.graphics@18.0.1/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:163)
at javafx.graphics@18.0.1/com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:659)
at javafx.graphics@18.0.1/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:410)
at javafx.graphics@18.0.1/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:364)
... 5 more
[ERROR] Command execution failed.
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
at org.apache.commons.exec.DefaultExecutor.executeInternal (DefaultExecutor.java:404)
at org.apache.commons.exec.DefaultExecutor.execute (DefaultExecutor.java:166)
at org.openjfx.JavaFXBaseMojo.executeCommandLine (JavaFXBaseMojo.java:567)
at org.openjfx.JavaFXBaseMojo.executeCommandLine (JavaFXBaseMojo.java:434)
at org.openjfx.JavaFXRunMojo.execute (JavaFXRunMojo.java:105)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:78)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:567)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
at org.codehaus.classworlds.Launcher.main (Launcher.java:47)
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)
at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
at org.openjfx.JavaFXBaseMojo.executeCommandLine(JavaFXBaseMojo.java:567)
at org.openjfx.JavaFXBaseMojo.executeCommandLine(JavaFXBaseMojo.java:434)
at org.openjfx.JavaFXRunMojo.execute(JavaFXRunMojo.java:105)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
我真的不知道该怎么做了,我已将其添加到我的“vm 选项”(我还将 lib 文件夹添加到我的项目结构中的模块 -> 依赖项下):
--module-path "/Users/moemenhussein/Documents/JavaFX/javafx-sdk-18.0.1/lib" --add-modules=javafx.controls,javafx.fxml
我的 pom.xml 看起来像这样:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>El_Dorado</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>15</maven.compiler.source>
<maven.compiler.target>15</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>18.0.1</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>18.0.1</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>18.0.1</version>
<classifier>mac</classifier>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.8.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.6</version>
<configuration>
<mainClass>Main</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>
感谢您的帮助!
我在 Jose Pereda 的评论中得到了答复,说我必须使用更新的 JDK。我用的是 JDK 16.0.2 他说我至少要用 JDK 17.0.2.
所以我将 JDK 升级到 18.0.1。您可以在 intelij self 中下载 JDK,但这对我不起作用。所以我从 https://adoptium.net/ 下载了它并下载了 aarch64 版本。
我正尝试在我的带有 m1 芯片的 macbook 上的 intelij 中启动一个 javaFX 项目。 当我尝试 运行 我的主文件时,我的程序崩溃并显示“java 意外退出”
这是 java 退出时的日志:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x0000000115378ac8, pid=20632, tid=259
#
# JRE version: OpenJDK Runtime Environment Zulu16.32+15-CA (16.0.2+7) (build 16.0.2+7)
# Java VM: OpenJDK 64-Bit Server VM Zulu16.32+15-CA (16.0.2+7, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, bsd-aarch64)
# Problematic frame:
# J 343 c2 java.lang.StringLatin1.indexOf([BII)I java.base@16.0.2 (36 bytes) @ 0x0000000115378ac8 [0x0000000115378ac0+0x0000000000000008]
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# If you would like to submit a bug report, please visit:
# http://www.azul.com/support/
#
--------------- S U M M A R Y ------------
Command Line: --module-path=/Users/moemenhussein/.m2/repository/org/openjfx/javafx-base/18.0.1/javafx-base-18.0.1-mac-aarch64.jar:/Users/moemenhussein/.m2/repository/org/openjfx/javafx-base/18.0.1/javafx-base-18.0.1.jar:/Users/moemenhussein/.m2/repository/org/openjfx/javafx-controls/18.0.1/javafx-controls-18.0.1-mac-aarch64.jar:/Users/moemenhussein/.m2/repository/org/openjfx/javafx-controls/18.0.1/javafx-controls-18.0.1.jar:/Users/moemenhussein/.m2/repository/org/openjfx/javafx-fxml/18.0.1/javafx-fxml-18.0.1-mac-aarch64.jar:/Users/moemenhussein/.m2/repository/org/openjfx/javafx-fxml/18.0.1/javafx-fxml-18.0.1.jar:/Users/moemenhussein/.m2/repository/org/openjfx/javafx-graphics/18.0.1/javafx-graphics-18.0.1-mac-aarch64.jar:/Users/moemenhussein/.m2/repository/org/openjfx/javafx-graphics/18.0.1/javafx-graphics-18.0.1.jar --add-modules=javafx.base,javafx.controls,javafx.fxml,javafx.graphics Main
Host: MacBookAir10,1 arm64 1 MHz, 8 cores, 8G, Darwin 21.4.0, macOS 12.3.1 (21E258)
Time: Mon May 16 20:00:48 2022 CEST elapsed time: 0.886937 seconds (0d 0h 0m 0s)
--------------- T H R E A D ---------------
Current thread (0x000000015700e800): JavaThread "JavaFX Application Thread" [_thread_in_Java, id=259, stack(0x000000016ae14000,0x000000016ce14000)]
Stack: [0x000000016ae14000,0x000000016ce14000], sp=0x000000016c62bd10, free space=24671k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
J 343 c2 java.lang.StringLatin1.indexOf([BII)I java.base@16.0.2 (36 bytes) @ 0x0000000115378ac8 [0x0000000115378ac0+0x0000000000000008]
V [libjvm.dylib+0x4217e4] _ZN13InstanceKlass17allocate_objArrayEiiP6Thread+0x144
V [libjvm.dylib+0x80609c] _ZN11OptoRuntime11new_array_CEP5KlassiP10JavaThread+0x1ec
siginfo: si_signo: 11 (SIGSEGV), si_code: 2 (SEGV_ACCERR), si_addr: 0x000000016c617d10
Register to memory mapping:
x0=0x00000007403e7d88 is an oop: java.lang.String
{0x00000007403e7d88} - klass: 'java/lang/String'
x1=0x000000074034a248 is an oop: [B
{0x000000074034a248} - klass: {type array byte}
- length: 1
x2=0x000000000000003f is an unknown value
x3=0x0 is NULL
x4=0x0 is NULL
x5=0x0000000000000001 is an unknown value
x6=0x0000000740353a78 is an oop: java.lang.String
{0x0000000740353a78} - klass: 'java/lang/String'
x7=0x0 is NULL
x8=0x00000000000409f8 is an unknown value
x9=
当我尝试从 Maven 选项卡 运行 项目时。 “javafx:运行”。我收到此错误:
[INFO]
[INFO] --- javafx-maven-plugin:0.0.6:run (default-cli) @ El_Dorado ---
[INFO] Toolchain in javafx-maven-plugin null
Loading library prism_es2 from resource failed: java.lang.UnsatisfiedLinkError: /Users/moemenhussein/.openjfx/cache/18.0.1+2/libprism_es2.dylib: dlopen(/Users/moemenhussein/.openjfx/cache/18.0.1+2/libprism_es2.dylib, 0x0001): tried: '/Users/moemenhussein/.openjfx/cache/18.0.1+2/libprism_es2.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))
java.lang.UnsatisfiedLinkError: /Users/moemenhussein/.openjfx/cache/18.0.1+2/libprism_es2.dylib: dlopen(/Users/moemenhussein/.openjfx/cache/18.0.1+2/libprism_es2.dylib, 0x0001): tried: '/Users/moemenhussein/.openjfx/cache/18.0.1+2/libprism_es2.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))
at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:383)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:227)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:169)
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2383)
at java.base/java.lang.Runtime.load0(Runtime.java:746)
at java.base/java.lang.System.load(System.java:1857)
at javafx.graphics@18.0.1/com.sun.glass.utils.NativeLibLoader.installLibraryFromResource(NativeLibLoader.java:217)
at javafx.graphics@18.0.1/com.sun.glass.utils.NativeLibLoader.loadLibraryFromResource(NativeLibLoader.java:197)
at javafx.graphics@18.0.1/com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:138)
at javafx.graphics@18.0.1/com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:54)
at javafx.graphics@18.0.1/com.sun.prism.es2.ES2Pipeline.lambda$static[=11=](ES2Pipeline.java:63)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:312)
at javafx.graphics@18.0.1/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 javafx.graphics@18.0.1/com.sun.prism.GraphicsPipeline.createPipeline(GraphicsPipeline.java:218)
at javafx.graphics@18.0.1/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:92)
at javafx.graphics@18.0.1/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)
at java.base/java.lang.Thread.run(Thread.java:831)
Loading library prism_sw from resource failed: java.lang.UnsatisfiedLinkError: /Users/moemenhussein/.openjfx/cache/18.0.1+2/libprism_sw.dylib: dlopen(/Users/moemenhussein/.openjfx/cache/18.0.1+2/libprism_sw.dylib, 0x0001): tried: '/Users/moemenhussein/.openjfx/cache/18.0.1+2/libprism_sw.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))
java.lang.UnsatisfiedLinkError: /Users/moemenhussein/.openjfx/cache/18.0.1+2/libprism_sw.dylib: dlopen(/Users/moemenhussein/.openjfx/cache/18.0.1+2/libprism_sw.dylib, 0x0001): tried: '/Users/moemenhussein/.openjfx/cache/18.0.1+2/libprism_sw.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))
at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:383)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:227)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:169)
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2383)
at java.base/java.lang.Runtime.load0(Runtime.java:746)
at java.base/java.lang.System.load(System.java:1857)
at javafx.graphics@18.0.1/com.sun.glass.utils.NativeLibLoader.installLibraryFromResource(NativeLibLoader.java:217)
at javafx.graphics@18.0.1/com.sun.glass.utils.NativeLibLoader.loadLibraryFromResource(NativeLibLoader.java:197)
at javafx.graphics@18.0.1/com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:138)
at javafx.graphics@18.0.1/com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:54)
at javafx.graphics@18.0.1/com.sun.prism.sw.SWPipeline.lambda$static[=11=](SWPipeline.java:43)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:312)
at javafx.graphics@18.0.1/com.sun.prism.sw.SWPipeline.<clinit>(SWPipeline.java:42)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:375)
at javafx.graphics@18.0.1/com.sun.prism.GraphicsPipeline.createPipeline(GraphicsPipeline.java:218)
at javafx.graphics@18.0.1/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:92)
at javafx.graphics@18.0.1/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)
at java.base/java.lang.Thread.run(Thread.java:831)
Graphics Device initialization failed for : es2, sw
Error initializing QuantumRenderer: no suitable pipeline found
java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
at javafx.graphics@18.0.1/com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(QuantumRenderer.java:283)
at javafx.graphics@18.0.1/com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:253)
at javafx.graphics@18.0.1/com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:266)
at javafx.graphics@18.0.1/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:291)
at javafx.graphics@18.0.1/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:163)
at javafx.graphics@18.0.1/com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:659)
at javafx.graphics@18.0.1/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:410)
at javafx.graphics@18.0.1/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:364)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1071)
Caused by: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
at javafx.graphics@18.0.1/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:95)
at javafx.graphics@18.0.1/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)
at java.base/java.lang.Thread.run(Thread.java:831)
Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1071)
Caused by: java.lang.RuntimeException: No toolkit found
at javafx.graphics@18.0.1/com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:278)
at javafx.graphics@18.0.1/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:291)
at javafx.graphics@18.0.1/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:163)
at javafx.graphics@18.0.1/com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:659)
at javafx.graphics@18.0.1/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:410)
at javafx.graphics@18.0.1/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:364)
... 5 more
[ERROR] Command execution failed.
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
at org.apache.commons.exec.DefaultExecutor.executeInternal (DefaultExecutor.java:404)
at org.apache.commons.exec.DefaultExecutor.execute (DefaultExecutor.java:166)
at org.openjfx.JavaFXBaseMojo.executeCommandLine (JavaFXBaseMojo.java:567)
at org.openjfx.JavaFXBaseMojo.executeCommandLine (JavaFXBaseMojo.java:434)
at org.openjfx.JavaFXRunMojo.execute (JavaFXRunMojo.java:105)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:78)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:567)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
at org.codehaus.classworlds.Launcher.main (Launcher.java:47)
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)
at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
at org.openjfx.JavaFXBaseMojo.executeCommandLine(JavaFXBaseMojo.java:567)
at org.openjfx.JavaFXBaseMojo.executeCommandLine(JavaFXBaseMojo.java:434)
at org.openjfx.JavaFXRunMojo.execute(JavaFXRunMojo.java:105)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
我真的不知道该怎么做了,我已将其添加到我的“vm 选项”(我还将 lib 文件夹添加到我的项目结构中的模块 -> 依赖项下):
--module-path "/Users/moemenhussein/Documents/JavaFX/javafx-sdk-18.0.1/lib" --add-modules=javafx.controls,javafx.fxml
我的 pom.xml 看起来像这样:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>El_Dorado</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>15</maven.compiler.source>
<maven.compiler.target>15</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>18.0.1</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>18.0.1</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>18.0.1</version>
<classifier>mac</classifier>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.8.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.6</version>
<configuration>
<mainClass>Main</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>
感谢您的帮助!
我在 Jose Pereda 的评论中得到了答复,说我必须使用更新的 JDK。我用的是 JDK 16.0.2 他说我至少要用 JDK 17.0.2.
所以我将 JDK 升级到 18.0.1。您可以在 intelij self 中下载 JDK,但这对我不起作用。所以我从 https://adoptium.net/ 下载了它并下载了 aarch64 版本。