The project was not built due to "Failed to init ct.sym for C:\Program Files\Java\jre-10.0.2\lib\jrt-fs.jar" in IDE Eclipse

Viewed 39530

Good day! I did a servlet in IDE Eclipse, but I got this problem after creating a new Dynamic Web Project (File / New / Dynamic Wev Project).

I see this in Markers:

"The project was not built due to "Failed to init ct.sym for C:\Program Files\Java\jre-10.0.2\lib\jrt-fs.jar" in IDE Eclipse"

My servlet does not want to build. There is a java-file, but no class-file after building. I deleted, created, cleaned my project. Later I deleted and added Tomacat-server. Java EE is intalled.

No result. Google can`t help me.

Please, help me to solve this trouble...

9 Answers

Whenever you create the java project using eclipse, you have 3 choices given which are,

  1. Use an execution environment JRE
  2. Use a project specific JRE
  3. Use default JRE 'jre-10.0.2' and workspace compiler preferences

Try to select the third choice.

Not sure if you've solve the problem or not but I just wanted to help since I was having the same problem just now.

  1. In eclipse go to Window.
  2. In Window go to Preference.
  3. In Preference, in the search bar type "Installed JREs"
  4. Edit the jre to the file directory in which your JDK is installed i.e C:\Program Files\Java\jdk-14.0.2 after that you can close and refresh and it should build fine.

solution::

1.

Preference > Installed JREs > add > standard VM (not sure but works) > Directory > go to where you download your java (eg:G:\Java\jdk-15.0.1) > Finish Add JRE Path 1 Add JRE Path 2

2.

Preference > Installed JREs > execution environment > JavaSE-15 > choose jdk-15.0.1 > apply Change Exec Env

3.

Create your Java project. Create project



PS::

I used user14235983 's method before, it worked, but using this would cause a problem of not showing the documentation of the functions (in my case).

So I checked the library again. It seemed like there is something wrong with the path. So I tried to change it. And then it worked. And I came back here, look through Myth_Star & GokulnathP 's answer again, I found that we are using the same method.

In your question, it seems like you have the correct path. (So I am not sure whether we are having the same type of problem.) Maybe its because you are using "\Java\jre", but I am using "\Java\jdk". Else maybe try to reinstall your Java.

I am also having this same issue for 3 days, finally i find out the solution,

  1. While adding tomcat as server click on Installed JREs and check the path is exist in your system and the path is not a temp folder
  2. For both the cases add C:\Program Files\Java\jdk-14.0.1.

I also had the 'Failed to init ct.sym for ..../jrt-fs.jar ' error in Eclipse 2021-03 with JRE from OpenJDK11 in a new Java project. For me the fix was to disable the "Use '--release' option" in the "Java Compiler" section of the project properties.

In the installation step where you have to specify the jdk, select the one which works and has 1 vm atleast, if you can't see, add it to JAVA_HOME or PATH variable in system variables. Check if it works by using the command prompt: java --version and javac If it shows the appropriate messages without warning or not found, you can specify that path while installing.

I was having the same error, except mine was stored in:

\AppData\Local\Temp\eoiEBC.tmp\plugins\org.eclipse.justj.openjdk.hotspot.jre.minimal.stripped.win32.x86_64_15.0.1.v20201027-0507\jre\lib\

This message appeared out of nowhere and was no longer able to build. Not exactly sure where it came from, but deleting the .jar did the trick and all was good again.

If this has started happening randomly and your project isn't dependent on it I'd just get rid of it. Something is breaking during its init. Keep it on hand if you do need it though.

I also encountered this Problem in MyEclipse IDE. When i tried to create a java project in My Eclipse. The project successfully creates but i had issues running my main class. When i run my main class i get this error (could not find or load main class ...) then when i checked my problems window to get the specific error, this was the error that i saw (The project was not built due to "Failed to init ct.sym for C:\Program Files\Java\jre-10.0.2\lib\jrt-fs.jar". Fix the problem, then try refreshing this project and building it since it may be inconsistent). I was abe to fix the problem by changing the compliance level of MyEclipse IDE from 10 to 12. I think the cause of the problem was because of myEclipse was using JDK 12 and my compiler was using Compliance level 10 instead of 12.You can find the compliance level by

  1. In Eclipse go to Project
  2. In project click properties
  3. In Properties click Java Compiler
  4. In Java Compiler click Configure Workspace Settings
  5. In Configure Workspace Setting you will see Compiler Compliance level

I think the Compiler compliance level must be equal or greater than the jdk that you are using ( Compiler compliance level >= Jdk). I hope this will be helpful to you.

Related