Error occurred during initialization of boot layer ошибка

Asked

Viewed
55k times

I followed the steps to create the HelloWorld example but it doesn’t run. It gives the following error:

Error occurred during initialization of boot layer
java.lang.module.FindException: Error reading module:
F:\Develop\eclipse\HelloWorld\bin Caused by:
java.lang.module.InvalidModuleDescriptorException: HelloWorld.class
found in top-level directory (unnamed package not allowed in module)»

enter image description here
Please advise how to solve this.

Naman's user avatar

Naman

27.9k26 gold badges219 silver badges353 bronze badges

asked Dec 26, 2018 at 13:30

B.Sarkar's user avatar

2

The error occurs because of you add your jar library files to MODULEPATH instead of CLASSPATH. You have to add jar files to your CLASSPATH. If you already add jar files to MODLEPATH you have to remove from there and add jar files to CLASSPATH, there is the steps:

1] Right click on your project name in ECLIPSE IDE

2] Click on PROPERTIES -> JAVA BUILD PATH -> click LIBRARY tab .The you get the window like this:

Java build path window

3] Expand MODULEPATH and select all jar files and remove it :look the picture below:

Modulepath jar file removing

4] After that click on CLASSPATH ->and click the button ‘ADDJAR’ and select the jar files ,your are done. Look the picture below for clarification;

Add jar to classpaht

5] After adding jars files in CLASSPATH it looks like this:

After adding jar file to classpath

Johannes Kuhn's user avatar

answered Dec 11, 2019 at 5:35

Shinoy p b's user avatar

Shinoy p bShinoy p b

3533 silver badges13 bronze badges

I had the same error before because I use the default package.

And I solved the problem in this way:
Right-click the project — Properties — Java Build Path — move the class from Modulepath to Classpath

And it worked!

answered Sep 21, 2019 at 18:11

Yueyi's user avatar

YueyiYueyi

312 bronze badges

Just Delete module-info.java from project and its solves the issue.

answered Jun 12, 2022 at 12:27

Tushar Rao's user avatar

1

I had similar issue, the problem i faced was i added the selenium-server-standalone-3.141.59.jar under modulepath instead it should be under classpath

so select classpath via (project -> Properties -> Java Bbuild Path -> Libraries)
add the downloaded latest jar

After adding it must be something like this

enter image description here

And an appropriate driver for browser has to be downloaded for me i checked and downloaded the same version of chrome for chrome driver and added in the C:\Program Files\Java

And following is the code that worked fine for me

    public class TestuiAautomation {

        public static void main(String[] args) {

            System.out.println("Jai Ganesha");
            try {
                System.setProperty("webdriver.chrome.driver", "C:\\Program Files\\Java\\chromedriver.exe");
                System.out.println(System.getProperty("webdriver.chrome.driver"));
                ChromeOptions chromeOptions = new ChromeOptions();
                chromeOptions.addArguments("no-sandbox");
                chromeOptions.addArguments("--test-type");
                chromeOptions.addArguments("disable-extensions");
                chromeOptions.addArguments("--start-maximized");
                WebDriver driver = new ChromeDriver(chromeOptions);
                driver.get("https://www.google.com");
                System.out.println("Google is selected");
            } catch (Exception e) {
                System.err.println(e);
            }

        }

    }

For reference

answered Dec 30, 2020 at 2:29

Parameshwar's user avatar

ParameshwarParameshwar

8568 silver badges16 bronze badges

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.

Already on GitHub?
Sign in
to your account

Comments

@leelakarthik

Hello,
I am new to JavaFx and I am using it in Intellij IDEA along with JDK 11 and JavaFx 13 .
Iam getting the following error
Error occurred during initialization of boot layer
java.lang.module.FindException: Module javafx.base not found

VM Options: —module-path ${PATH_TO_FX} —addmodules=javafx.controls,javafx.fxml,javafx.base

Default auto-generated code from intellij IDEA
Main.java
package sample;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;

public class Main extends Application {

@Override
public void start(Stage primaryStage) throws Exception{
    Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
    primaryStage.setTitle("Hello World");
    primaryStage.setScene(new Scene(root, 300, 275));
    primaryStage.show();
}


public static void main(String[] args) {
    launch(args);
}

}

Controller.java

package sample;

public class Controller {
}

@leelakarthik

@ArekuSanka

Hello,
I’m having the same problem. Tried everything with jdk 11, 12 and the javafx versions; Even tho i’m setting the Run Configurations and library and everything, it just doesn’t seem to be able to run an application properly.
Also it’s not some setting problem on intellij, i also properly installed eclipse and didn’t work there either.

If you find any solution for the problem i would be glad to hear it.

@jperedadnr

@jperedadnr

I’m closing this issue due to lack of details or a way to reproduce it. Feel free to open it again with the required information.

abdulazizalfahaid, pbc-barho, MarccusB, LivingIron, paletteOvO, davidadamsucd, chyjuls, aharoJ, Matheussaaa, CygnusXLR, and 31 more reacted with thumbs down emoji

@MerzoukMohamed

i guess you added the javafx.base in the VM options when it wasn’t existing in the file where your javafx version is installed .

77

