Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » JRE 7 not registering with Eclipse(Although JRE 7 was added to the build path, Eclipse won't recognize Java 7-specific code)
JRE 7 not registering with Eclipse [message #551913] Tue, 10 August 2010 07:28 Go to next message
No real name is currently offline No real nameFriend
Messages: 2
Registered: August 2010
Junior Member
Hi. I'm using Eclipse Version: 3.4.1.

I've added the new Java 7 JRE to my build path, but Eclipse puts a red line underneath my code when I try to use a switch statement on a String (a handy Java 7 feature).

String s = "asd";
switch(s) {

}

The preceding code won't work, for example, because it "Cannot switch on a value of type String. Only convertible int values or enum constants are permitted".

Why can't Eclipse realize that I'm using JRE 7?

I think it's because of the Compiler Compliance level, but JRE 7 (represented by 1.7?) doesn't show on the list of "levels".
My list includes:
1.4
1.5
1.6
..and that's it.

What's the deal? I was just about to celebrate some much cleaner, elseif-free code.

[Updated on: Tue, 10 August 2010 07:29]

Report message to a moderator

Re: JRE 7 not registering with Eclipse [message #551923 is a reply to message #551913] Tue, 10 August 2010 08:03 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
adhoc334@gmail.com wrote:
> Hi. I'm using Eclipse Version: 3.4.1.
>
> I've added the new Java 7 JRE to my build path, but Eclipse puts a red
> line underneath my code when I try to use a switch statement on a
> String (a handy Java 7 feature).
>
> String s = "asd";
> switch(asd) {
>
> }
>
> The preceding code won't work, for example, because it "Cannot switch
> on a value of type String. Only convertible int values or enum
> constants are permitted".
>
> Why can't Eclipse realize that I'm using JRE 7?
Java 7 is not yet supported by Eclipse. The main reason is that the
specifications are either still not available (e.g. a JSR that defines
what Java 7 is) or they are under a license which is incompatible to EPL.

Dani
>
> I think it's because of the Compiler Compliance level, but JRE 7
> (represented by 1.7?) doesn't show on the list of "levels".
> My list includes:
> 1.4
> 1.5
> 1.6
> .and that's it.
> What's the deal? I was just about to celebrate some much cleaner,
> elseif-free code.
Re: JRE 7 not registering with Eclipse [message #551941 is a reply to message #551923] Tue, 10 August 2010 09:05 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 2
Registered: August 2010
Junior Member
Ugh...Thank you.
Re: JRE 7 not registering with Eclipse [message #552408 is a reply to message #551923] Thu, 12 August 2010 06:23 Go to previous messageGo to next message
Walter Harley is currently offline Walter HarleyFriend
Messages: 847
Registered: July 2009
Senior Member
"Daniel Megert" <daniel_megert@ch.ibm.com> wrote in message
news:i3r158$g12$1@build.eclipse.org...
> adhoc334@gmail.com wrote:
>> Hi. I'm using Eclipse Version: 3.4.1.
>>
>> I've added the new Java 7 JRE to my build path, but Eclipse puts a red
>> line underneath my code when I try to use a switch statement on a String
>> (a handy Java 7 feature).
>>
>> String s = "asd";
>> switch(asd) {
>>
>> }
>>
>> The preceding code won't work, for example, because it "Cannot switch on
>> a value of type String. Only convertible int values or enum constants are
>> permitted".
>>
>> Why can't Eclipse realize that I'm using JRE 7?
> Java 7 is not yet supported by Eclipse. The main reason is that the
> specifications are either still not available (e.g. a JSR that defines
> what Java 7 is) or they are under a license which is incompatible to EPL.

And even if it were supported by Eclipse, it wouldn't be supported by
Eclipse 3.4.1, which is two years old. We were still working on getting the
Eclipse compiler to fully support Java 6 at that point.
Re: JRE 7 not registering with Eclipse [message #554691 is a reply to message #551913] Tue, 24 August 2010 06:29 Go to previous messageGo to next message
Eclipse UserFriend
I've added the new Java 7 JRE to my build path, but Eclipse puts a red line underneath my code when I try to use a switch statement on a String
Re: JRE 7 not registering with Eclipse [message #557727 is a reply to message #554691] Wed, 08 September 2010 15:34 Go to previous message
Olivier Thomann is currently offline Olivier ThomannFriend
Messages: 518
Registered: July 2009
Senior Member
Eclipse has its own compiler which doesn't support 1.7 yet. If you really want to use javac to compile, you should use an ant task and disable the java builder.

Of course this will cause other kinds of issues.
--
Olivier
Previous Topic:Unexpected null binding
Next Topic:Errors on packages even though there ae no errors
Goto Forum:
  


Current Time: Thu Apr 25 17:21:20 GMT 2024

Powered by FUDForum. Page generated in 0.04040 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top