7
I developed a Javafx application, created an Ant script through build.fxbuild
and ran a jar.
The generated jar runs Ok on the computer on my service and on another developer’s computer, however it doesn’t run on two non-developer computers, it also doesn’t run on two virtual machines that I have on my pc and as amazing as it seems it doesn’t run on my home computer, developer. All OS I tried are Windows (none was 7 Home Basic), I don’t believe the problem is related to OS.
When I spin the jar I see a window:
Javafx Launcher Error
Exception while running Application
How the image shows:
Running the jar through the command prompt using java -jar meuprojeto.jar
i get the following stack trace:
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.javafx.main.Main.launchApp(Main.java:642)
at com.javafx.main.Main.main(Main.java:805)
Caused by: java.lang.RuntimeException: Application launch error
at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:122)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.UnsatisfiedLinkError: com.sun.glass.ui.win.WinApplication._
invokeLater(Ljava/lang/Runnable;)V
at com.sun.glass.ui.win.WinApplication._invokeLater(Native Method)
at com.sun.glass.ui.Application.invokeLater(Application.java:338)
at com.sun.javafx.tk.quantum.QuantumToolkit.defer(QuantumToolkit.java:62
0)
at com.sun.javafx.application.PlatformImpl.runLater(PlatformImpl.java:17
3)
at com.sun.javafx.application.PlatformImpl.runAndWait(PlatformImpl.java:
212)
at com.sun.javafx.application.PlatformImpl.tkExit(PlatformImpl.java:320)
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherIm
pl.java:421)
at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:
47)
at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:115)
... 1 more
I have other Javafx applications with far fewer dependencies that run normally on these computers.
I already checked the variables of the PATH system and everything seems to be ok.
I used Maven to get all the dependencies correctly (I believe), but unfortunately I had to desMavenizar my project then because I had problems deploying through it, for being a project in Javafx. But I kept the dependencies he brought me, and I cared in the proper way.
Trying to understand this mistake that says nothing of anything I found a question that could have helped me if I had a decent answer:
The mediocre solution proposed by the author himself does not seem appropriate, however it made me think that some dependence is missing in my jar that was generated.
How do I find out what the problem is if the only tip I have is this mysterious stack trace? And how to solve?
I don’t intend to use the Javafx Maven Plugin, I had some bad experiences with him and I think I’ll solve my problem for Ant much more easily.
Just one question: Javafx 2.x or 8?
– Mansueli
@Kyllopardiun 2.2 point something, if you need to know what the "something" is I can find out, but it will take a little while
– Math
I don’t need to. The only thing you should be careful about using Javafx 2.2 (i.e Java 7) is that jfxrt.jar library is not included by default. And this is often Javafx programmers forget this detail. Otherwise, there’s no helping you without knowing the content of the lines
Main.java:642
andMain.java:805
although I suspect they are the call of the UI.– Mansueli
@Kyllopardiun with ctz the library was included. On the line of Main.java:642, it does not belong to my application but to Javafx itself, pay attention to the package: com.javafx.main.Main.launchApp. In the entire stack trace there is no reference to even a single line of a class developed by me, so I called him mysterious, he left me almost no hint.
– Math
@Kyllopardiun By the way, I’ve already managed to solve the problem, but it turns out I’ve done so much to try to solve that I don’t know exactly which one was the solution, I think it was the fact of upgrading jdk from u25 to u45, but I’m not sure, I need some time to run some tests and find out. And more than that, I would like to know what exactly of my application makes the mistake, because in another application of mine I had no problems. I also have to test the solution suggested by the answer below. I only know that there are several possibilities, rsrs..
– Math