Reputation: 241
Hey I already started a Java Project and I want to use JavaFX.
I copy the jfxrt.jar in the lib folder and I add it as an external jar in my project.
I tried this example https://docs.oracle.com/javase/8/javafx/interoperability-tutorial/swing-fx-interoperability.html But I'm getting this error:
Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: java.lang.UnsatisfiedLinkError: Can't load library: /home/spierki/Workspace/JavaProjects/Projet_GMD/lib/amd64/libglass.so at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:281) at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:122) at javafx.embed.swing.JFXPanel.initFx(JFXPanel.java:182) at javafx.embed.swing.JFXPanel.(JFXPanel.java:199) at mainActivity.MainActivity.initAndShowGUI(MainActivity.java:29) at mainActivity.MainActivity.access$1(MainActivity.java:26) at mainActivity.MainActivity$2.run(MainActivity.java:68) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75) at java.awt.EventQueue.dispatchEvent(EventQueue.java:726) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) Caused by: java.lang.UnsatisfiedLinkError: Can't load library: /home/spierki/Workspace/JavaProjects/Projet_GMD/lib/amd64/libglass.so at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1825) at java.lang.Runtime.load0(Runtime.java:809) at java.lang.System.load(System.java:1086) 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.gtk.GtkPlatformFactory$1.run(GtkPlatformFactory.java:28) at com.sun.glass.ui.gtk.GtkPlatformFactory$1.run(GtkPlatformFactory.java:25) at java.security.AccessController.doPrivileged(Native Method) at com.sun.glass.ui.gtk.GtkPlatformFactory.(GtkPlatformFactory.java:25) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:264) at com.sun.glass.ui.PlatformFactory.getPlatformFactory(PlatformFactory.java:20) at com.sun.glass.ui.Application.Run(Application.java:103) at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:271) ... 20 more
I'm using the luna version of eclipse and I tried to run the project with openjdk-7 and openjdk-8 but none of them is working.
Upvotes: 0
Views: 508
Reputation: 2377
In Eclipse, open Help -> Eclipse Marketplace.. and type javafx in the Find field. Install e(fx)clipse 1.0.0. When Eclipse restarts, you will find that you can create JavaFX projects from the new projects wizard dialog. There is also no need to include jfxrt.jar manually, it's included by default.
Lean more about this e(fx)clipse plugin here.
Upvotes: 2