go check if it’s installed or not , if it isn’t download it and the drag drop it in there

vinodhalaharvi and dairongranada reacted with thumbs up emoji
SimonCoene, AlexGosse, loganylwu, icedragonsoul, heartoftrailers, rajitgupta1803, VentGrey, skeletonfire, TanmayKumar-EngStud, yesIamFaded, and 12 more reacted with thumbs down emoji
pywind, Sanskrita2001, VentGrey, Anatolij54, and Matheussaaa reacted with confused emoji

@jesusCDev

Did anyone ever figure this out? Still lost. Same issues after following constant tutorials.

@imrsk

Yes. I’m getting the same error.

@jperedadnr

This is a closed issue, but it can be opened again, if anyone provides more details on how to reproduce it.
@jesusCDev. @imrsk please provide exact details of how you are trying: IDE, OS, Java/JavaFX versions, type of sample (modular/non-modular, IDE, maven or gradle), how do you set the VM options, the Java Command line, and the exception you get,

VertOurs reacted with thumbs up emoji
skyflocodes, JohnGeurts, KennyBlake88, AlexGosse, milanvhb, EvgeniGenchev, aymanred121, luismoa, rshikina, j4c0b3k, and 15 more reacted with thumbs down emoji

@imrsk

oops. It’s a really silly mistake. My apologies, @jperedadnr . And @jesusCDev , if you are using linux, remove the $ before the path and keep your VM options like

—module-path /home/local/Downloads/openjfx-11.0.2_linux-x64_bin-sdk/javafx-sdk-11.0.2/lib —add-modules=javafx.controls,javafx.fxml

I followed leelakarthik’s comment above and added $ by mistake.

Kweku-Abeiku, wsxq2, chinhnd183871, ealvaro, CasasolaYeslyn, ChaoukiBayoudhi, milanvhb, samhamnam, luismoa, AlexVonEinzbern, and 7 more reacted with thumbs up emoji
rshikina, maximilianfink, kevin-rojas, Ibselibsen, and XawsLegior reacted with thumbs down emoji

@jesusCDev

@imrsk Thank you! This worked perfectly!

@imrsk

@profjpbaugh

I’m still having this same issue (mine complains about javafx.controls), but the issue is the same. I followed: https://openjfx.io/openjfx-docs/#install-javafx for NetBeans with the non-module instructions.

I’m on Windows 10, NetBeans 11.1 and using JDK and JavaFX 13.

When it finally gets to the —module-path and —add-modules arguments instructions, I follow those and get the error:

Error occurred during initialization of boot layer
java.lang.module.FindException: Module javafx.controls not found
C:\Users\jpbau\AppData\Local\NetBeans\Cache\11.1\executor-snippets\run.xml:111: The following error occurred while executing this line:
C:\Users\jpbau\AppData\Local\NetBeans\Cache\11.1\executor-snippets\run.xml:68: Java returned: 1

Any updates on this?

@OrGalili

profjpbaugh, in the VM options in this line :
—module-path «\path\to\javafx-sdk-12\lib» —add-modules javafx.controls,javafx.fxml
did you changed the path «\path\to\javafx-sdk-12\lib» to your local path where javafx sdk exist?

@Smurfi

Hello,

please note under NetBeans, it is extremely important to turn off the ‘Compile on Save’ options under the Project Properties -> Build -> Compiling.

If it is switched on an error message appears:
Error occurred during initialization of boot layer
java.lang.module.FindException: Module javafx.controls not found

jasonbakker084, brandonjblank, chamindu94, cnt5bs, cadu-sg, albatar-dev, ubaldc, CRCoughlin, manueldeprada, markbatho, and 31 more reacted with thumbs up emoji
profPlum, finfan222, Edmartt, and Matheussaaa reacted with laugh emoji
CRCoughlin and finfan222 reacted with hooray emoji
profPlum, FirasLu, nguyenq, finfan222, IsaacCisneros, Matheussaaa, and teegaiyu reacted with confused emoji
CRCoughlin, manueldeprada, JAreyes98, Meldak, dsantistevan, finfan222, lzkovacs, IsaacCisneros, denicolas, Edmartt, and 2 more reacted with heart emoji
profPlum, finfan222, and lzkovacs reacted with rocket emoji
profPlum, d000b, finfan222, raid-teyar, and Matheussaaa reacted with eyes emoji

@Lodisy12

Hi @Smurfi,

This fixed my problem that I’ve been working on for several days! I’m not sure why this little piece isn’t in any of the tutorials I looked at on how to set up javaFX for netbeans, but it absolutely wouldn’t run without it. Thanks so much!

@brandonjblank

Wow!

Hello @Smurfi

Thank you so much for the tip. I have been having the same issue as others here and I have been looking around for a solution for the past day. Unchecking that option completely fixed it and I can now run my JavaFX code in Netbeans.

I really appreciate it. This entire time I thought I was missing something in the tutorials I checked out.

@trondag

@Lodisy12

@trondag

Are you using netbeans or something else? You right click the project and go to properties, then to build in netbeans.

@AimanMunir24

Just make sure that your path in module path is correct.. Copy path from libraries in project structure.For me it worked

