thirdy / durian

Path of Exile Items watcher
http://thirdy.github.io/durian/
GNU General Public License v2.0
35 stars 10 forks source link

java.lang.NoClassDefFoundError: javafx/embed/swing/JFXPanel #38

Closed marshauf closed 8 years ago

marshauf commented 8 years ago

Hello,

I upgraded from 0.4.1 to 0.5 and running "java -jar durian.jar" returns the following error: 0 [main] INFO qic.Main - guiEnabled: true Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: javafx/embed/swing/JFXPanel at qic.util.SoundUtilsFX.init(SoundUtilsFX.java:54) at qic.ui.QicFrame.<init>(QicFrame.java:53) at qic.Main.lambda$showGui$33(Main.java:134) 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$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76) 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.ClassNotFoundException: javafx.embed.swing.JFXPanel at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 17 more

java -version openjdk version "1.8.0_65" OpenJDK Runtime Environment (build 1.8.0_65-b17) OpenJDK 64-Bit Server VM (build 25.65-b01, mixed mode)

What dependencies changed and what could I do to fix it?

thirdy commented 8 years ago

nice, running in linux?

try getting latest version of java. Right now I'm using:

1.8.0_66

But it seems odd that the _65 does have JFXPanel, I suspect that they don't have that at all. hmm.

This part of the code is solely for the Sound part. see "qic.util.SoundUtilsFX". I can probably put a fallback to the old way of making sound.

If wanna compile it, reverting these changes should fix it:

durian/src/main/java/qic/ui/AutomatedPanel.java

-import qic.util.SoundUtils;
 +import qic.util.SoundUtilsFX;

    private void playsound() {
 -      try {
 -          SoundUtils.tone(5000,100);
 -      } catch (LineUnavailableException e) {
 -          e.printStackTrace();
 -      }
 +      String pathToFile = Config.getPropety(Config.AUTOMATED_SEARCH_SOUND_FILENAME, "notification.wav");
 +      double vol = Config.getDoubleProperty(Config.AUTOMATED_SEARCH_SOUND_VOLUME, 1.0);
 +      new Thread(() -> SoundUtilsFX.play(pathToFile, vol)).run();
    }
marshauf commented 8 years ago

Yes, it runs on Linux OpenSuse 13.2 64bit. The newest version java-1_8_0-openjdk is 1.8.0.65. I can't get the .66. I don't have a Java dev environment setup at the moment. I will do that now.

Edit: I can't compile it after I reversed the mentioned change above. The following files also contain javafx package imports which I do not have. ./src/main/java/qic/util/SoundUtilsFX.java:21:import javafx.embed.swing.JFXPanel; ./src/main/java/qic/util/SoundUtilsFX.java:22:import javafx.scene.media.Media; ./src/main/java/qic/util/SoundUtilsFX.java:23:import javafx.scene.media.MediaPlayer;

Edit2: LineUnavailableException does not exist. src/main/java/qic/ui/AutomatedPanel.java:[279,17] cannot find symbol symbol: class LineUnavailableException location: class qic.ui.AutomatedPanel

Edit3: After removing all javafx code durian compiles and runs.

Edit4: http://stackoverflow.com/questions/18547362/javafx-and-openjdk "There are currently no Linux distributions that already offer an OpenJFX package so users wouldn't have to build it themselves." That is why I can't find a package for JavaFX/OpenJFX, it doesn't exist yet.

thirdy commented 8 years ago

Whoops, sorry I ripped Durian for linux.

I noticed that you used OpenJDK, so you have the compiler. It's great that you got it compiled. Did you use maven?

The sound library that came in with JavaFX was convenient so I used that. But using some other older library is probably the way to go.

Btw, are you able to run Blackmarket (another tool I made but is made in JavaFX)? Probably not huh?

marshauf commented 8 years ago

Yes, I used maven. If you can achieve the same with an older library that would be great. I don't know why OpenJFX isn't packaged in any distribution and OpenJDK 9 will take another 1.3 years. I can't compile Blackmarket due missing JavaFX, so I can't probably run it.

thirdy commented 8 years ago

won't fix anytime soon. closing ticket.

NeiroNext commented 8 years ago

You can install openjfx package in linux, openJDK don't include openjx inside