I'm Getting this error and I can't seem to figure out exactly what wrong. It was working just fine three days ago and now I am unable to run it. I see that is having troubles with the image url, but I've double checked the url and tried an alternate with no luck. I don't understand why it was working a few days ago when I haven't changed anything.
Here is the code:
public class MCobbM10A2 extends Application {
#Override
public void start(Stage primaryStage) {
Pane pane = new Pane();
ImageView imageView = new ImageView("images/Black_Cat.png");
imageView.setFitHeight(100);
imageView.setFitWidth(100);
pane.getChildren().add(imageView);
PathTransition pt1 = new PathTransition(Duration.millis(2000)
,new Line(100, 100, 750, 500), imageView);
pt1.setInterpolator(Interpolator.LINEAR);
PathTransition pt2 = new PathTransition(Duration.millis(500)
,new Line(750, 500, 600, 550), imageView);
pt2.setInterpolator(Interpolator.LINEAR);
PathTransition pt3 = new PathTransition(Duration.millis(1600)
,new Line(600, 550, 50, 150), imageView);
pt3.setInterpolator(Interpolator.LINEAR);
PathTransition pt4 = new PathTransition(Duration.millis(360)
,new Line(50, 150, 100, 100), imageView);
pt3.setInterpolator(Interpolator.LINEAR);
SequentialTransition s = new SequentialTransition(pt1, pt2, pt3, pt4);
s.play();
Scene scene = new Scene(pane, 800, 600);
primaryStage.setTitle("Cat Move");
primaryStage.setScene(scene);
primaryStage.show();
}
/**
* #param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
}
Here is the Stack Trace:
Executing C:\Users\cmatt\Desktop\MCobbM10A2\dist\run1883417844\MCobbM10A2.jar using platform C:\Program Files\Java\jdk1.8.0_241\jre/bin/java
Exception in Application start method
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$1(LauncherImpl.java:182)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalArgumentException: Invalid URL: Invalid URL or resource not found
at javafx.scene.image.Image.validateUrl(Image.java:1118)
at javafx.scene.image.Image.<init>(Image.java:620)
at javafx.scene.image.ImageView.<init>(ImageView.java:166)
at mcobbm10a2.MCobbM10A2.start(MCobbM10A2.java:22)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$8(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$7(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$4(WinApplication.java:186)
... 1 more
Caused by: java.lang.IllegalArgumentException: Invalid URL or resource not found
at javafx.scene.image.Image.validateUrl(Image.java:1110)
... 12 more
Exception running application mcobbm10a2.MCobbM10A2
Java Result: 1
EDIT:
Here's the new Error:
C:\Users\cmatt\OneDrive - Lincoln Land Community College\Spring 2020\CSC 176\Netbeans Projects\MCobbM10A2\nbproject\jfx-impl.xml:3867: The following error occurred while executing this line:
C:\Users\cmatt\OneDrive - Lincoln Land Community College\Spring 2020\CSC 176\Netbeans Projects\MCobbM10A2\nbproject\jfx-impl.xml:3904: The following error occurred while executing this line:
C:\Users\cmatt\OneDrive - Lincoln Land Community College\Spring 2020\CSC 176\Netbeans Projects\MCobbM10A2\nbproject\build-impl.xml:1134: Directory C:\Users\cmatt\OneDrive - Lincoln Land Community College\Spring 2020\CSC 176\Netbeans Projects\MCobbM10A2\dist creation was not successful for an unknown reason
BUILD FAILED (total time: 1 second)
Related
I am a beginner of JavaFX. When I create a JavaFX project with Scene Builder. I just run and check the default user interface and got an error. The full stack trace is attached below. I don't know how to solve this problem.
Exception in Application start method
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$1(LauncherImpl.java:182)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException: Location is required.
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3207)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3175)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3148)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3124)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3104)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3097)
at javafxapplication9.JavaFXApplication9.start(JavaFXApplication9.java:22)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$8(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$7(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$4(WinApplication.java:186)
... 1 more
Exception running application javafxapplication9.JavaFXApplication9
C:\Users\kobinath\Documents\NetBeansProjects\JavaFXApplication9\nbproject\build-impl.xml:1052: The following error occurred while executing this line:
C:\Users\kobinath\Documents\NetBeansProjects\JavaFXApplication9\nbproject\build-impl.xml:806: Java returned: 1
BUILD FAILED (total time: 1 second)
i don't know why. what i tried so far i attached below
public class JavaFXApplication9 extends Application {
#Override
public void start(Stage stage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml"));
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
}
/**
* #param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
FXMLDocumentController
public class FXMLDocumentController implements Initializable {
#FXML
private Label label;
#FXML
private void handleButtonAction(ActionEvent event) {
System.out.println("You clicked me!");
label.setText("Hello World!");
}
#Override
public void initialize(URL url, ResourceBundle rb) {
// TODO
}
}
I'm writing a simple application with java and trying to play sounds but I can't get it to work when I create the Media object it throws
java.lang.reflect.InvocationTargetException , the file name is correct , and i tried the full file path name and i get the same error
my code is :
`
public class Try extends Application {
#Override
public void start(Stage primaryStage) throws Exception {
Pane pane = new Pane () ;
Button b = new Button("click here ") ;
Media m = new Media ("music.mp3");
MediaPlayer md = new MediaPlayer(m) ;
b.setOnAction(e -> {
md.play();
System.out.println("clicked");
});
pane.getChildren().add(b) ;
Scene s = new Scene(pane , 300 ,300 ) ;
primaryStage.setScene(s);
primaryStage.show();
}
public static void main(String[] args) {
Application.launch(args);
}
i tried .wav files and get same error .
the full error :
`
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(LauncherImpl.java:389)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
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(LauncherImpl.java:917)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$159(LauncherImpl.java:182)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalArgumentException: uri.getScheme() == null! uri == 'music.mp3'
at com.sun.media.jfxmedia.locator.Locator.<init>(Locator.java:218)
at javafx.scene.media.Media.<init>(Media.java:393)
at ttry.Try.start(Try.java:17)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$166(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$179(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$177(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$178(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$152(WinApplication.java:177)
... 1 more
Exception running application ttry.Try
`
I'm getting a big trace when trying to run this code which display an image, however I'm not sure why the code isn't running. Any ideas?
public class SplashScreen extends Application {
public static void main(String[] args) {
Application.launch(args);
}
#Override
public void start(Stage stage) throws Exception {
//Parent rootNode = null;
Group root = new Group();
Scene scene = new Scene(root, 500, 500);
GridPane gridpane = new GridPane();
gridpane.setPadding(new Insets(5));
gridpane.setHgap(10);
gridpane.setVgap(10);
ImageView algLogo = new ImageView();
Image logo = new Image("D:/Users/Tozu/workspace/ACA 5 OOJP/AlgonquinCollegeLogo.jpg");
algLogo.setImage(logo);
final HBox pictureRegion = new HBox();
pictureRegion.getChildren().add(algLogo);
gridpane.add(pictureRegion, 1, 1);
root.getChildren().add(gridpane);
stage.setTitle("ACA 5");
stage.setScene(scene);
stage.show();
}
I've also tried a little test class that confirms whether I have the path for the JPG correct and it seems to work fine, so I don't think the problem lies with the JPG path.
For clarification the JPG is located in the class folder, not in the src folder
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(LauncherImpl.java:389)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
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(LauncherImpl.java:917)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$155(LauncherImpl.java:182)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalArgumentException: Invalid URL: unknown protocol: d
at javafx.scene.image.Image.validateUrl(Image.java:1121)
at javafx.scene.image.Image.<init>(Image.java:620)
at splashPkg.SplashScreen.start(SplashScreen.java:39)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
... 1 more
Caused by: java.net.MalformedURLException: unknown protocol: d
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at javafx.scene.image.Image.validateUrl(Image.java:1115)
... 11 more
Exception running application splashPkg.SplashScreen
You have to set the URL file protocol
Image logo = new Image("file:D:/Users/Tozu/workspace/ACA 5 OOJP/AlgonquinCollegeLogo.jpg");
^ here
From the documentation of Image https://docs.oracle.com/javafx/2/api/javafx/scene/image/Image.html
// load an image and resize it only in one dimension, to the height of 100 and
// the original width, without preserving original aspect ratio
// The image is located in the current working directory
Image image4 = new Image("file:flower.png", 0, 100, false, false);
A better way to do the same thing is to use a File object (As suggested by James_D)
File f = new File("D:/Users/Tozu/workspace/ACA 5 OOJP/AlgonquinCollegeLogo.jpg");
Image logo = new Image(f.toURI().toString());
I keep getting this error no matter what I do to change it. I am very new to JavaFX and thought I would try out a small program. I am just trying to have a picture show up on the scene but I can't even have the image load up on my program. I placed the images in a package(seaapp.images) that is next to the main package(seaapp)
package seaapp;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.Pane;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
public class SeaApp extends Application {
#Override
public void start(Stage primaryStage) {
ImageView image = new ImageView(new Image(SeaApp.class.getResourceAsStream("images/space.png")));
Pane root = new Pane();
root.getChildren().add(image);
Scene scene = new Scene(root, 300, 250);
primaryStage.setTitle("Hello World!");
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
This gives me this error:
Exception in Application start method
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$152(LauncherImpl.java:182)
at com.sun.javafx.application.LauncherImpl$$Lambda$50/355629945.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException: Input stream must not be null
at javafx.scene.image.Image.validateInputStream(Image.java:1109)
at javafx.scene.image.Image.<init>(Image.java:694)
at seaapp.SeaApp.start(SeaApp.java:27)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$159(LauncherImpl.java:863)
at com.sun.javafx.application.LauncherImpl$$Lambda$53/1175241703.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$172(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl$$Lambda$46/1685538367.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$null$170(PlatformImpl.java:295)
at com.sun.javafx.application.PlatformImpl$$Lambda$48/435396101.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$171(PlatformImpl.java:294)
at com.sun.javafx.application.PlatformImpl$$Lambda$47/485815673.run(Unknown Source)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$145(WinApplication.java:101)
at com.sun.glass.ui.win.WinApplication$$Lambda$36/1673605040.run(Unknown Source)
... 1 more
Exception running application seaapp.SeaApp
Java Result: 1
This works fine when I add a URL of a picture as the new Image but when I have a downloaded picture, it gives me this error. My netbeans is fully updated too. I have put links to screenshots of how I set up the files. Am I missing something?
Setup of Projects:
https://drive.google.com/file/d/0B_KZLduvxt26dE5XS1p5blE5VFE/view?usp=sharing
Setup of Files:
https://drive.google.com/file/d/0B_KZLduvxt26Nm1sZWROSlRMeUE/view?usp=sharing
Link to Entire Project:
https://drive.google.com/file/d/0B_KZLduvxt26dXVFYlFhREFGZW8/view?usp=sharing
Add a forward slash / before images/space.png and your code will work fine (That is, if the path is correct).
ImageView image = new ImageView(new Image(SeaApp.class.getResourceAsStream("/images/space.png")));
EDIT:
Its supposed to work fine.
Do it this way:
Image image = new Image( getClass().getResource( "images/space.png").toExternalForm());
ImageView image = new ImageView( image);
If that doesn't work, find out which path to look:
System.out.println( "Path: " + getClass().getResource("/").toExternalForm());
System.out.println( "Path: " + getClass().getResource("images").toExternalForm());
...
and check if the image is there.
change following line :
ImageView image = new ImageView(new Image(SeaApp.class.getResourceAsStream("images/space.png")))
to
ImageView image = new ImageView(new Image(SeaApp.class.getResourceAsStream("file:./"+"images/space.png")))
reference : https://stackoverflow.com/a/23878479/6336264
Had the same problem with image inside jar wrapped into exe
The problem was the first capital letter in the file name. Paths are case-sensitive in wrapper but not when you run it under IDE on Windows.
I have a javafx app that works great on my PC but doesn't work at all on my laptop
I believe I have the same setup on my PC and my laptop:
NetBeans 7.4
Java 1.7.0_45
This is the start method
#Override
public void start(Stage stage) throws Exception {
FXMLLoader loader = new FXMLLoader();
Parent fxmlRoot = (Parent) loader.load(new FileInputStream(new File(
"src\\com\\gasstation\\views\\main-layout.fxml")));
Scene scene = new Scene(fxmlRoot);
stage.setScene(scene);
stage.show();
GasStationXmlParser parser = new GasStationXmlParser("src\\config.xml");
newGasStation = parser.getGasStations();
MainController mainController = loader.getController();
for (GasStation station : newGasStation) {
mainController.setConfigData(station);
}
startAllGasStations();
}
when I try to run the app I get:
java.lang.NullPointerException
at javafx.fxml.FXMLLoader.equals(FXMLLoader.java:1855)
at javafx.fxml.FXMLLoader.isCyclic(FXMLLoader.java:1867)
at javafx.fxml.FXMLLoader.access$2200(FXMLLoader.java:66)
at javafx.fxml.FXMLLoader$IncludeElement.constructValue(FXMLLoader.java:935)
at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:565)
at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2348)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2164)
at com.gasstation.main.Main.start(Main.java:27)
at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:319)
at com.sun.javafx.application.PlatformImpl$5.run(PlatformImpl.java:216)
at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:179)
at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:176)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:176)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:76)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:17)
at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:67)
at java.lang.Thread.run(Thread.java:744)
Exception in Application start method
Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:403)
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.NullPointerException
at javafx.stage.Window.impl_visibleChanging(Window.java:816)
at javafx.stage.Stage.impl_visibleChanging(Stage.java:922)
at javafx.stage.Window$9.invalidated(Window.java:690)
at javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:127)
at javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:161)
at javafx.stage.Window.setShowing(Window.java:779)
at javafx.stage.Window.show(Window.java:794)
at javafx.stage.Stage.show(Stage.java:229)
at com.gasstation.main.Main.start(Main.java:37)
at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:319)
at com.sun.javafx.application.PlatformImpl$5.run(PlatformImpl.java:216)
at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:179)
at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:176)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:176)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:76)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:17)
at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:67)
... 1 more
Java Result: 1
And I couldn't resolve anything from that...
Any ideas?
Try calling loader.setLocation(Main.class.getResource(/com/gasstation/views/main-layout.fxml)); before Parent fxmlRoot = (Parent) loader.load(new FileInputStream(new File("src\com\gasstation\views\main-layout.fxml")));