Eclipse Updating the compiler compliance to 1.7
Asked Answered
Y

5

9

I am having some trouble updating the compiler compliance of my eclipse workspace (I am actually using RTC, but it is essentially eclipse). Currently, it uses a jdk of 1.6 so I can change the JDK compliance to a limit of 1.6.

However, I am using jdk 1.7 for my project -I have added it as a JRE -

preferences --> Java --> Installed JRE --> added jre with the jdk 1.7 directory.

However, even though I use this as the default JRE it does not allow me to change the compiler compliance level to 1.7.

I am guessing that there is something I am missing.

Any help would be greatly appreciated

Yolanthe answered 27/8, 2013 at 10:34 Comment(1)
please mention exact version of eclipseGodson
S
12

The Compiler compliance level is Version Dependent in eclipse. If you are using Eclipse 3.7 or lower then you won't get 1.7 compliance. Use Eclipse JUNO or higher.

For more on JDT Core 7 and its release related information

UPDATE:

Even eclipse 3.7.1 version supports Java 7 features and compliance level.

Steamship answered 27/8, 2013 at 10:44 Comment(3)
I am using RTC, so perhaps I will have to look at getting a newer versionYolanthe
Yes I use JUNO and it has compliance level of 1.7Steamship
Check the update. Even eclipse 3.7.1 version supports Java 7 compliance level.Steamship
H
6

I use eclipse 3.6.1 with installed JRE 1.7 and I was able to set Java compliance level to 1.7 (on the workspace level - preferences).
In some workspaces I could do that right in the Preferences, in some workspaces I had to do that in a "hard way" updating several properties in the file: .metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.jdt.core.prefs
Here are changed lines: org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.source=1.7 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7

Maybe it was just enough to change the line with "org.eclipse.jdt.core.compiler.compliance" property , but I did all three for the sake of completeness and consistency.

Humanity answered 30/12, 2015 at 16:38 Comment(0)
S
4

If you are using eclipse 3.7 then you add 1.7 into compliance level by following way:-

  • right click on project
  • click on Build path->Configure Build Path->project Facets
  • there you can see one link 'convert to faceted form'. click on it
  • mark java and select verion 1.7 from dropdown which is present in front of java tab
  • click on apply and click ok
  • now you can see that 1.7 version is appeared in compliance level

Note:- Before above step you have to add JRE System library in Build path for jdk1.7

Sidestep answered 26/5, 2015 at 12:51 Comment(0)
W
0

Right-click the project you have in use, click Properties, go to Java Compiler, and set Compiler compilance level to 1.8.

https://static.mcmap.net/file/mcmap/ZG-AbGLDKwfpKnMxcF_AZVLQamyA/pKAlh.png

https://static.mcmap.net/file/mcmap/ZG-AbGLDKwfpKnMxcF_AZVLQamyA/GWMvZ.jpg

Wellbalanced answered 30/4, 2017 at 10:48 Comment(0)
P
0

Select your project, then go to Project -> properties. In Properties -> Java Compiler. Under JDK Compliance if "use compliance from execution environment " is checked then uncheck it and you would see a dropdown in from of Compiler Compliance Level. Chose your desired version from here.

Click on Apply and Close. Hopefully, this would resolve the issue.

Philippines answered 4/1, 2022 at 6:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.