I am wondering how to switch the java compiler in Eclipse.
6 Answers
Eclipse does not use the compiler in the JDK, just the runtime libraries. The compiler is embedded in Eclipse (so you can run on a plain JRE).
You set all the compiler properties in the Java->Compiler preference window, and the class libraries in the chosen JRE.

- 73,784
- 33
- 194
- 347
-
That's interesting. So even if i get the latest JDK on my system, Eclipse still uses the old compiler that came with Eclipse? See my related question http://stackoverflow.com/questions/24710030/is-jdk-required-for-android-developement – faizal Jul 16 '14 at 18:01
-
Yes. This is why Java 8 support in Eclipse 4.4 is backported to 4.3 – Thorbjørn Ravn Andersen Jul 16 '14 at 19:25
-
ok. That makes me wonder if Eclipse also has an embedded JDK? Or only just the compiler? I could not figure out anything looking at the Eclipse installation folder. – faizal Jul 17 '14 at 08:50
-
1Eclipse has an embedded compiler and not any more. The downloads from eclipse.org does not contain a Java distribution, but for instance IBM brands Eclipse with their own brand and include their own Java which is then tested as a whole. – Thorbjørn Ravn Andersen Jul 17 '14 at 21:38
Window > Prefrences > Java > Installed JREs

- 9,282
- 5
- 36
- 53
-
2This does change the JRE, however it doesn't change the compiler. I require my other IDE to use JDK 1.7 and Eclipse to use JDK 1.6. – Daniel May 23 '13 at 18:29
Eclipse website says that changing the VM in Eclipse.ini is the most certain way to change the underlying VM. Here is a snippet from the eclipse site.
http://wiki.eclipse.org/Eclipse.ini
"One of the most recommended options to use is to specify a specific JVM for Eclipse to run on. Doing this ensures that you are absolutely certain which JVM Eclipse will run in and insulates you from system changes that can alter the "default" JVM for your system. Many a user has been tripped up because they thought they knew what JVM would be used by default, but they thought wrong. eclipse.ini lets you be CERTAIN."

- 31
- 1
Eclipse uses their own compiler named 'Eclipse Compiler for Java(ECJ)' embedded with JDT for compiling java code. We can only switch java run time environment.

- 3,373
- 5
- 29
- 54
go to Window->Preferences->Java->Compile.You can change java compiler in this menu.

- 2,881
- 3
- 25
- 37
From the menu You select Window -> Preferences, then in tree you search for Java and Complier
There you have Complier complacence level and you can choose.

- 30,365
- 9
- 60
- 95
-
Are you sure that changing the compiler compliance level actually changes the compiler being used by Eclipse? The warning message in Eclipse says to install the required JRE(does not have a compiler), not JDK(has the compiler), when changing the compliance level. – faizal Jul 19 '14 at 15:44