|
|
Re: Problem with enum [message #637236 is a reply to message #637203] |
Thu, 04 November 2010 16:49 |
Walter Harley Messages: 847 Registered: July 2009 |
Senior Member |
|
|
On 11/4/10 7:59 AM, Torbjørn Knutsen wrote:
> Hi,
>
> I'm trying to create an enum in a java file, but Eclipse acts out..
>
> Some test code:
>
> class someclass {
> enum ape {
> chimp, spidermonkey
> }
> }
>
> I get the error message "enum cannot be resolved to type". As far as I
> could read, this way of defining enums should work with Java 1.5 and newer.
> My compiler compliance level is set to 1.6 (tried 1.5 and 1.4 as well,
> no luck). Installed JRE is java-6-openjdk.
>
> This test-code compiles without error, so must be something wrong with
> eclipse..
That conclusion seems a bit extreme, given the number of Eclipse users
who are happily working with enums at any given moment.
More likely, there is a problem with your configuration, and either you
are running Eclipse with a JDK that does not let it support Java 5
features, or your project is not correctly configured.
What version of Eclipse are you using?
What version of the JRE are you running Eclipse with? (This may not be
the same as what you are compiling against.)
Are you able to use a Sun (/Oracle) JDK, or IBM, or JRockit? Eclipse is
not tested on openjdk so I have no idea whether that's an issue or not.
In your project properties, you say you have the compiler compliance set
to 1.6; do you also have the "Use default compliance settings" box checked?
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03755 seconds