• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

eclipse 3.0 and java 5

 
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
why eclipse doesnt work (or compile, not sure) properly with java 5?
 
drifter
Posts: 1364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try 3.1 if you want eclipse to recognize java 5 features
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Note that 3.1 is still in beta. You can download it from the top 10 downloads area of the Eclipse site.
 
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Miguel,

I did a small (sample) project in Eclipse 3.0 using JDK 1.5, it seemed to work fine. What exactly are the issues you are facing?


Regards,
Saket
[ March 16, 2005: Message edited by: Saket Barve ]
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I wonder how you got Eclipse 3 to recognise any of the new language constructs.
I wonder even more how you got the compiler in Eclipse 3.0 to generate version 49 classfiles (which is the 1.5 format).

Most likely you think that because you can run Eclipse 3.0 on a machine on which JDK 5.0 is installed they work togeter but they don't, Eclipse 3.0 will only recognise J2SDKSE 1.4 and earlier language constructs and will only generate classfiles to version 48 or earlier (which will run on a 5.0 JVM of course as the runtimes are fully backwards compatible between 1.4 and 5.0).
 
miguel lisboa
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
pardon my ignorance, but what are version 49 classfiles?
 
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I am running Eclipse 3.1M3. The way that I set up an Eclipse project to be compatible with Java 5 (or 1.5 if you prefer) is to go into the project properties and select 'Java Compiler' then click the "Configure Workspace Settings" button.

This gives you a list of options which you can configure for the compiler.

For Java version settings select the 'Compiler and Compliance' tab.

The first drop down box is for "Compiler compliance level". This can be set to '5.0'. There are other option you could play around with but this setting should be enough.

The other thing I do is check that Eclipse is using the correct (Java 5) compiler. Once you have clicked 'OK' on the Java Compiler options click on the 'Java Build Path' option from the list. This gives you a list of options that you can configure for building your java project.

Click on the tab called 'Libraries'. At a minimum there should be at least one item listed = "JRE System Library". In the square brackets after the name this should say "[Java 5]", if this says something like "[j2sdk1.4.2]" instead then you need to change this to use the Java 5 library (which is your java 1.5 - just remember java 5 = java 1.5).

Click on 'Add Library' button.
Select 'JRE System Library' from the list of options and Click 'Next'.
Select 'java 5' in the drop down box beside "Alternate JRE" and click 'Finish'.

If 'java 5' does not appear in the drop down list you will need to tell Eclipse where to go to find the Java 5 compiler (assuming that you have installed it). To do this click the 'Installed JREs..' button.

This brings you to a screen where you can delete, add or edit the Java run-times that Eclipse will search for. Click 'Add...'. Enter "Java 5" as the JRE name and browse for the 'JRE Home Directory' and point to where you have Java 5 installed. The 'Use default system libraries' checkbox should be ticked. Click 'OK'.

Java 5 should now appear on the list of Installed JREs. Tick the checkbox next to it. Click 'OK', Click 'Finish'.

In the list of libraries make sure that there is only 1 'JRE System Library'. If there is more than one highlight the one without "[Java 5]" and click remove. Repeat this until the only one remaining is 'JRE System Library [Java 5]'.

Hopefully this will work in Eclipse 3.0.

Regards,

Fintan
 
Ranch Hand
Posts: 193
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Even i had executed some sample J2SE 5.0 code using Eclipse 3.0 and JDK 5.0 beta. It worked fine.

Jeroen Wenting, what do you mean by this ?

I wonder how you got Eclipse 3 to recognise any of the new language constructs.



That eclipse 3.0 IDE will show errors on using the new java 5 constructs ? Can you elaborate on version 48, 49 files ?
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1.4 compilers (including the one in Eclipse 3.0) generate classfiles with version 48.x (x depending on the exact compiler version).
1.5 (5.0) compilers generate classfiles with version 49.0 (unless specifically told to generate an older format using the -target flag).

Eclipse 3.0 at all levels cannot work with 1.5 language constructs. This includes both the editor (which will simply show errors for everything it doesn't recognise as valid 1.4 code) and the compiler (which will fail on the same things).
Eclipse 3.1 adds the new features (with the level of support gradually going up in the different builds).

While you can add the 1.5 JRE to the runtime list, you cannot compile any code using the new language features so it will only ever run 1.4 compatible code.
 
miguel lisboa
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Jeanne Boyarsky:
thanks for the link!

@Fintan Conway:
thanks a lot for your thorough tutorial
as soon as i install java5 i'll try it

At eclipse 3.0 release notes i found this:

Developing programs with J2SE 1.5
The Java tools do not yet fully support J2SE 1.5. You can run or debug programs against a 1.5 JRE, and safely compile 1.4 programs against 1.5 libraries (the Eclipse compiler tolerates them with the exception of covariance scenarios which are forbidden byJava Language Specification (JLS) 2nd edition). However, the Eclipse Java compiler and IDE are unable to handle source files containing uses of any of the new Java language features being added in 1.5 (generics, enhanced for loops, static imports, metadata annotations, varargs), which will be codified in the forthcoming JLS 3rd edition. An early preview of the full Eclipse support for J2SE 1.5 developed in parallel with 3.0, and is available from the Cheetah page. (bug 36938)



i just downloaded eclipse 3.1M5a; as i have a lot of downloaded plugins and features for eclipse 3.0, i wonder if its safe to simply paste 3.0 plugin's folder into 3.1 install folder?!
because release notes from 3.1 states at top:

These release notes have yet to be updated for the 3.1 development stream.
What follows are the 3.0.0 release notes.]


and also release notes say:

If you had installed additional features and plug-ins into your old Eclipse, you should re-install them in the new Eclipse


this being true means hours of internet downloading again...
[ March 16, 2005: Message edited by: miguel lisboa ]
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just copied my plugins (and associated features) over into the 3.1 folder structure (be sure to not override anything already there!).
If I remember correctly they all worked.

Did the same with my workspace, that worked too

And a few months later I switched to JBuilder 2005, which is far superior.
[ March 16, 2005: Message edited by: Jeroen Wenting ]
 
miguel lisboa
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok, that tranquilizes me, thank you
[ March 16, 2005: Message edited by: miguel lisboa ]
 
miguel lisboa
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Fintan Conway
i did it all and went ok
thanks again!
 
reply
    Bookmark Topic Watch Topic
  • New Topic