@DaveAvid

@Lodisy12
Is there a similar setting in Intellij that could be causing me issues like this? I am at a loss and don’t know what do do about this problem.

@Lodisy12

Hi @DaveAvid,
I don’t use IntelliJ personally, so I haven’t done any troubleshooting for myself. Have you followed the step by step tutorial from https://openjfx.io/openjfx-docs/#IDE-Intellij ?
That would be my first suggestion if you haven’t. If you have, my other suggestion would be to give NetBeans a chance. I know a lot of people who hate it, and a lot of people who love it, but I think it’s pretty good.

@ComputerProgrammer360

Hi @Smurfi,
I turned off the compile on save option like you said, but i’m still getting the same error occured … module javafx.controls not found message. Do you know why this could be? I followed the tutorial for a non modular project: https://openjfx.io/openjfx-docs/#maven

@KristijonasL

What helped me: set VM Options and Project Properties > Compile > Modulepath > + > just added all jar files from the javafx-sdk/lib folder. And you could leave Compile and Save checked

@thomasthrelkeld

@DaveAvid did you ever figure out the intellij equivalent? I have been trying to fix this for days and can’t figure it out

@thomasthrelkeld

I figured out my issue and its working now! I am using Windows but my fix was similar to the Linux solution. In my case i was trying to use —module-path %PATH_TO_FX% and for some reason the % was not escaping. For the very short term i have replaced it with a hard coded path to the javafx/lib so i can finish another sprint issue that involves another team member and is more of an immediate priority. That being said, hard coded paths are obviously never the production solution so i will keep you updated with a permanent fix when i get around to it on Monday.

@Kweku-Abeiku

oops. It’s a really silly mistake. My apologies, @jperedadnr . And @jesusCDev , if you are using linux, remove the $ before the path and keep your VM options like

—module-path /home/local/Downloads/openjfx-11.0.2_linux-x64_bin-sdk/javafx-sdk-11.0.2/lib —add-modules=javafx.controls,javafx.fxml

I followed leelakarthik’s comment above and added $ by mistake.

this works Thanks

@Shehab-Ahmed-Bassuone

Hi
please make sure when you set vm options that you change module path to your JDK lib path and delete the extra 2 » if you copying from windows 10.

@Shkirmantsev

  • Note (Linux UBUNTU): Make sure you don’t add the src.zip file, as it will cause an exception when running the project. (By Adding Library)

@mafer85954

Captura de Pantalla 2020-11-14 a la(s) 19 49 59

@denicolas

Hi @Smurfi,

This fixed my problem that I’ve been working on for several days! I’m not sure why this little piece isn’t in any of the tutorials I looked at on how to set up javaFX for netbeans, but it absolutely wouldn’t run without it. Thanks so much!

«Compile on Save (requires nb-javac plugin)»
I installed the nb-javac plugin after getting a notification in the status bar of NetBeans, saying:
«Install nb-javac Library»
So I guess after installation of that plugin, the «Compile on Save» option was activated, and then I got this error message when trying to run the project:
«Error occurred during initialization of boot layer
java.lang.module.FindException: Module javafx.controls not found»

Thank you so much, Smurfi!

@NathanPaceydev

** If you are having this error on Eclipse**
«Error occurred during initialization of boot layer
java.lang.module.FindException: Module javafx.controls not found»

Remove the JavaFX SDK library from the build path of the project!!

agam23, joeparadiso, minislurpee, ScottyPG, viniciusfrois, urmikab, nassimiheb, patelsagar1712, tt-tung2612002, oliviaharrington, and 10 more reacted with thumbs up emoji
adnane1996645 and entisy reacted with laugh emoji
oliviaharrington, adnane1996645, entisy, and denizvan reacted with hooray emoji
minislurpee, viniciusfrois, urmikab, patelsagar1712, YY-Jan, oliviaharrington, AlexandraTodd, adnane1996645, entisy, mbeier1406, and 5 more reacted with heart emoji
oliviaharrington, adnane1996645, entisy, and Freedoom91 reacted with rocket emoji
oliviaharrington, adnane1996645, and entisy reacted with eyes emoji

@kartikraman

@NathanPaceydev I am still facing the issue. Do I need to turn on the «Compile on Save» in Eclipse as well? If yes, where can I find it?

@prashantkatiyar9777

profjpbaugh, in the VM options in this line :
—module-path «\path\to\javafx-sdk-12\lib» —add-modules javafx.controls,javafx.fxml
did you changed the path «\path\to\javafx-sdk-12\lib» to your local path where javafx sdk exist?

@MDNich

Guys I figured it out! Delete the src.zip file when u get the error:

(NOTE: I am a total noob in markdown. I tried :( )

java.lang.module.FindException: Module format not recognized: C:\(PATH_TO_FX)\lib\src.zip

Process finished with exit code 1````

**Then it works!!** 


@NathanPaceydev

@NathanPaceydev I am still facing the issue. Do I need to turn on the «Compile on Save» in Eclipse as well? If yes, where can I find it?

You do not need to turn on Compile and Save. Make sure you have the correct VM arguments and you have downloaded the correct SDK library to run JavaFx. Hope that helps.

@arceeseven

In eclipse go to build path in the project folder > configure build path > click modulepath > add external JARS > select all jar files in javafx lib folder
image

@NyxP149

In eclipse go to build path in the project folder > configure build path > click modulepath > add external JARS > select all jar files in javafx lib folder
image

Until now !!! this method work perfectly !!! X) X) X) X) X)

