Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The type java.lang.Enum cannot be resolved - Getting error after importing Java project in Eclipse

I am getting the following error after importing Java project (Non Maven) in Eclipse:

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

I have couple of Java classes in my project and I am getting this compilation error in the first line of this below class (In the package declaration line)

package com.test.utils;

public enum Currency {
    PENNY, NICKLE, DIME, QUARTER
};

I checked my project's Java Build Path and in the Libraries tab all the jars and JRE System Library are present. Below is the .classpath content

<?xml version="1.0" encoding="UTF-8"?>
    <classpath>
        <classpathentry kind="src" path="src"/>
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
        <classpathentry kind="lib" path="lib/***.jar"/> 
        <!-- list of jars -->
        <classpathentry kind="output" path="bin"/>
   </classpath>

I am using eclipse JUNO

Eclipse Java EE IDE for Web Developers.
Version: Juno Service Release 2
Build id: 20130225-0426 

and Java version is jdk 1.6.0_29 and the Compiler compliance level is 1.6 in eclipse.

I tried the following to resolve this issue

  1. Clean the project & build the project
  2. Delete and reimport the project and then again did the step 1
  3. Restart eclipse from the "File" menu and again did the step 1

But none of the above worked.

Please tell me how can I get rid of this compilation error.

like image 790
Bacteria Avatar asked Sep 29 '22 01:09

Bacteria


1 Answers

I had the same issue and I just restarted my IDE and it worked

like image 190
Tom Osterfeld Avatar answered Nov 04 '22 18:11

Tom Osterfeld