Juan Diego
Juan Diego

Reputation: 1456

Maven javafx with java 8

After fixing some problems with maven I am having some with my standalone app, all my other libraries seem to load properly. I am getting this error

Exception in thread "main" java.lang.NoClassDefFoundError: javafx/embed/swt/FXCanvas
        at mapper.osm.main.Main.createContents(Main.java:280)
        at mapper.osm.main.Main.open(Main.java:182)
        at mapper.osm.main.Main.main(Main.java:117)
Caused by: java.lang.ClassNotFoundException: javafx.embed.swt.FXCanvas
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 3 more

jdc@hal-win MINGW64 ~/git/mapper-osm/mapper.osm/target (master)
$ java -version
java version "1.8.0_71"
Java(TM) SE Runtime Environment (build 1.8.0_71-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.71-b15, mixed mode)

I added this plugin to my pom.xml, but I still get the same problem https://github.com/javafx-maven-plugin/javafx-maven-plugin.

Isnt java 8 supposed to run with javafx natively?

Upvotes: 1

Views: 1955

Answers (2)

SDS
SDS

Reputation: 828

If you are using tycho then this should solve your issue http://tomsondev.bestsolution.at/2014/05/15/maven-tycho-0-20-0-and-java8-source-code/

Upvotes: 1

Bernhard Colby
Bernhard Colby

Reputation: 319

As the exception says, it cannot find a class, named FXCanvas under javafx/embed/swt. You need to add jfxswt.jar to your class path. There are two links, which may help you solve your issue. link 1 link2

I hope this helps.

Upvotes: 0

Related Questions