If you are new to java and compiling your newly created program, you must be getting an error occurred during initialization of boot layer. The error is very common among the users who have just started with java, eclipse, or Hadoop. Multiple things need to be considered while compiling programs. The error doesn’t have any specific cause that can be pinpointed, user mistake is one of the major causes behind this issue. But no need to be worried. In this troubleshooting guide, we will be going through most of the scenarios and methods in which a user faces error.
Causes of Error Occurred During Initialization Of Boot Layer Problem
Talking of the possible causes behind this error. The error is common among java and eclipse usage. Although multiple users have reported that the error appears because of the java version you are using. Users have found that the 12.x version is not suitable. Furthermore, the issue is also related to classes, paths, and various other things. Users have also reported that the error occurs because Netbeans is turned on.
- Java Version Issues
- Classes, Classpath issues
- Netbeans Turned On
Similar Types of Error Occurred During Initialization Of Boot Layer Issue
- Sdkmanager
- Intellij
- Java.lang.module.findexception eclipse
- Java.lang.module.findexception: unable to derive module descriptor
- Java.lang.module.findexception: module java.activation not found
- An error occurred during initialization of VM
- Com.beust.jcommander.1.72.0: invalid module name: ‘1’ is not a java identifier
- Java.lang.module.findexception: module java.transaction not found
- Module javafx.controls not found
- Java lang module findexception module JDK hotspot agent not found
Below we have tried to cover mostly all the ways to fix this error.
1. Use Java Version Below 12.x
As reported by multiple users and one of the major reasons behind error occurred during initialization of boot layer java.lang.module.findexception: Multiple users have recommended Java 10 or Java 8 instead of Java 12. Java 12 has compatibility issues and very much to such errors.
- STEP 1. To download Java 8, open up your browser and open this link
- STEP 2. Below click on the red Download button, the download will start in a few seconds
- STEP 3. Once downloaded, install it
2. Use Command to Run Java Program
Another error occurred during initialization of boot layer java issue that comes into existence is when the user doesn’t use a command prompt to execute java codes especially if you are working with eclipse. It becomes easier to track whether the issue is with the eclipse or your java code. So it is recommended using the command prompt. Below is a little example.
- STEP 1. Open up a command window and head to where you have saved your .java program
- STEP 2. Supposes it in C: and the name of the program is MyFirst
- STEP 3. Now execute the below command to compile the code
javac MyFirst.java
- STEP 4. If there are no errors that mean, there is no issue with your java code
- STEP 5. Now after executing the above the path variable is set now
- STEP 6. To run the program execute the command below
java MyFirst
- STEP 7. Once you execute the command you will see the result on your screen
3. Turn OFF the ‘Compile on Save’
Another way users have found to eliminate the error is by turning off the ‘Compile on Save’ option in Netbeans. Users have reported that if it is turned on the eclipse error occurred during initialization of boot layer java.lang.module.findexception: module error seems to appear.
- To turn it off, head to, Project Properties > Build > Compiling
4. Miscellaneous Fixes
There are some other fixes as well, that are suggested by users, kindly go through the error occurred during initialization of boot layer eclipse guide, and check if it is working for you.
- While executing selenium codes, try removing the selenium dependencies from the ModulePath to ClassPath under Build path in eclipse
-
Users have also fixed the issue by reordering the source folder. Put it above the JRE System Library. Under Properties > Java Build Path
- Another way users have eliminated the error is by deleting all other classes except the class in which you have written your code. It can be done by going to the PROJECT folder > src > Default package
Conclusion:
In the above troubleshooting guide, we have demonstrated all the ways by which Error Occurred During Initialization Of Boot Layer can be eliminated. We have tried to cover the maximum ways to fix the issue. If you have some other way to fix the issue tell us in the comments.
For more guides and tips follow us. Thank you!
Biniman Idugboe
Ranch Hand
Posts: 353
posted 2 years ago
-
Number of slices to send:
Optional ‘thank-you’ note:
The codes shown below were copied from Working with JavaFX UI Components, page 352.
The codes compile without error, but it does not run. I have spent the last few days, basically staring at the codes, unable to find anything wrong with it. Surely, Netbeans gurus will be able to pin point what is wrong with the program.
Your contributions will be highly appreciated.
The contents of the CSS file, named ControlStyle.css are as follows:
The project structure and VM options are shown in the image inserts
Untitled2.png
Untitled.png
Capture.PNG
Biniman Idugboe
Ranch Hand
Posts: 353
posted 2 years ago
-
Number of slices to send:
Optional ‘thank-you’ note:
Sincere apology for the way two of the three images were inserted.
Paul Clapham
Marshal
Posts: 27541
posted 2 years ago
-
Number of slices to send:
Optional ‘thank-you’ note:
The error message says «Module javafx.web not found».
Biniman Idugboe
Ranch Hand
Posts: 353
posted 2 years ago
-
Number of slices to send:
Optional ‘thank-you’ note:
The error message says «Module javafx.web not found».
Yes, but the javafx.web.jar is in the Libraries folder. Where else does Netbeans expect to find the module?
Campbell Ritchie
Marshal
Posts: 77297
posted 2 years ago
-
Number of slices to send:
Optional ‘thank-you’ note:
What CLASSPATH are you using? How did you specify it?
Biniman Idugboe
Ranch Hand
Posts: 353
posted 2 years ago
-
Number of slices to send:
Optional ‘thank-you’ note:
Classpath is shown below.
Classpath.PNG
Paul Clapham
Marshal
Posts: 27541
posted 2 years ago
-
Number of slices to send:
Optional ‘thank-you’ note:
When I moved on from Java 8, that module stuff was way too complicated for me to deal with, especially as I didn’t need to. But it looks to me like you do need to deal with it. Just as a guess: you have nothing in the Modulepath part of that dialog and the error message is talking about a module not found. Possible solution? That’s just a guess.
Biniman Idugboe
Ranch Hand
Posts: 353
posted 2 years ago
-
Number of slices to send:
Optional ‘thank-you’ note:
The option for Compile on Save:
Compiling.PNG
Biniman Idugboe
Ranch Hand
Posts: 353
posted 2 years ago
-
Number of slices to send:
Optional ‘thank-you’ note:
Once more, apology for attaching the Compile on Save screenshot for a different program. The different program has the same runtime error anyway.
Nevertheless, here is the screenshot that matches the current thread.
Compiling_Again.PNG
Biniman Idugboe
Ranch Hand
Posts: 353
posted 2 years ago
-
Number of slices to send:
Optional ‘thank-you’ note:
When I moved on from Java 8, that module stuff was way too complicated for me to deal with, especially as I didn’t need to.
So, what did you move to? Surely, you are still using Java. Surely also, the issue under discussion has been on since possibly before Java 8.
Is this problem from Java or is it from the IDE? If this problem has been around for sometime and there seems to be no obvious solution, is it
a hopeless situation?
…you have nothing in the Modulepath part of that dialog and the error message is talking about a module not found. Possible solution?
Turns out the libraries added to the classpath are also present on the modulepath.
Biniman Idugboe
Ranch Hand
Posts: 353
posted 2 years ago
-
Number of slices to send:
Optional ‘thank-you’ note:
So, I remember reading an article that suggested that in order to create JavaFX application using Netbeans IDE, one should first of all attempt to use Netbeans IDE to automatically setup the application. Even though the attempt will fail, Netbeans would have already activated some features of JavaFX. Then go ahead and create the Java application that extends the JavaFX Application class. For this reason, I decided to delete the problem program and recreated it. It now runs without any error. I cannot explain the situation more than this because I do not truly understand what happened behind the scene. Perhaps, the three screenshots below will prompt someone who knows what has happened to share the knowledge with less experience people like me.
Pretending-to-create-JavaFX-app.PNG
Failed-Automatic-setup.png
Create-the-Java-application.PNG
Norm Radder
Rancher
Posts: 4911
posted 2 years ago
-
Number of slices to send:
Optional ‘thank-you’ note:
Is this problem from Java or is it from the IDE?
I copied the source and css file. It compiled and executed with no problems with java 8. I do not use NB
Paul Clapham
Marshal
Posts: 27541
posted 2 years ago
-
Number of slices to send:
Optional ‘thank-you’ note:
Biniman Idugboe wrote:So, what did you move to? Surely, you are still using Java. Surely also, the issue under discussion has been on since possibly before Java 8.
I’m using Java 15 now. But I’m not using modules; the program I’m working on doesn’t need to do that. Which means that I don’t have any way to test modules and learn about them. So as for your issue, sorry, I can’t be of any help apart from bad guesses.
Stephan van Hulst
Saloon Keeper
Posts: 14712
posted 2 years ago
-
Number of slices to send:
Optional ‘thank-you’ note:
Stop using Ant. Ant is an obsolete build tool that causes more problems than it solves. Create all projects using Maven or Gradle. Show us your
pom.xml
and
module-info.java
files when you’ve created the JavaFX project.
Biniman Idugboe
Ranch Hand
Posts: 353
posted 2 years ago
-
Number of slices to send:
Optional ‘thank-you’ note:
Create all projects using Maven or Gradle.
With Maven, I cannot create JavaFX application if my computer is not connected to the internet. I personally find this very restricting.
I like a situation where I can work on a project with or without connection to interface. Is it the case that the version of Maven in my
computer cannot work without internet connection? Maven version 3.6.3.
Stephan van Hulst
Saloon Keeper
Posts: 14712
posted 2 years ago
-
Number of slices to send:
Optional ‘thank-you’ note:
You need connection to the internet once to get all the dependencies for your project. The same is true even if you were not using Maven. You had to download JavaFX, didn’t you?
After you’ve gotten the JavaFX dependencies, Maven will compile your application just fine even without internet.
Biniman Idugboe
Ranch Hand
Posts: 353
posted 2 years ago
-
Number of slices to send:
Optional ‘thank-you’ note:
But it downloads and unpacks maven repository every time. Is there no end to this?
Stephan van Hulst
Saloon Keeper
Posts: 14712
posted 2 years ago
-
Number of slices to send:
Optional ‘thank-you’ note:
You can configure how often Maven updates its index in NetBeans. What does it say under Tools -> Options -> Java -> Maven -> Index?
Biniman Idugboe
Ranch Hand
Posts: 353
posted 1 year ago
-
Number of slices to send:
Optional ‘thank-you’ note:
Hello Stephan,
Your recommendations have been really helpful to me. However, I cannot get around to use Maven to run the most basic JavaFX application.
I sincerely apologize for coming back more than five months after the last comment on this thread.
I would just like to humbly request that you show me screen shots of how you would typically set up a JavaFX project using Maven on Netbeans.
At the moment, I use Netbeans 12.0, JDK14 and JavaFX17-ea+6.
A note to say that anybody else can oblige me with his or her experience on this matter.
Thanks
Issue
I’m working on a JavaFX project, I started using Netbeans having no problems then switched to IntelliJ Idea where I’m having troubles.
At first, some imports like java.sql and javafx were not working, so I added a module-info.java file to the src folder where I put all the required imports, like this:
module blood {
requires javafx.fxml;
requires javafx.controls;
requires javafx.graphics;
requires java.sql;
requires java.desktop;
requires jdk.jfr;
opens sample;
}
The module has the same name as the project «blood».
Now i have no errors concerning the imports but when i run my project i’m getting this:
"C:Program FilesJavajdk-11.0.2binjava.exe" --module-path C:UsersUSERDownloadsjavafx-sdk-11.0.2lib --add-modules=javafx.controls,javafx.graphics,javafx.fxml --add-modules javafx.base,javafx.graphics --add-reads javafx.base=ALL-UNNAMED --add-reads javafx.graphics=ALL-UNNAMED -Djava.library.path=C:UsersUSERDownloadsjavafx-sdk-11.0.2 "-javaagent:C:Program FilesJetBrainsIntelliJ IDEA Community Edition 2019.3.4libidea_rt.jar=50526:C:Program FilesJetBrainsIntelliJ IDEA Community Edition 2019.3.4bin" -Dfile.encoding=UTF-8 -m blood/sample.Main
Error occurred during initialization of boot layer
java.lang.module.FindException: Module blood not found
Process finished with exit code 1
I also added to the VM options this line:
--module-path "C:UsersUSERDownloadsjavafx-sdk-11.0.2lib" --add-modules=javafx.controls,javafx.graphics,javafx.fxml
What should i do?
Solution
--module-path C:UsersUSERDownloadsjavafx-sdk-11.0.2lib
is not sufficient to load the module blood
that you’ve created for your application. On the other hand, the command-line argument
-m blood/sample.Main
expects blood
module with sample.Main
class to run the application. That is the reason the error reads
java.lang.module.FindException: Module blood not found
So the solution to it would be adding the output folder where the module blood
is getting build.
--module-path C:UsersUSERDownloadsjavafx-sdk-11.0.2lib;<project-output-diretory>
The openjfx-docs section «JavaFX and IntelliJ» further has a sub-topic «Modular from IDE» which talks about the «Add VM options» to be clear about this configuration.
Answered By — Naman
Answer Checked By — Mary Flores (JavaFixing Volunteer)