@SaunakNandi

Error occurred during initialization of boot layer
java.lang.module.FindException: Error reading module: F:\CHEET_SHEET\out\production\CHEET_SHEET
Caused by: java.lang.module.InvalidModuleDescriptorException: Comparison.class found in top-level directory (unnamed package not allowed in module)
CAN ANYONE TELL ME WHAT TO DO?

@ebedeveloper

** If you are having this error on Eclipse** «Error occurred during initialization of boot layer java.lang.module.FindException: Module javafx.controls not found»

Remove the JavaFX SDK library from the build path of the project!!

Thank you this solved my issse

@mbeier1406

** If you are having this error on Eclipse** «Error occurred during initialization of boot layer java.lang.module.FindException: Module javafx.controls not found»

Remove the JavaFX SDK library from the build path of the project!!

Thanks a lot, that hit the spot. I was almost going crazy. Works on Eclipse 2021-03, Open JDK 16 on Ubuntu 21.10! great stuff!

@NathanPaceydev

Glad I could help, this problem was driving me crazy too!!

@Bdavidson024

I am using eclipse IDE

Error: Could not find or load main class javafx.fxml
Caused by: java.lang.ClassNotFoundException: javafx.fxml

I was getting the javafx.controls issue like everyone else but I have done all the above and am now getting this error message

@raymondlondonollanos

I am using eclipse IDE

Error: Could not find or load main class javafx.fxml Caused by: java.lang.ClassNotFoundException: javafx.fxml

I was getting the javafx.controls issue like everyone else but I have done all the above and am now getting this error message

I have same problem with my Eclipse. I dont know to do with this. Please Help me!!!!

@Bdavidson024

you need to put copy the javafx files from your computer to eclipse and
make a user library then add this library to the build path of your project

On Thu, May 12, 2022 at 8:20 AM raymondlondonollanos < ***@***.***> wrote:
I am using eclipse IDE

Error: Could not find or load main class javafx.fxml Caused by:
java.lang.ClassNotFoundException: javafx.fxml

I was getting the javafx.controls issue like everyone else but I have done
all the above and am now getting this error message

I have same problem with my Eclipse. I dont know to do with this. Please
Help me!!!!


Reply to this email directly, view it on GitHub
<#91 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AWPQQNUDMDSMBVMORCEYVCLVJTZRJANCNFSM4HBPR3YA>
.
You are receiving this because you commented.Message ID:
***@***.***>

@PhieFty

In eclipse go to build path in the project folder > configure build path > click modulepath > add external JARS > select all jar files in javafx lib folder
image

Until now !!! this method work perfectly !!! X) X) X) X) X)

omg thank you so much
mine finally work!!
ECLIPSE vesion 2022-03 (4.23.0) JavaFX18 Windows 10

@YuriFss

anybody could make it work on intellij? i keep getting this error message: «Error: Could not find or load main class javafx.fxml
Caused by: java.lang.ClassNotFoundException: javafx.fxml», even tho i included javafx.controls and javafa.fxml on VM options.

@YuriFss

you need to put copy the javafx files from your computer to eclipse and make a user library then add this library to the build path of your project

On Thu, May 12, 2022 at 8:20 AM raymondlondonollanos < @.> wrote: I am using eclipse IDE Error: Could not find or load main class javafx.fxml Caused by: java.lang.ClassNotFoundException: javafx.fxml I was getting the javafx.controls issue like everyone else but I have done all the above and am now getting this error message I have same problem with my Eclipse. I dont know to do with this. Please Help me!!!! — Reply to this email directly, view it on GitHub <#91 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWPQQNUDMDSMBVMORCEYVCLVJTZRJANCNFSM4HBPR3YA . You are receiving this because you commented.Message ID: @.>

could you elaborate more? im having trouble doing the same process on intellij

@Weiberwei

I find that version 1.8 could be able to run on eclipse and each of the java projects might have a deviation between the java project category.Screenshot 2022-10-08 104937

@seapea2611

if you use IntelliJ , you must delete module-info.java in src/main/java, i did and it works,
this file is automatically generated when you create javafx project

@orctupus

Okay so I narrowed it down and got it to run.

Verified on: Intellij IDEA on M1 Macbook pro

Hypothesis:

The javafx helloworld tutorial incorrectly gives us the following VM options for «Linux/Mac» found here : https://openjfx.io/openjfx-docs/#maven. This is missing the equals «=» operator.

image

  • Incorrect Copy/Paste Line «—module-path /path/to/javafx-sdk-19/lib —add-modules javafx.controls,javafx.fxml»

Fix:

  1. Run > Edit Configurations > Select «Application» configuration > Under Build and Run > Select «modify options» > Under «java» Select «add VM Options

  2. VM Options, you will need to customize this to your local machine :

