Bernard's Technocratic Blog


The type java.lang.Enum cannot be resolved. It is indirectly referenced from required .class files
August 28, 2010, 3:11 am
Filed under: Eclipse, Java, JVM, Mac OS

Are you having these types of Eclipse-related errors???

The project was not built since its build path is incomplete. Cannot find the class file for java.lang.Enum. Fix the build path then try building this project

The type java.lang.Enum cannot be resolved. It is indirectly referenced from required .class files    XXX.java

So this issue took me a few hours to resolve.  I’ve looked at other blogs and people say that you should check if your eclipse is pointing to the wrong JVM. e.g. 1.6 vs 1.5

But this wasn’t the cause of the issue for me.  So I work on MBP.  With the latest OS updates, the JVM directories are overridden.  This is a pain especially if you are working with legacy applications using JVM 1.5.

I tried to download a 1.5 JDK/JVM version, but that copy appears to be incomplete or corrupted.  So the best thing to do and you may not have been doing this, is to restore the java directories using time machine.  On my machine, I would go to:

/System/Library/Frameworks/JavaVM.framework/Versions/

Then enter time machine, and replace all the directories with that past version that worked.  BTW, don’t delete the A directory.  You would think it’s some junk directory, but it’s not.  It’s a required directory that some engineer did not think to name properly.

In eclipse, I went to Preferences -> Java -> Installed JREs and selected the JVM 1.5. If it’s not there, click on the Search button. This will search your system for all installed JREs.

Next, go to Project -> Properties -> Java Build Path and make sure the JVM 1.5 JRE System Library is added to the list.  If not, you should click on the Add Library button , select JRE System Library and select workspace default JRE (JVM 1.5).

This took me 3 hours to debug!!!  And it’s 3 am…