Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMichelle Pak
2,945 PointsException in Application start method
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:917) at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$155(LauncherImpl.java:182) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.NullPointerException at com.teamtreehouse.pomodoro.Main.start(Main.java:15) 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
Process finished with exit code 1
I get this when I run the file I downloaded for Pomodoro project.
Any ideas?
2 Answers
Ricardo Sala
16,212 PointsHey! I just found this anwer by Michael Walker (thanks if you read this dude!)
"Hello Piyush, I also had the same problem at first. After you import the project, right click on the resources folder in IntelliJ, click on 'Mark Directory As' and then click on Mark as Resources Root as Craig pointed out a couple of videos back. The folder should now be overlapped with a set of a stock of library books (what Craig calls gold coins). After that run Main again and it should work like a charm. :-)"
AND IT DOES!
Greg Witt
27,133 PointsI did this and it still has a Huge Stack of errors
These are the Errors I am getting
/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/bin/java --add-modules javafx.base,javafx.graphics --add-reads javafx.base=ALL-UNNAMED --add-reads javafx.graphics=ALL-UNNAMED "-javaagent:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=56012:/Applications/IntelliJ IDEA.app/Contents/bin" -Dfile.encoding=UTF-8 -p "/Users/user/Documents/Libraries/javafx-sdk-14/lib/javafx.base.jar:/Users/user/Documents/Libraries/javafx-sdk-14/lib/javafx.graphics.jar:/Users/user/Desktop/project 4/Pomodoro/out/production/Pomodoro:/Users/user/Documents/Libraries/javafx-sdk-14/lib/javafx-swt.jar:/Users/user/Documents/Libraries/javafx-sdk-14/lib/javafx.controls.jar:/Users/user/Documents/Libraries/javafx-sdk-14/lib/javafx.fxml.jar:/Users/user/Documents/Libraries/javafx-sdk-14/lib/javafx.media.jar:/Users/user/Documents/Libraries/javafx-sdk-14/lib/javafx.swing.jar:/Users/user/Documents/Libraries/javafx-sdk-14/lib/javafx.web.jar" -m Pomodoro/com.teamtreehouse.pomodoro.Main
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(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:464)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1051)
Caused by: java.lang.RuntimeException: Exception in Application start method
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:900)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.NullPointerException
at Pomodoro/com.teamtreehouse.pomodoro.Main.start(Main.java:15)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
Exception running application com.teamtreehouse.pomodoro.Main
Process finished with exit code 1
Ricardo Sala
16,212 PointsI am having the same problem here and no answer to solve it...please help!
Simon Coates
28,694 PointsSimon Coates
28,694 PointsNull pointer means something is null where an object is expected (you probably appreciate this by now). If the code is what i'm looking at, the things that look most breakable are the getResource methods. The error message you got isn't as helpful as you might like, so i'd try to narrow it down and isolate a precise method invocation, then look at why the variable could be null.
I might split that line of code over multiple lines and so some output to confirm if a variable i expect to have a value has a value. Or if you're using an IDE, you can set a breakpoint and examine the variable values on a real execution, step over lines etc.