—module-path=/Users/USERNAMEHERE/FOLDERWITHSDK/java-sdk-19/lib —add-modules=javafx.controls,javafx.fxml

  1. This is the correct format for MAC formatting to the VM Options.

Resolve Run Option

@lkSnatch

One more possible solution. If you use Gluon Gradle plugin and java module system and seems that everything is right, look at your automatically created build.gradle file:

application {
  //mainModule = 'net.snatchlab.photoframe'
  mainClass = 'net.snatchlab.photoframe.PhotoFrameApplication'
}
mainClassName = 'net.snatchlab.photoframe.PhotoFrameApplication'

It’s important to remove/comment specifying ‘mainModule‘ in the ‘application‘ section. Maybe the whole ‘application‘ section is not needed, didn’t try to remove it yet.

My problem was about javafx.controls, not javafx.base. This module was declared in the build.gradle:

javafx {
  version = '17'
  modules = ['javafx.controls', 'javafx.fxml']
}

and in the module-info.java:
requires javafx.controls;

Commenting ‘mainModule‘ solved the issue without specifying VM options.

@GEMMEE

** If you are having this error on Eclipse** «Error occurred during initialization of boot layer java.lang.module.FindException: Module javafx.controls not found»

Remove the JavaFX SDK library from the build path of the project!!

How can I remove JavaFX SDK library from the build path of the project? I am having the same error on Eclipse.

@GEMMEE

In eclipse go to build path in the project folder > configure build path > click modulepath > add external JARS > select all jar files in javafx lib folder
image

Until now !!! this method work perfectly !!! X) X) X) X) X)

thanks, this worked for me!

@GEMMEE

In eclipse go to build path in the project folder > configure build path > click modulepath > add external JARS > select all jar files in javafx lib folder
image

Until now !!! this method work perfectly !!! X) X) X) X) X)

omg thank you so much mine finally work!! ECLIPSE vesion 2022-03 (4.23.0) JavaFX18 Windows 10

Alternatively, you can select JavaFX SDK under Modulepath and click on Remove icon on the right side and it will work without adding those external JARS. I have tried it and this also worked for me.

@thomasBoutb22007761

@bquirosh

Hello,

Im having the same issue as some of you in MAC, I get this error: Error occurred during initialization of boot layer
java.lang.module.FindException: Module javafx.base not found

Im trying to set it up in intellij, I have used. the recommended path:
—module-path=/Users/USERNAMEHERE/FOLDERWITHSDK/java-sdk-19/lib —add-modules=javafx.controls,javafx.fxml
This is what im using:
—module-path=/Users/NAME/Desktop/javafx-sdk-20.0.2/lib/
—add modules=javafx.controls,javafx.fxml,javafx.graphics,javafx.base

Also, added the library as instrusted. I tried using the version of javafx SDK x64 and arch64 from Gluon and it doesn’t work.
Not sure what else I could do. I would appreciate any help.

Regards.

@Dhruvdangi03

Okay so I narrowed it down and got it to run.

Verified on: Intellij IDEA on M1 Macbook pro

Hypothesis:

The javafx helloworld tutorial incorrectly gives us the following VM options for «Linux/Mac» found here : https://openjfx.io/openjfx-docs/#maven. This is missing the equals «=» operator.

image

  • Incorrect Copy/Paste Line «—module-path /path/to/javafx-sdk-19/lib —add-modules javafx.controls,javafx.fxml»

Fix:

  1. Run > Edit Configurations > Select «Application» configuration > Under Build and Run > Select «modify options» > Under «java» Select «add VM Options
  2. VM Options, you will need to customize this to your local machine :

—module-path=/Users/USERNAMEHERE/FOLDERWITHSDK/java-sdk-19/lib —add-modules=javafx.controls,javafx.fxml

  1. This is the correct format for MAC formatting to the VM Options.

Resolve Run Option

@orctupus this was the most usefull comment thank you

The Error occurred during initialization of boot layer FindException: Module not found is a common issue encountered by Java developers when working with the Java Platform Module System (JPMS). This error occurs when the Java Virtual Machine (JVM) is unable to locate the required module in the classpath. This error can occur due to various reasons such as missing module declaration, missing module dependency, or incorrect module version. In this article, we will discuss various methods to fix this error.

Method 1: Verify Module Declaration

To fix the error «Error occurred during initialization of boot layer FindException: Module not found» in Java using «Verify Module Declaration», follow the below steps:

  1. Open the terminal and navigate to the directory containing the module-info.java file.

  2. Run the following command to verify the module declaration:

java --module-source-path <module_source_path> --module <module_name> --dry-run

Replace <module_source_path> with the path to the directory containing the module-info.java file and <module_name> with the name of the module.

For example:

java --module-source-path src/main/java --module com.example.myapp --dry-run
  1. If the output of the above command shows any errors, fix them in the module-info.java file.

  2. Run the following command again to verify the module declaration:

java --module-source-path <module_source_path> --module <module_name> --dry-run
  1. If the above command runs without any errors, run the application using the following command:
java --module-source-path <module_source_path> --module <module_name>/<main_class>

Replace <main_class> with the name of the main class of the application.

For example:

java --module-source-path src/main/java --module com.example.myapp/com.example.myapp.Main

