I created quite complex project with JavaFX and now I'm having some trouble deploying it, as I never deployed any app in Java before.
I tried using Intellij "Build artificial" but I always get "Error: corrupted jarfile" when I try to open the the Jar it builds.
Any suggestions? I'm using external libraries from Maven and some local ones too if it helps...
Edit:
Ok I changed some of the settings in the Make Artificial, now I don't get that error.
I get this Exception, seems it can't file the fxml file...
Exception in Application start method
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(Unknown Source)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at java.base/sun.launcher.LauncherHelper$FXHelper.main(Unknown Source)
Caused by: java.lang.RuntimeException: Exception in Application start method
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(Unknown Source)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException: Location is required.
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.load(Unknown Source)
at sample.Main.start(Main.java:20)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(Unknown Source)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$11(Unknown Source)
at
javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$9(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(Unknown Source)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(Unknown Source)
... 1 more
Exception running application sample.Main
SOLVED!: just played with the fxml files patches and it fixed it...
Related
I have been working on an application with JavaFX and spring boot, it workes fine when I launch it from the Eclipse IDE but if I run the generated jar using :
java -jar AppXX.jar it gives me the error below:
Exception in Application init method
Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
Caused by: java.lang.RuntimeException: Exception in Application init method
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(Unknown Source)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: javafx.fxml.LoadException:
file:/C:/Users/XX/target/MDV2.0-0.0.1-SNAPSHOT.jar!/BOOT-INF/classes!/com/X/anotherProject/view/Welcome.fxml
at javafx.fxml/javafx.fxml.FXMLLoader.constructLoadException(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.load(Unknown Source)
at com.X.anotherProject.AnotherProjectApplication.init(AnotherProjectApplication.java:42)
... 3 more
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.javafx.reflect.Trampoline.invoke(Unknown Source)
at jdk.internal.reflect.GeneratedMethodAccessor36.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at javafx.base/com.sun.javafx.reflect.MethodUtil.invoke(Unknown Source)
at javafx.fxml/com.sun.javafx.fxml.MethodHelper.invoke(Unknown Source)
... 7 more
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at javafx.fxml/javafx.fxml.FXMLLoader$MethodHandler.invoke(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(Unknown Source)
at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source)
at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
at javafx.base/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(Unknown Source)
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)
at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
at javafx.base/javafx.event.Event.fireEvent(Unknown Source)
at javafx.graphics/javafx.scene.Node.fireEvent(Unknown Source)
at com.X.anotherProject.Controller.WelcomeController.FireAnEvent(WelcomeController.java:464)
at com.X.anotherProject.Controller.WelcomeController.initialize(WelcomeController.java:338)
... 17 more
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.javafx.reflect.Trampoline.invoke(Unknown Source)
at jdk.internal.reflect.GeneratedMethodAccessor36.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at javafx.base/com.sun.javafx.reflect.MethodUtil.invoke(Unknown Source)
at javafx.fxml/com.sun.javafx.fxml.MethodHelper.invoke(Unknown Source)
... 31 more
Caused by: javafx.fxml.LoadException:
file:/C:/Users/XX/target/MDV2.0-0.0.1-SNAPSHOT.jar!/BOOT-INF/classes!/com/X/anotherProject/view/Kits%20de%20migration.fxml
at javafx.fxml/javafx.fxml.FXMLLoader.constructLoadException(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.load(Unknown Source)
at com.sopraMdv.anotherProject.Controller.WelcomeController.loadInMainPane(WelcomeController.java:453)
at com.X.anotherProject.Controller.WelcomeController.press(WelcomeController.java:398)
... 41 more
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.javafx.reflect.Trampoline.invoke(Unknown Source)
at jdk.internal.reflect.GeneratedMethodAccessor36.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at javafx.base/com.sun.javafx.reflect.MethodUtil.invoke(Unknown Source)
at javafx.fxml/com.sun.javafx.fxml.MethodHelper.invoke(Unknown Source)
... 46 more
Caused by: java.lang.IllegalStateException: Location is not set.
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.load(Unknown Source)
at com.X.anotherProject.Controller.WelcomeController.loadInMainPane(WelcomeController.java:453)
at com.X.anotherProject.Controller.KitListController.AddElemnt(KitListController.java:115)
at com.X.anotherProject.Controller.KitListController.initialize(KitListController.java:98)
... 56 more
this is how I load the FXML file in my class :
public static void main(String[] args) {
Application.launch(args);
}
#Override
public void init() throws Exception {
springContext = SpringApplication.run(AnotherProjectApplication.class);
FXMLLoader fxmlLoader= new FXMLLoader(getClass().getResource("/com/X/anotherProject/view/Welcome.fxml"));
springContext.getAutowireCapableBeanFactory().autowireBean(this);
fxmlLoader.setControllerFactory(AnotherProjectApplication.springContext::getBean);
rootNode=fxmlLoader.load();
}
note that I have checked a lot of related problems and none of them worked.
The thing is that getClass().getResource() cannot find the FXML file.
When I opened the jar with Winrar I found the file in the given path :
file:/C:/Users/XX/target/MDV2.0-0.0.1-SNAPSHOT.jar!/BOOT-INF/classes!/com/X/anotherProject/view/Welcome.fxml
I am trying to implement the RangeSlider class in a program, however, I am receiving the following error:
Exception in Application start method
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(Unknown Source)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at java.base/sun.launcher.LauncherHelper$FXHelper.main(Unknown Source)
Caused by: java.lang.RuntimeException: Exception in Application start method
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(Unknown Source)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalAccessError: class impl.org.controlsfx.behavior.RangeSliderBehavior (in unnamed module #0x74bf073e) cannot access class com.sun.javafx.scene.control.inputmap.InputMap$Mapping (in module javafx.controls) because module javafx.controls does not export com.sun.javafx.scene.control.inputmap to unnamed module #0x74bf073e
at impl.org.controlsfx.behavior.RangeSliderBehavior.<init>(RangeSliderBehavior.java:67)
at impl.org.controlsfx.skin.RangeSliderSkin.<init>(RangeSliderSkin.java:95)
at org.controlsfx.control.RangeSlider.createDefaultSkin(RangeSlider.java:194)
at javafx.controls/javafx.scene.control.Control.doProcessCSS(Unknown Source)
at javafx.controls/javafx.scene.control.Control.access$000(Unknown Source)
at javafx.controls/javafx.scene.control.Control$1.doProcessCSS(Unknown Source)
at javafx.controls/com.sun.javafx.scene.control.ControlHelper.processCSSImpl(Unknown Source)
at javafx.graphics/com.sun.javafx.scene.NodeHelper.processCSS(Unknown Source)
at javafx.graphics/javafx.scene.Parent.doProcessCSS(Unknown Source)
at javafx.graphics/javafx.scene.Parent.access$400(Unknown Source)
at javafx.graphics/javafx.scene.Parent$1.doProcessCSS(Unknown Source)
at javafx.graphics/com.sun.javafx.scene.ParentHelper.processCSSImpl(Unknown Source)
at javafx.graphics/com.sun.javafx.scene.NodeHelper.processCSS(Unknown Source)
at javafx.graphics/javafx.scene.Parent.doProcessCSS(Unknown Source)
at javafx.graphics/javafx.scene.Parent.access$400(Unknown Source)
at javafx.graphics/javafx.scene.Parent$1.doProcessCSS(Unknown Source)
at javafx.graphics/com.sun.javafx.scene.ParentHelper.processCSSImpl(Unknown Source)
at javafx.graphics/com.sun.javafx.scene.NodeHelper.processCSS(Unknown Source)
at javafx.graphics/javafx.scene.Parent.doProcessCSS(Unknown Source)
at javafx.graphics/javafx.scene.Parent.access$400(Unknown Source)
at javafx.graphics/javafx.scene.Parent$1.doProcessCSS(Unknown Source)
at javafx.graphics/com.sun.javafx.scene.ParentHelper.processCSSImpl(Unknown Source)
at javafx.graphics/com.sun.javafx.scene.NodeHelper.processCSS(Unknown Source)
at javafx.graphics/javafx.scene.Node.processCSS(Unknown Source)
at javafx.graphics/javafx.scene.Scene.doCSSPass(Unknown Source)
at javafx.graphics/javafx.scene.Scene.preferredSize(Unknown Source)
at javafx.graphics/javafx.scene.Scene$2.preferredSize(Unknown Source)
at javafx.graphics/com.sun.javafx.scene.SceneHelper.preferredSize(Unknown Source)
at javafx.graphics/javafx.stage.Window$12.invalidated(Unknown Source)
at javafx.base/javafx.beans.property.BooleanPropertyBase.markInvalid(Unknown Source)
at javafx.base/javafx.beans.property.BooleanPropertyBase.set(Unknown Source)
at javafx.graphics/javafx.stage.Window.setShowing(Unknown Source)
at javafx.graphics/javafx.stage.Window.show(Unknown Source)
at javafx.graphics/javafx.stage.Stage.show(Unknown Source)
at minimalist.DoubleSliderInterface.start(DoubleSliderInterface.java:104)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(Unknown Source)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$11(Unknown Source)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$9(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(Unknown Source)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(Unknown Source)
... 1 more
Exception running application minimalist.DoubleSliderInterface
I am using ControlsFX version 9.0.0 while running Java 10 on Eclipse, however, I believe I can rule out incompatibility with the Java version as I also tried running this on Java 9.0.4 and as well was able to successfully run the Rating class.
My code is just a number of instances of the following, succeeded by a VBox to contain them, a group, and the scene and stage as is normal-
final RangeSlider blur = new RangeSlider(0,30,0,30);
Text blurTitle = new Text("Blur");
Text blurMin = new Text();
blurMin.textProperty().bindBidirectional(blur.lowValueProperty(),converter);
Text blurMax = new Text();
blurMax.textProperty().bindBidirectional(blur.highValueProperty(),converter);
HBox blurBox = new HBox();
blurBox.getChildren().addAll(blurMin,blur,blurMax);
blurBox.setPadding(new Insets(5));
blurBox.setSpacing(10);
Any help is appreciated, thanks.
Adding --add-exports=javafx.controls/com.sun.javafx.scene.control.inputmap=ALL-UNNAMED to your VM arguments when running the application will resolve the issue. Answer thanks to #kleopatra
There is already a bug report on their bitbucket page. It looks like it's just not compatible with java9+
https://bitbucket.org/controlsfx/controlsfx/issues/802/rangeslider-uses-inaccessable-package
I didn't read the code of this specific control but you might be able to copy the code you need and remove the part that uses the InputMap related classes.
Other than that you are probably better off downgrading to java8 or using another ui element to mimic similar behavior.
Here i have my artifact output layout. I included jfoenix lib so i don't have any problems with running my project.
Build was successful. Now i have these files in my artifacts folder
And when i run my jar file i still get this output
Exception in Application start method
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(Unknown Source)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at java.base/sun.launcher.LauncherHelper$FXHelper.main(Unknown Source)
Caused by: java.lang.RuntimeException: Exception in Application start method
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(Unknown Source)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: com/sun/javafx/css/StyleConverterImpl
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(Unknown Source)
at java.base/java.security.SecureClassLoader.defineClass(Unknown Source)
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(Unknown Source)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(Unknown Source)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(Unknown Source)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
at com.jfoenix.controls.JFXButton$StyleableProperties.<clinit>(JFXButton.java:208)
at com.jfoenix.controls.JFXButton.<init>(JFXButton.java:156)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.base/java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.base/java.lang.Class.newInstance(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader$InstanceDeclarationElement.constructValue(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader$ValueElement.processStartElement(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.processStartElement(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.load(Unknown Source)
at main.Main.start(Main.java:15)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(Unknown Source)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$11(Unknown Source)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$9(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(Unknown Source)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(Unknown Source)
... 1 more
Caused by: java.lang.ClassNotFoundException: com.sun.javafx.css.StyleConverterImpl
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
... 37 more
Exception running application main.Main
I use jdk1.8_171 and run using jre1.8_171. What's the problem here?
Comment by fabian is correct. i was actually running my app with Java >= 9. Adding jfoenix lib for Java 9 solved the problem.
Hello Friend's plz help me on this. When i run this code in my java file
code: Parent root=FXMLLoader.load(getClass().getResource("first.fxml"));
to get the fxml file that contain the Java Builder code, then i face these Problems. My code is not run. Problems are:
Exception in Application start method
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.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(Unknown Source)
at com.sun.javafx.application.LauncherImpl.launchApplication(Unknown Source)
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 sun.launcher.LauncherHelper$FXHelper.main(Unknown Source)
Caused by: java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(Unknown Source)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$155(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException: Location is required.
at javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml.FXMLLoader.load(Unknown Source)
at firt.first.start(first.java:17)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$null$173(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(Unknown Source)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(Unknown Source)
... 1 more
Exception running application firt.first
Plz help me, guide me what to do ......
In your exception it says "Caused by: java.lang.NullPointerException: Location is required."
You have to set the correct location of your fxml file.
Parent root=FXMLLoader.load(getClass().getResource("first.fxml"));
According to your code, your fxml file is expected to be in the same folder like your .java file on the system.
I'm trying to launch a runnable JAR file via web start, but am encountering an error with java not being able to find an external JAR (I think). When running the JNLP file, JWS starts, but then states that the application cannot be opened due to this error:
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.sun.javaws.Launcher.executeApplication(Unknown Source)
at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
at com.sun.javaws.Launcher.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/net/ftp/FTPClient
at DevChat.canConnect(DevChat.java:326)
at DevChat.<init>(DevChat.java:89)
at DevChat.main(DevChat.java:348)
... 9 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.net.ftp.FTPClient
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 12 more
The external JAR file mentioned, apache commons, is embedded in the runnable JAR and the JAR runs fine on it's own, just not in JWS. Suggestions?