4

I am trying do learn javafx. I have a very simple program to print "Hello World" once in the main method (as a test) and once in the Application. The code looks like this:

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");
    }
}

this gives me the following output. Note that it prints the first "Hello World", but not the second.

--------------------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.

I have no Idea why this is happening. I have the jar file for javafx in the project. Can someone please explain why this is happening and what I can do about it?

4

1 回答 1

1

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

于 2013-12-17T09:40:19.573 回答