By following the above steps, you should be able to fix the «Error occurred during initialization of boot layer FindException: Module not found» error in Java using «Verify Module Declaration».

Method 2: Check Module Dependency

To fix the «Error occurred during initialization of boot layer FindException: Module not found» issue in Java using the «Check Module Dependency» method, follow these steps:

  1. Open your project in your preferred IDE.
  2. Right-click on the project and select «Module Settings».
  3. In the «Modules» section, select the module that is causing the issue.
  4. Click on the «Dependencies» tab.
  5. Click on the «+» button to add a new dependency.
  6. Select the module that is missing from the «Module» dropdown list.
  7. Click «OK» to add the dependency.

Here’s an example code snippet to illustrate the above steps:

module com.example.myproject {
    requires javafx.controls;
    requires org.junit.jupiter.api;
    requires org.mockito;
}

In the above example, the «com.example.myproject» module requires the «javafx.controls», «org.junit.jupiter.api», and «org.mockito» modules.

Note that the «requires» keyword is used to specify module dependencies.

If you have any further issues or questions, feel free to consult the Java documentation or seek help from the Java community.

Method 3: Correct Module Version

If you are encountering the «Error occurred during initialization of boot layer FindException: Module not found» error in Java, it is likely due to a missing or incorrect module version. Here is how to fix it with the correct module version:

  1. Check your module path:
  1. Download the correct module version from the official website.

  2. Add the correct module version to your module path:

export MODULEPATH=$MODULEPATH:/path/to/module
  1. Check if the module is loaded:
  1. If the module is not loaded, load it:
module load module_name/version
  1. Verify that the module is loaded:
  1. Run your Java application.

Here is an example of how to add the correct module version to your module path:

export MODULEPATH=$MODULEPATH:/usr/local/modules/java/jdk-14.0.2/

And here is an example of how to load the module:

module load java/jdk-14.0.2

Make sure to replace «module_name/version» with the actual name and version of the module you need to load.

That’s it! With these steps, you should be able to fix the «Error occurred during initialization of boot layer FindException: Module not found» error in Java with the correct module version.

Method 4: Set Classpath Properly

To fix the «Error occurred during initialization of boot layer FindException: Module not found» error in Java, you can try setting the classpath properly. Here are the steps to do this:

  1. Identify the module that is not found. For example, let’s say you are trying to run a Java program that depends on the «myModule» module.

  2. Create a directory to store the module. For example, create a directory called «myModule» in your project directory.

  3. Copy the module’s .jar file to the directory you just created. For example, copy the «myModule.jar» file to the «myModule» directory.

  4. Set the classpath to include the directory where the module is located. For example, if you are using the command line to run your Java program, you can set the classpath using the following command:

java -cp myModule myPackage.MyClass

This sets the classpath to include the «myModule» directory and runs the «myPackage.MyClass» class.

Here’s another example of setting the classpath in a Java program:

import java.net.URL;
import java.net.URLClassLoader;

public class MyClass {
  public static void main(String[] args) throws Exception {
    // Create a new class loader
    URL[] urls = { new URL("file:/path/to/myModule/") };
    URLClassLoader loader = new URLClassLoader(urls);

    // Load the module's class
    Class<?> moduleClass = loader.loadClass("myPackage.MyClass");

    // Create an instance of the module's class
    Object moduleInstance = moduleClass.newInstance();

    // Call a method on the module's class
    moduleClass.getMethod("myMethod").invoke(moduleInstance);
  }
}

This code creates a new class loader that includes the «myModule» directory, loads the «myPackage.MyClass» class from the module, creates an instance of the class, and calls a method on the instance.

By setting the classpath properly, you should be able to fix the «Error occurred during initialization of boot layer FindException: Module not found» error in Java.

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 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 Error Occurred During Initialization Of Boot Layer guide, we will be going through most of the scenarios and methods in which a user faces an error.

Error Occurred During Initialization Of Boot Layer Error

Causes of Error Occurred During Initialization Of Boot Layer Problem

Talking the possible causes behind this Error Occurred During Initialization Of Boot Layer error. The error is common among Java and Eclipse users. 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 Error Occurred During Initialization Of Boot Layer 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 the 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 Occurred During Initialization Of Boot Layer error.

1. Use Java Version Below 12. x

As reported by multiple users and one of the major reasons behind the 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 is very much to such errors.

  • STEP 1. To download Java 8, open up your browser and open this link

java download

  • 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 Eclipse or your Java code. So it is recommended to use 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

error occurred during initialization of boot layer

  • 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

cmd

  • 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 Occurred During Initialization Of Boot Layer 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 the 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 Error Occurred During Initialization Of Boot Layer issue tell us in the comments.

For more guides and tips as this Error Occurred During Initialization Of Boot Layer follow us. If you enjoy checking or reading the Error Occurred During Initialization Of Boot Layer then please do share Error Occurred During Initialization Of Boot Layer with others as well also. Thank you!

The error occurred during initialization of boot layer when writing the properties and inputs in the default and your class. As a result, the attribute ‘sourcefileloader’ fails and blocks further functions, such as the Python-dotenv command, that are vital when creating complex applications and programs.error occurred during initialization of boot layer

