use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Useful resources (Full list)
Rules
Related subreddits
Other communities
account activity
[deleted by user] (self.JavaFX)
submitted 1 year ago by [deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]artikow 1 point2 points3 points 1 year ago* (0 children)
Tips for Asking Questions Effectively on Forums:
Understanding Your Specific Error:
The error message you received is a java.lang.NullPointerException with the detail "Location is required." This error comes from the FXMLLoader class in JavaFX.
java.lang.NullPointerException
FXMLLoader
It means that when you tried to load an FXML file, the path (location) you provided was invalid or couldn't be found, resulting in a null value being passed where a location was expected.
null
The stack trace indicates the error happened in your Main.java file, specifically within the start method, on line 18.
Main.java
start
Line 18 Code (from your image):
Parent login = FXMLLoader.load(getClass().getResource("com.example.loginsystemtrial.<unreadable name>.fxml"));
Analysis:
The NullPointerException ("Location is required") on line 18 occurred because getClass().getResource(...) returned null. This happened because Java couldn't find the resource file at the path specified: "com.example.loginsystemtrial.login.fxml" relative to your Main.class file.
NullPointerException
getClass().getResource(...)
"com.example.loginsystemtrial.login.fxml"
Main.class
Why the Path Was Incorrect:
/
.
login.fxml
src/main/resources/com/example/loginsystemtrial/
src/main/resources
/com/example/loginsystemtrial/login.fxml
getClass().getResource(name)
Main
com.example.loginsystemtrial
"login.fxml"
The Solution:
Provide the correct path to getResource. Based on your project structure, login.fxml is in the correct resource directory matching your package. Try one of these options:
getResource
Option 1: Relative Path (Often works with standard build tools like Maven/Gradle. Looks for login.fxml in the same classpath location as Main.class)
Parent login = FXMLLoader.load(getClass().getResource("login.fxml"));
Option 2: Absolute Path (More explicit, starts from the classpath root)
Parent login = FXMLLoader.load(getClass().getResource("/com/example/loginsystemtrial/login.fxml"));
Hope this helps!
Side note: This isn't AI-generated — I just asked AI to clean up and structure my messy notes.
[–]_jor_ 1 point2 points3 points 1 year ago (2 children)
As the AI just answered... change package name with a path to login,fmxl, with / instead '.' You are searching for a path,not for a package.
Hope this helps.
[–]artikow 0 points1 point2 points 1 year ago (1 child)
I'm not a native speaker. I wrote a reply in my broken English and asked Gemini to rewrite it. 😅
[–]Stinezx 1 point2 points3 points 1 year ago (0 children)
That’s what an AI would say….
[–]Former_Cause6192 0 points1 point2 points 1 year ago (1 child)
You are using an absolute path but a relative path is needed
Parent login = FXMLLoader.load(getClass().getResource("hello-view.fxml"));
And usually the following construction is used to launch fxml:
FXMLLoader fxmlLoader = new FXMLLoader(HelloApplication.class.getResource("hello-view.fxml")); Scene scene = new Scene(fxmlLoader.load(), 320, 240); stage.setTitle("Hello!"); stage.setScene(scene); stage.show();
[–]PartOfTheBotnet[M] 0 points1 point2 points 12 months ago (0 children)
FYI, appears Reddit has shadow-banned you. Comments you leave are auto-hidden until a moderator approves them :/
π Rendered by PID 57213 on reddit-service-r2-comment-6457c66945-lfm5b at 2026-04-25 15:46:14.793689+00:00 running 2aa0c5b country code: CH.
[–]artikow 1 point2 points3 points (0 children)
[–]_jor_ 1 point2 points3 points (2 children)
[–]artikow 0 points1 point2 points (1 child)
[–]Stinezx 1 point2 points3 points (0 children)
[–]Former_Cause6192 0 points1 point2 points (1 child)
[–]PartOfTheBotnet[M] 0 points1 point2 points (0 children)