'Error occurred during initialization of boot layer - Eclipse Java

I have the following error when trying to run Java project:

Error occurred during initialization of boot layer
java.lang.LayerInstantiationException: Package jdk.internal.jrtfs in both module java.base and module jrt.fs

I tried to remove JDK and JRE and install them again, but the problem is still there.

Could someone explain how to solve this issue?

Could system restore help?



Solution 1:[1]

I ran into same issue, I think it's something to do with the newer version of Java.

When creating a new java project heres a picture

click version 1.8 and then save it and it should work.

Solution 2:[2]

If your program works on command line, the problem is not the JDK installations but the IDE which is Eclipse. try reinstalling the Eclipse IDE.

Solution 3:[3]

I ran into the same issue today and I tried "Run as -> Java Application". Then it was fixed. (btw, the jdk I used was jdk-11.0.2) Hope you would find this helpful!

Solution 4:[4]

This can happen when you have a run configuration with no project and main class configured. You can fix this by going to your run configurations and deleting the empty configuration or choosing the correct one when running it.

Solution 5:[5]

I had the same issue. It seems that the dependencies on the Modulepath got mixed up.
A rebuild of the project after deleting the Launch Configuration file of the project under …\workspace\.metadata\.plugins\org.eclipse.debug.core\.launches and deleting the bin directory fixed the problem.

Solution 6:[6]

Clean project then create a new configuration where you indicate the file that contains the main method in your project the run the project again

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 kewpiepie
Solution 2 apobletos
Solution 3 HUIWEN LU
Solution 4 Chillja
Solution 5 Kaplan
Solution 6 Mohammed NAIMI