Main window not visible when running JAR

edited July 2014 in Questions about Tools

I have a two-class program that runs fine when launched from Eclipse. The second class defines another window that provides some controls for what's going on in the main PApplet window. Not sure if it's that important to see the code, but it's all here: https://github.com/thejoelpatrol/VideoScrambler-Java In the main PApplet window, I play a Movie file that the user specifies. As I said, everything works fine when the program is run from Eclipse.

When I export the project as a JAR using Eclipse's regular wizard, I choose "Runnable JAR file" and then "Extract required libraries into generated JAR", which is how I want to avoid dependencies on other JARs (my intention is that doing this should include all the Processing native JARs). When I run the JAR, the secondary control window appears and behaves normally, but the main PApplet window does not appear.

I have the following JARs in my build path:
gstreamer-java.jar
jna.jar
video.jar
core.jar
7 gluegens for windows/mac/linux
7 jogls for windows/mac/linux

I don't think the movie is playing and the window is just not visible, because there is no sound. Unfortunately I can't see the Java console to see if any exceptions are being thrown, because I'm on Mac OS X 10.9 and using Java 1.6. Any suggestions for what I can try to diagnose what is going wrong?

Mac OS X 10.9.3
Eclipse Helios SR2
Apple Java 1.6.0_65-b14-462
Processing 2.0.3
Proclipsing 0.4.2.7

edit: I also just spent a while trying SvgExe. I eventually figured out which JARs I needed to include to make the resulting JAR runnable. But I still get the same behavior as with the JAR exported directly from Eclipse. On the natives tab, I tried including all the .dylib and .so files that appeared to correspond to the video library, with no luck on that either. I still get the second class's window, but no main PApplet window.

edit 2: I suspect the problem has to do with the video library. If I don't select a video file, the main window appears with nothing in it, as I would expect. How exactly should I be using SvgExe to include all the relevant files for the video library?

Answers

  • Follow up: I have run the jar from the command line, so I get all the console output on stdout. I get this exception when trying to create the Movie:

    Exception in thread "Animation Thread" java.lang.UnsatisfiedLinkError: Unable to load library 'gstreamer-0.10': dlopen(libgstreamer-0.10.dylib, 9): image not found
            at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:163)
            at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:236)
            at com.sun.jna.Library$Handler.<init>(Library.java:140)
            at com.sun.jna.Native.loadLibrary(Native.java:379)
            at org.gstreamer.lowlevel.GNative.loadNativeLibrary(Unknown Source)
            at org.gstreamer.lowlevel.GNative.loadLibrary(Unknown Source)
            at org.gstreamer.lowlevel.GstNative.load(GstNative.java:42)
            at org.gstreamer.lowlevel.GstNative.load(GstNative.java:39)
            at org.gstreamer.Gst.<clinit>(Gst.java:59)
            at processing.video.Video.initImpl(Video.java:126)
            at processing.video.Video.init(Video.java:71)
            at processing.video.Movie.initGStreamer(Movie.java:580)
            at processing.video.Movie.<init>(Movie.java:100)
            at videoscrambler.VideoScrambler.openMovie(VideoScrambler.java:24)
            at videoscrambler.VideoScrambler.setup(VideoScrambler.java:17)
            at processing.core.PApplet.handleDraw(PApplet.java:2281)
            at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:243)
            at processing.core.PApplet.run(PApplet.java:2177)
            at java.lang.Thread.run(Thread.java:745)
    

    So indeed, the problem is with the video, and specifically a failure to load gstreamer. I get this error with JARs that I create either in Eclipse or SvgExe, so I must be misunderstanding what needs to go where. Can someone explain exactly how I should bundle the .dylibs in my JAR?

Sign In or Register to comment.