gpt4 book ai didi

javafx - javafx 的 UnsatisfiedLinkError

转载 作者:行者123 更新时间:2023-12-02 11:48:29 26 4
gpt4 key购买 nike

我正在尝试学习javafx。我有一个非常简单的程序,可以在主方法(作为测试)和应用程序中打印一次“Hello World”。代码如下所示:

import javafx.stage.*;
import javafx.application.*;

public class HelloApp extends Application
{
public static void main(String[] args)
{
System.out.println("Hello World");
launch(args);
}

public void start(Stage stage)
{
System.out.println("Hello World");
}
}

这给了我以下输出。请注意,它打印第一个“Hello World”,但不打印第二个。

--------------------Configuration: javafx trials - JDK version 1.6.0_07 <Default> - <Default>--------------------
Hello World
Exception in thread "main" java.lang.RuntimeException: java.lang.UnsatisfiedLinkError: Can't load library: C:\Documents and Settings\apcs.LGSUHSD\My Documents\JCreator LE\MyProjects\bin\glass.dll
at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:281)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:124)
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:163)
at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:47)
at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:115)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.UnsatisfiedLinkError: Can't load library: C:\Documents and Settings\apcs.LGSUHSD\My Documents\JCreator LE\MyProjects\bin\glass.dll
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1650)
at java.lang.Runtime.load0(Runtime.java:770)
at java.lang.System.load(System.java:1005)
at com.sun.glass.utils.NativeLibLoader.loadLibraryFullPath(NativeLibLoader.java:200)
at com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:88)
at com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:31)
at com.sun.glass.ui.Application.loadNativeLibrary(Application.java:73)
at com.sun.glass.ui.Application.loadNativeLibrary(Application.java:80)
at com.sun.glass.ui.win.WinApplication$1.run(WinApplication.java:36)
at com.sun.glass.ui.win.WinApplication$1.run(WinApplication.java:33)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.glass.ui.win.WinApplication.<clinit>(WinApplication.java:33)
at com.sun.glass.ui.win.WinPlatformFactory.createApplication(WinPlatformFactory.java:20)
at com.sun.glass.ui.win.WinPlatformFactory.createApplication(WinPlatformFactory.java:17)
at com.sun.glass.ui.Application.Run(Application.java:103)
at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:271)
... 5 more

Process completed.

我不知道为什么会发生这种情况。我的项目中有javafx的jar文件。有人可以解释一下为什么会发生这种情况以及我能做些什么吗?

最佳答案

如果您使用 eclipse,请添加 C:\Program Files\Oracle\JavaFX Runtime\lib\jfxrt.jar 作为外部 jar 并重建项目。

关于javafx - javafx 的 UnsatisfiedLinkError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16551882/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com