2

Prologue

This problem is driving me crazy! I have Googled it and searched it on Stack Overflow ad nauseam. I have tried all the solutions in this thread and none of them have worked. This problem only started happening recently; it never happened in the past. I have imported this code base dozens of times in the past.

Problem

I have a multi-module Maven project with around 100 modules. I import it into Spring Tool Suite as an existing Maven project. But when I go to Maven->Update project on the parent module, I get this error on each of the 100 sub-modules: Cannot find the class file for java.lang.Object.

Attempted solution #1

I tried reinstalling my JRE in Spring Tool Suite (per this related thread), but that didn't work. I went to Preferences->Java->Installed JREs, and added the following path as my JRE:

/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home

It recognizes this path as a JRE location and all the JARs pop up, so it seems like it should be correct. But the problem still persists.

Attempted solution #2

I tried deleting the .metadata folders in each of my Spring Tool Suite workspaces. I wanted to reset the configuration. Still, this didn't work.

Question

How can I get rid of this annoying error!? Cannot find the class file for java.lang.Object? Is there a global Spring Tool Suite configuration file sitting somewhere on my computer that needs to be deleted so the default configuration can be restored? Can you think of any way to solve this problem and get rid of the error?

Help would be much appreciated.

ktm5124
  • 11,861
  • 21
  • 74
  • 119
  • Can you check the maven pom and parent pom s you are importing? Maybe any of them (or any maven plugin, in example the maven-compiler-plugin) is overriding the jdk being used? If you call mvn package from the command line, does it build successfully? – Daniele Apr 08 '19 at 18:00
  • @Daniele `mvn clean install` builds successfully, but `mvn package` fails on its own. I personally never use `mvn package` and only use `mvn clean install`. Wouldn't the fact that `mvn clean install` works suggest it's not a Maven problem? – ktm5124 Apr 08 '19 at 20:51
  • does the JRE classpath container entry show up in the package or project explorer for your project? If so, does it show up with the right version? If you go to the build path tab of your project properties, does it list the JRE container there? and does that entry contain all the JARs if you expand that node? – Martin Lippert Apr 09 '19 at 07:49
  • uhm have a look under `window>preferences>java>build path>classpath variables`? There should be an entry called `JRE_LIB`, pointing to the `rt.jar`.. Is the entry correct, and does the file really exist? – Daniele Apr 09 '19 at 08:08

0 Answers0