Which version of Eclipse is compatible with JDK 1.5? - java

I am working on an existing Java web project. I am getting lots of syntax errors in the files. It shows it needs JDK version 1.5. I have Eclipse Luna (4.4.1), which doesn't support JDK 1.5. How can I find out which version of Eclipse is compatible with JDK 1.5?

You can go to Preferences -> Java -> Installed JRE and add a new java VM which is Java 1.5.
Also, for your project, go to Project's properties -> java compiler. Check the checkbox to enable project specific setting and set the compliance level to java 1.5

Related

Eclipse Java assistance doesn't comply with compiler level setting

The compiler level used to autocomplete my Java code in Eclipse Neon is 1.8 (proof is it suggests me to use ResourceBundle::getBaseBundleName() for example). I do use a 1.8 JDK but the workspace Java compiler compliance level is 1.7 and project specific settings aren't enabled. How come and how do I change that?

Eclipse thinks my JRE is 1.6, when I've migrated to 1.7

I am having a problem with Eclipse Luna after an update. Despite showing in the tree for the project that it is using JRE system library 1.7 the error checking is reporting bugs with a switch using a string that it has a source level below 1.7.
The specific error:
Cannot switch on a value of type String for source level below 1.7. Only convertible int values or enum variables are permitted
I have tried going into Properties > Build Path and adding and removing the library but this has not fixed the problem.
I moved from the Eclipse packaged with Debain Wheezy which uses the 1.6 JDK and the much older Eclipse 3.8. I am now using CentOS 7 with the 1.7 JDK. The migration has not been as smooth as I hoped. Since there has some big version jumps, I need help getting this new 4.4 version working properly.
Window -> Preferences -> Java Compiler -> set the compiler level to 1.7
Same for Project -> Properties -> Java Compiler -> 1.7
If you can't find that option (by which I mean Compiler 1.7), you must specify the Installed JRE to be JDK 7 too.

Eclipse Eclipse is running under 1.6, but 1.7 is needed

I have just installed WindowBuilder for Eclipse and java 1.7 JDK, but when I create a new JFrame in Eclipse, and try to open the "design-view" in WindowBuilder I get the following error: "Eclipse is running under 1.6, but the Java project has a 1.7 Java compliance level, so WindowBuilder will not be able to load classes from the project. Use a lower level of Java for the project, or run Eclipse using a newer Java version."
How to Resolve Incompatible Java version Error in Eclipse in mac?
You might have installed the Java 1.7 SDK but it looks like Eclipse is started with the older one (1.6).
The WindowBuilder is integrated into Eclipse and will use the same Java instance as Eclipse (that is the 1.6 version).
However your project will use Java 7. The WindowBuilder (Java 6) will be unable to load classes from the higher version which your project uses (Java 7).
What you need to do is:
Configure your eclipse to start with the newer (Java 7) version. This can be done in the Eclipse.ini file.
Which Eclipse you're running?
You definitely need to upgrade your Eclipse to a newer x64 Version to use Java 1.7.0

Eclipse Indigo: Compiler compliance level 1.7 is missing from the list

I installed Java 7 JDK (jdk-7u9-windows-x64.exe) and started up Eclipse Indigo to try a statement using the new diamond syntax. It does not compile.
I have added jdk1.7.0_09 in Preferences - Java - Installed JREs.
Under Preferences - Java - Compiler I wanted to set 1.7 compliance level, but my drop-down list only contains 1.3 - 1.6. How can I get 1.7 to appear here?
Version: Indigo Release Build id: 20110615-0604
Bad luck for Indigo, install Juno.
Copied from eclipse page:
Download Eclipse 3.7SR2 for out of the box support. Or, follow the
steps below to get the JDT source code in an earlier build and launch
a runtime workbench which will contain Java 7 features.
http://wiki.eclipse.org/JDT_Core/Java7
Edit:
Eclipse indigo sr2 can be downloaded: here

How to change workspace JRE in Eclipse

While creating new Java project in Eclipse I got following warning "The current workspace uses 1.4 JRE..."
I have JRE7 on my system. I have added following lines in eclipse.ini
-vm
C:\Java\jre7\bin\javaw.exe
I have added JRE7 to Installed JREs through Windows -> Preferences-> Installed JREs.
Still under Compiler tab I can see only compiler compliance level till 6.
How can I change workspace JRE to JRE 7 ?
Java 7 support is only available since Eclipse Indigo SR1 (released about a month ago). So, upgrade Eclipse.
I also have jre7, and it really doesn't matter if it only says that is compliant with 1.6, because the project will look for the java compiler specified by the jre/jdk used in the project.
I also recommend you use the jdk instead of the jre, and set the environment variable JAVA_HOME, there's lots of tutorials on this in Google.
The issue where it is compiling with 1.4 but the workspace Preferences Compiler setting is 1.6 seems to be the issue described in this bug:
Bug 499675 - Global compiler settings ignored after restarting, defaults to 1.4 even though 1.8 displayed
https://bugs.eclipse.org/bugs/show_bug.cgi?id=499675
where the workaround is to change the workspace setting to a different version number and then back to 1.6. That would enable the workspace to compile with 1.6.
To compile with 1.7 you'd need to upgrade eclipse as in BalusC's answer.

Categories