1

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?

Juan Diego
  • 1,396
  • 4
  • 19
  • 52
  • `javafx/embed/swt/FXCanvas` is a class from the the [JavaFX SWT compability](https://docs.oracle.com/javase/8/javafx/interoperability-tutorial/fx-swt_interoperability.htm). It's not in the JDK directly. – Tunaki Jan 28 '16 at 18:38

2 Answers2

1

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/

SDS
  • 828
  • 3
  • 17
  • 35
0

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.

Community
  • 1
  • 1
Bernhard Colby
  • 311
  • 5
  • 17