Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error occurred during initialization of boot layer FindException: Module not found

Tags:

Executing a simple "Hello World" program using Java 9 results in the following error message:

Error occurred during initialization of boot layer
java.lang.module.FindException: Module com.pantech.myModule not found

The command line that I executed was:

java --module-path bin -m com.pantech.myModule/com.pantech.myModule.HelloWorld 

This command line is executed from the parent directory of my bin directory that contains all of the .class bytecode files.

The module-info.class file is located in the com.pantech.myModule directory that is located in the bin directory. The HelloWorld.class file contains the main method and is located in the package directory within the com.pantech.myModule directory. Therefore, the pathname of the HelloWorld.class file is bin\com.pantech.myModule\com\pantech\myModule\HelloWorld.class.

The HelloWorld class is in the com.pantech.myModule package (package name same as the module name).

I am using Windows 10 as the Operating System. From everything that I have read, the above command line should be correct. Any suggestions on how to fix this?

like image 922
D. Pante Avatar asked Mar 27 '18 19:03

D. Pante


People also ask

How do I fix error occurred during initialization of virtual machine?

Resolution. Indicates that the java virtual machine is not able to initialize, it has not reached the point of running any single sign on code yet. This is due to the java installation being corrupt. Please remove, and install java again to resolve the error.

How do I fix errors in eclipse?

The Quick Fix dialog can also be displayed by right clicking on the error item in the Problems view and selecting the Quick Fix menu item.

What is a boot layer?

The boot layer contains module java. base and is the only layer in the Java virtual machine with a module named " java. base ". The modules in the boot layer are mapped to the bootstrap class loader and other class loaders that are built-in into the Java virtual machine.


2 Answers

The reason behind this is that meanwhile creating your own class, you had also accepted to create a default class as prescribed by your IDE and after writing your code in your own class, you are getting such an error. In order to eliminate this, go to the PROJECT folder → src → Default package. Keep only one class (in which you had written code) and delete others.

After that, run your program and it will definitely run without any error.

like image 106
Rahat Rajdev Avatar answered Sep 24 '22 21:09

Rahat Rajdev


I had the same issue while executing my selenium tests and I removed the selenium dependencies from the ModulePath to ClassPath under Build path in eclipse and it worked!

like image 25
Ankur Avatar answered Sep 25 '22 21:09

Ankur