0

I'm trying to run an application using JavaFX in mac os but I get this error:

Exception in thread "main" java.lang.RuntimeException: java.lang.NoSuchMethodError: getScaleFactor
at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:281)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:124)
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:163)
at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:47)
at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:115)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.NoSuchMethodError: getScaleFactor
at com.sun.glass.ui.mac.MacApplication._initIDs(Native Method)
at com.sun.glass.ui.mac.MacApplication.<clinit>(MacApplication.java:34)
at com.sun.glass.ui.mac.MacPlatformFactory.createApplication(MacPlatformFactory.java:33)
at com.sun.glass.ui.Application.Run(Application.java:103)
at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:271)
... 5 more

I package the application in one jar using fat jar plugin for eclipse with and without jfxrt.jar, and the problem still exists

2
  • What Java Version do you run? Commented Mar 27, 2014 at 14:00
  • My first guess would have been an outdated java version but other than that from the stacktrace I can't think of the cause since JavaFX should be shipped with that version. Commented Mar 27, 2014 at 14:07

1 Answer 1

1

application in one jar using fat jar plugin

Don't do that. If you want to use that plugin, to package JavaFX applications, then log a feature request with the plugin creators to add JavaFX support to the plugin.

Use packaging methods which are aware of JavaFX and will correctly package your JavaFX application, for example:

There is a chance that onejar might work for you out of the box with Java 8 as some of the classloading rules for JavaFX changed to be more relaxed for Java 8, I guess you could try it and see if it works.

I package the application . . . with . . . jfxrt.jar

I don't recommend this unless you are packaging the entire JRE with the app. Reasons for not doing this are explained in the answer to: Maven project with JavaFX (with jar file in `lib`) (I know you are not using Maven, but the reasoning is similar).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.