Luckily, we compiled this extensive debugging guide to help you remove the modulenotfounderror: no module named ‘dotenv’ using standard scripts and syntaxes. In addition, we will help you recreate the attributeerror: module ‘importlib._bootstrap_external’ has no attribute ‘_w_long’ exception, which is vital when troubleshooting your program.

Contents

  • Why the Error Occurred During Initialization of Boot Layer?
    • – Changing the Structure of the Files
  • How To Fix the Error Occurred During Initialization of Boot Layer?
    • – Editing the Paths and Package Names
    • – Selecting the Class Path and Adding the Latest Jar
  • Conclusion

The attributeerror: module ‘socketio’ has no attribute ‘client’, occured because your and default classes include identical properties. As a result, your program has no module named ensurepip, ruining your programming experience and halting further procedures, although most elements and values are fully functional.

Although other instances force your system to display the modulenotfounderror: no module named ‘socketio’ error exist, this is the most common one. For example, this error is almost inevitable when accepting to create of a default class by the IDE.

Namely, besides creating a personal class and writing the properties in the leading directory, the IDE class includes the same values, launching the attributeerror: module ‘socketio’ has no attribute ‘asyncserver’ bug. Unfortunately, the error does not spare any documents, no matter how straightforward and short the syntax is.

As a result, we will teach you how to recreate and troubleshoot the script before applying the debugging approaches. This should help you pinpoint the exact broken values and isolate the code snippet, preventing the attributeerror: module ‘pkg_resources’ has no attribute declare_namespace from affecting other inputs.

Luckily, the solutions work for all files irrelevant to the elements and tags used so that you can copy and paste the syntaxes. However, changing several values and properties is essential when adjusting the debugging approach to fit your needs and requirements.

– Changing the Structure of the Files

This article’s only chapter recreating the error attempts to change the files’ structure, which is critical when changing your code’s purpose. Unfortunately, although the procedure only takes a few minutes, it causes unexpected obstacles, including the boot layer code exception.Changing the Structure of the Files

Considering that, we will show you the entire Java package and the imported inputs, which should help you understand the script’s purpose. In addition, the document includes a single public class with several stages.

You can learn more about the syntax in the following example:

package java;

import javafx.application. Application;

import javafx.fxml.FXML Loader;

import javafx.scene. Parent;

import javafx.scene. Scene;

import javafx. stage.Stage;

import javafx. stage. StageStyle;

public class Main extends Application {

@Override

public void start (Stage primaryStage) throws Exception {

Parent root = FXML Loader.load(getClass() .getResource (name: “login.fxml”));

primaryStage.initStyle (Stage Style. UNDECORATED);

primaryStage.setScene (new Scene (root, width: 1280, height: 720));

primaryStage.show();

}

public static void main (String[] args) {

Launch (args);

}

}

Unfortunately, although most elements and properties appear functional and full-proof, the system throws an exception blocking further procedures. The incorrect message confirms inconsistencies with the classes, as confirmed in the following script:

“C:\Program Files\Java\jdk-15\bin\java.exe” …

Error occurred during initialization of boot layer

java.lang. LayerInstantiationException: Class loader (instance of): ‘app’ tried to define prohibited package name: java

process finished with exit code 1

As you can tell, the code specifies the exact failed path and folder because the class properties appear in the default and custom elements. But again, it would help if you remained calm, although the visual output in your script differs because the solutions will not disappoint you.

How To Fix the Error Occurred During Initialization of Boot Layer?

You can quickly fix this annoying exception by creating a standard main class and linking the FX inputs. Later, you must pick the new main directory in the XML setup, which should remove all obstacles and reenable the procedures. Luckily, the approach does not affect other commands.

As a result, we will show you the complete document consisting of several scripts. You can learn more about the public classes and imported properties in the following syntax:

public class Main {

public static void main(String[] args) {

HelloFX.main(args);

}

}

src/HelloFX.java

import javafx.application.Application;

import javafx.scene.Scene;

import javafx.scene.control.Label;

import javafx.stage.Stage;

//import javafx.graphics;

