The type java.lang.Enum cannot be resolved - Getting error after importing Java project in Eclipse
NickName:Bacteria Ask DateTime:2015-05-05T23:20:51

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.

Copyright Notice:Content Author:「Bacteria」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/30057054/the-type-java-lang-enum-cannot-be-resolved-getting-error-after-importing-java

Answers
Tom Osterfeld 2020-12-20T23:21:19

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


Nikki 2021-12-13T17:17:59

If you are using Eclipse, try running Project -> Clean",


Darknight 2023-01-31T19:23:32

Upgrading JDK package fixes the issue, after installing new JDK make sure you update your environment variables to new JDK installed path",


More about “The type java.lang.Enum cannot be resolved - Getting error after importing Java project in Eclipse” related questions

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 cou...

Show Detail

Android: The type java.lang.Enum cannot be resolved

I downloaded Android's Browser project (from git) and imported it to Eclipse. I cannot build it however because of the following error: The type java.lang.Enum cannot be resolved. It is indire...

Show Detail

Java project in Eclipse: The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files

I am getting the following error after importing a project in Eclipse: The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files However, I have set the

Show Detail

Java project in Eclipse: The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files

I am getting the following error after importing a project in Eclipse: The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files However, I have set the

Show Detail

Configuration cannot be resolved to a type error in maven project

When I am configuring the hibernate project with the help of maven project ,I included all the dependencies like hibernate maven and mysql and after that I wanted to connect hibernate to my mysql in

Show Detail

Java problems importing code in eclipse

I'm importing java project in eclipse and i'm getting the following errors. In description, it gives me 'Java Problems(2 items)'. First item is as follows: The project was not built since its buil...

Show Detail

Importing java file to jsp - cannot be resolved to a type error

So, after searching the web for a few hours, I decided to post my question here: I'm writing a web project , running it on tomcat Apache through Xampp (a program that runs servers). I wrote a jav...

Show Detail

Eclipse (Android): Cannot be resolved to a type/variable etc

Hey guys after updating Eclipse (Help -&gt; Check for Updates) and Android-SDK-Manager I always get the "…cannot be resolved to a type" or "…cannot be resolved to a variable" message. I get this Er...

Show Detail

Eclipse error cannot be resolved to a type

I am trying to learn Cucumber using Maven + Eclipse. When trying to import the following I am getting the error respectively import cucumber.org.junit.runner.RunWith; import cucumber.api.junit.

Show Detail

Eclipse Error: java.lang.CharSequence cannot be resolved

I'm getting a error trying to compile a simple code in Eclipse. I'm using jre8. For example, when I try to compile this code: import java.util.ArrayList; import java.util.Collections; import java...

Show Detail