Project facet Java version 1.7 is not supported - java

I know similar issues has been posted already in SO but unfortunately none of them helped actually.
Facing :
Project facet Java version 1.7 is not supported
Current Environment :
Server : Tomcat 7
JDK and JRE :1.6
Eclipse : JUNO
And as per the doc it seems like Tomcat 7 should support JDK 6
Ref : https://tomcat.apache.org/tomcat-7.0-doc/building.html
I checked JRE which my project pointing to
Window --> Preferences --> Java --> Installed JRE
and its pointing to JRE1.6.
Any kind of help will be appreciated.

Facet != JRE Settings ... Right Click on Project => Properties => Tabpage Project Facets...

Right Click on Project -> Properties -> Project Facets
Your project Java version here should be same as Java compiler version
Right Click on Project -> Properties -> Java Compiler
Based on your input that you want to use JDK 1.16, same should be the version of your Java Compiler and Project Facet Java version.

You can edit the java version of your run time (server)environment
In eclipse, goto Windows->Preferences->server->run time environment->select the server on the right side window->edit->In java home->select jdk1.7.0_79 path->finish

Related

IntelliJ IDEA 2016 project change java sdk version from 7 to 8

The external libraries in Project window shows that the project was using jdk7.
Then I change the jdk version in File > Other settings > Default project structure> SDKs, by adding jdk 8 from its installed location. Now java 7 is gone, but java 8 does not show up and it could not compile. Is this a bug or did I miss anything?
if I add java 7 then it comes back in External Libraries:
You also have to adjust dependencies in module itself / remove old 1.7 libraries and add from new sdk
change the module settings indeed. Right click on the module (which I understand it as project in Eclipse I guess) and click Open module settings (F4 shortcut), and on tab dependencies, change it to 1.8, originally it was blank. (If it was blank shouldn't it be using the project settings which is already configured as java 8, but no, for some reason it still use java 7)

Which version of Eclipse is compatible with JDK 1.5?

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

JRE version is 1.6.0; version 1.7.0 or later is needed to run Google Plugin for Eclipse

I have 3 versions of Java installed on my system: 6, 7, and 8... I am required to have JRE6 available for a product my company develops, so I cannot get rid of it... But despite copying my Eclipse install to a new folder for another project I need to work on and removing JRE6 from this version alltogether, I still cannot get it to work.
How can I get the google plugin for Eclipse to work in my scenario?
If you have created a shortcut to start eclipse, you can add a parameter to tell it to use the jre of your choice like this -
C:\eclipse\eclipse.exe -vm "C:\Programs\jdk\jdk1.7.0_55\bin\javaw.exe"
I have used "javaw" executable from a jdk installation, but you may point to the same executable within a JRE installation as well.
This will resolve the error.
Keep in mind that there is a separation between the JVM that Eclipse itself is running in and the various JREs that you can configure in Eclipse to run your programs/applications. You need to specify to Eclipse what JVM you want it to run under, using eclipse.ini.
That's separate from the Installed JREs configuration you show in your screen shot above.
Add Java 7.0 to Eclipse if you haven't: Window -> Preferences -> Java -> Installed JREs.
Next add Java 7.0 library to your project: Right click on project -> Properties -> Java Build Path -> Libraries tab -> Remove JRE 1.6 and add New Library (JRE System Library, 1.7.0).
Last set Java 7.0 compliance level: Right click on project -> Preferences -> Java Compiler -> Compiler compliance level: 1.7
Also since you can use different Java to run applications, you also have to change this in the Run configuration which you use to start AppEngine related tasks.

Programming Java 8 in Eclipse

The development of Eclipse support for Java 8 is ongoing in a branch (http://wiki.eclipse.org/JDT_Core/Java8).
To try out the current Eclipse support for Java 8, I did the following:
I installed a build of JDK 8 (This step is optional).
I checked out branch BETA_JAVA8 of git://git.eclipse.org/gitroot/jdt/eclipse.jdt.core.git.
I imported the checked out projects in an instance of Eclipse Juno SR1 (Build ID: 20120920-0800).
I ran a new instance of Eclipse from my running Eclipse.
To use the new syntax available in Java 8, Eclipse said that I have to set the compliance level of my code to 1.8. To set the compliance level, I have to set the execution environment to JavaSE-1.8. This execution environment was not available at Windows -> Preferences -> Java -> Installed JREs -> Execution Environments.
How can I set the execution environment to JavaSE-1.8?
The following summarizes some of my attempts to install the execution environment:
I followed the wiki instructions looking for a description of JavaSE-1.8 at the update site http://download.eclipse.org/eclipse/updates/4.2. But, the definition of the execution environment wasn't there.
I looked for the JavaSE-1.8 profile in the git repository of rt.equinox.framework, but, it wasn't there.
I just went to the Eclipse Marketplace from inside of Eclipse (Help/Eclipse Marketplace...) and installed the "Java 8 support for Eclipse Kepler SR2", and the new "JavaSE-1.8" execution environment showed up automatically. I had previously installed Java 8 and added it as a 'Installed JREs' entry. No need to mess with property files.
Think you just have to change the 'settings' directly in the 'preference file' : org.eclipse.jdt.core.prefs .
e.g. org.eclipse.jdt.core.compiler.compliance=1.8
If you have Kepler you can get it using a patch that has installation instructions on this page:
https://wiki.eclipse.org/JDT/Eclipse_Java_8_Support_For_Kepler
Starting with I20140318-0830 all Luna (4.4) builds on our downloads
page contain the Eclipse support for Java™ 8. For Kepler SR2 (4.3.2) a
feature patch needs to be installed. This page describes how to do
this.
Eclipse version >=Luna (that's one after Kepler) runs smoothly with java 8.

How to change JDK version for an Eclipse project

I need to write a project that's only compatible with Java 1.5. I have Java 1.6 installed. Is there some form of backwards compatibility to get Eclipse to compile with 1.5?
Do I have to install Java 1.5 to get it to show here? Or maybe there is another way?
.
Click on the Add Library button. It brings your screen to point to the Java location.
Select "Directory", button right besides JRE home and point to the installed folder location.
Even though you want to just 1.5 compiler project, you can achieve it by changing compiler settings in Eclipse instead of removing 1.6 JRE and add 1.5 JRE.
GOTO -->JAVA--Compiler---> and change compiler level to `1.5` instead of `1.6`
As davidfmatheson suggested,
Just be careful, especially if you're setting this up for a team of people to work on. If anyone uses anything that is new or changed in 1.6, it will compile, but not run in an environment with JRE 1.5.
Click on the Window tab in Eclipse, go to Preferences and when that window comes up, go to Java → Installed JREs → Execution Environment and choose JavaSE-1.5. You then have to go to Compiler and set the Compiler compliance level.
Right click project -> Properties -> Java Build Path -> select JRE System Library click Edit and select JDK or JRE after then click Java Compiler and select Compiler compliance level to 1.8
If you are using maven build tool then add the below properties to it and doing a maven update will solve the problem
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
In the preferences section under Java -> Installed JREs click the Add button and navigate to the 1.5 JDK home folder. Then check that one in the list and it will become the default for all projects:
Eclipse - specific Project change JDK Version -
If you want to change any jdk version of A specific project than you have to click ---> Project --> JRE System Library --> Properties ---> Inside Classpath Container (JRE System Library) change the Execution Environment to which ever version you want e.g. 1.7 or 1.8.
The JDK (JAVA_HOME) used to launch Eclipse is not necessarily the one used to compiled your project.
To see what JRE you can select for your project, check the preferences:
General → Java Installed JRE
By default, if you have not added any JRE, the only one declared will be the one used to launched Eclipse (which can be defined in your eclipse.ini).
You can add any other JRE you want, including one compatible with your project.
After that, you will need to check in your project properties (or in the general preferences) what JRE is used, with what compliance level:
(source: standartux.fr)
See the page Set Up JDK in Eclipse. From the add button you can add a different version of the JDK...
As I was facing this issue minutes ago, in case you are trying to open an existing project in an environment with a newer JDK, make sure you pdate the JDK version in Project Properties -> Project Facets -> Java.

Categories