public class HelloFX extends Application {

@Override

public void start(Stage stage) {

String javaVersion = System.getProperty(“java.version”);

String javafxVersion = System.getProperty(“javafx.version”);

Label l = new Label(“Hello, JavaFX ” + javafxVersion + “, running on Java ” + javaVersion + “.”);

Scene scene = new Scene(l, 640, 480);

stage.setScene(scene);

stage.show();

}

public static void main(String[] args) {

launch(args);

}

In addition, we will show you the XML syntax, which is vital when understanding the purpose. The following example should help you complete the debugging approach:

<project xmlns = “http://maven.apache.org/POM/4.0.0” xmlns:xsi = “http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation = “http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd”>

<modelVersion> 4.0.0 </modelVersion>

<groupId> HelloFX </groupId>

<artifactId> HelloFX </artifactId>

<version> 0.0.1-SNAPSHOT </version>

<build>

<sourceDirectory> src </sourceDirectory>

<plugins>

<plugin>

<artifactId> maven-compiler-plugin </artifactId>

<version> 3.8.0 </version>

<configuration>

<release> 10 </release>

</configuration>

</plugin>

<plugin>

<groupId> org.apache.maven.plugins </groupId>

<artifactId> maven-jar-plugin </artifactId>

<version> 3.1.0 </version>

<configuration>

<archive>

<manifest>

<addClasspath> true </addClasspath>

<mainClass> Main </mainClass>

</manifest>

</archive>

</configuration>

</plugin>

Although we could include other plugins, we kept the file as simple as possible. Fortunately, it is one of the many solutions you can use.

– Editing the Paths and Package Names

This article’s second debugging approach edits the paths and package names to flat out the obstacles. As a result, the classes will recognize and render the elements, reenabling all procedures and repairing your project.Error Occurred During Initialization of Boot Layer Fixes

The script is similar to the former chapter because it imports several units but has different public classes and voids.

You can learn more about the possible debugging method in the following example:

package navi;

import org.junit.After;

import org.junit.AfterClass;

import org.junit.Before;

import org.junit.BeforeClass;

import org.junit.Test;

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.chrome.ChromeDriver;

import org.openqa.selenium.chrome.ChromeOptions;

import org.openqa.selenium.support.ui.ExpectedConditions;

import org.openqa.selenium.support.ui.WebDriverWait;

public class Avi {

public static WebDriver driver;

WebDriverWait wait5s = new WebDriverWait(driver,5);

@BeforeClass

public static void setUpClass() {

System.setProperty (“webdriver.chrome.driver”, “C:\\ Users\\ pburgr\\ Desktop\\ chromedriver\\ chromedriver.exe”);

ChromeOptions options = new ChromeOptions();

options.addArguments (“user-data-dir=C:\\ Users\\ pburgr\\ AppData\\ Local\\ Google\\ Chrome\\ User Data”);

driver = new ChromeDriver (options);

driver.manage() .window () .maximize() ;}

@Before

public void setUp() {}

@After

public void tearDown() {}

@AfterClass

public static void tearDownClass() {driver.close(); driver.quit();}

@Test

public void avi() throws InterruptedException {

driver.get (“http://www.gcrit.com/build3/admin/”);

wait5s.until (ExpectedConditions.elementToBeClickable (By.name (“username”))) .sendKeys (“admin”);

driver.findElement (By.name (“password”)) .sendKeys (“admin@123”);

driver.findElement (By.id (“tdb1”)) .click();

// wait to resolve the click before checking url

Thread.sleep (1000);

String url = driver.getCurrentUrl();

if (url.equals (“http://www.gcrit.com/build3/admin/index.php”)){

System.out.println (“Successful”);

}

else {

System.out.println (“Unsuccessful”);

}

}

}

This example’s last few code lines confirm the dependency is functional and fixes your application. Therefore, you can use this method and apply the same changes to your project, which should resolve the error and improve your application.

– Selecting the Class Path and Adding the Latest Jar

The last full-proof solution teaches how to fix the error by selecting the classpath and adding the latest jar. As a result, the program displays an option allowing you to change the exact location and apply the current changes.

But first, we suggest downloading the appropriate browser’s driver to avoid unexpected bugs.

The following syntax should help you resolve the mistake:

public class TestuiAautomation {

public static void main (String[] args) {

System.out.println (“Jai Lin”);

try {

System.setProperty (“webdrivers.chrome.driver”, “C:\\Program Files\\Java\\chromedriver.exe”);

System.out.println (System.getProperty (“webdriver.chrome.driver”));

ChromeOptions chromeOptions = new ChromeOptions();

chromeOptions.addArguments (“no-sandbox”);

chromeOptions.addArguments (“–test-type”);

chromeOptions.addArguments (“disable-extensions”);

chromeOptions.addArguments (“–start-maximized”);

WebDriver driver = new ChromeDriver (chromeOptions);

driver.get (“https://www.google.com”);

System.out.println (“Google is selected”);

} catch (Exception e) {

System.err.println (e);

}

}

}

These simple code alterations repair your document and allow further procedures, helping you complete the application. Although you can paste the example to your document, changing the values is essential to fit your program’s needs.

Conclusion

The error occurred when initiating the boot layer when writing the properties and inputs in the default and your class. Still, this guide solved it and explained the following critical points for your convineince:

  • The source file folder mistake affects the main and custom classes
  • We suggest recreating the exception by changing the file’s structure
  • You can fix this annoying error by creating a standard main class and linking the FX inputs
  • The last debugging method suggests selecting the classpath and adding the latest jar

After applying this article’s debugging principles and solutions, you will likely avoid this incorrect message. In addition, you will reenable all processes and procedures without any hassle.

  • Author
  • Recent Posts

Position is Everything

Your Go-To Resource for Learn & Build: CSS,JavaScript,HTML,PHP,C++ and MYSQL. Meet The Team

Position is Everything

Понравилась статья? Поделить с друзьями:
  • Error not accessible zebra zd410 ошибка
  • Error 00 мегафон ошибка что это
  • Error 1004 ошибка при вызове
  • Error 1001 неизвестная ошибка 0x80005000
  • Error 064 пульсар как сбросить ошибку