Eclipse 2.5 spec web app error - java

Have a running 2.5 web module project on my eclipse. I wanted to upgrade to Java 8 (currently running 7). When I set the compiler compliance of the project to Java 8, I'm getting error icon on the project. And the unsupported version exception when loading the class in tomcat (8)

Setting compiler compliance of a project to Java 8 is not enough. You need to:
Add a Java 8 "Installed JRE" in the "Preferences".
Change the "JRE System Library" of the project to use the new JRE.
Change compiler compliance of the project.
To run the code, you also need to:
Change Tomcat to use a Java 8 runtime.
If Tomcat is running as a Windows Service, you need to remove and re-add the service, because it remembers the Java version that was in effect when it was added.

Related

Google app engine deployment error : JDK not JRE

I'm trying to deploy the app with a .jsp file, which I figured is the reason I get an error because other projects without .jsp files have no problem.
When I try to deploy the app, I get the error : "Cannot get the System Java Compiler. Please use a JDK, not a JRE"
I tried resolving the problem using Mahmoud's solution here : Google app engine deployment : JDK not JRE
But once I have changed the eclipse.ini file, I launch Eclipse and get this error : "Version 1.7.0_80 of the JVM is not suitable for this product. Version 1.8 or greater is required"
You need to install JDK8 or JRE8 for Eclipse to execute and JDK7 for compile this application to build.
As mentioned in the error, JDK7 is not compatible with Eclipse. So you need to set your system JDK to 8 for Eclipse. Alternatively, you could instead modify the environment variables or startup script for Eclipse to reference JDK8 and avoid making this a system wide change.
Although for security purposes, I do recommend using the latest JDK/JRE as the system one for most cases.
Then within Eclipse, set the project JDK to 7.
Click through the following:
Windows -> Preferences -> Java -> Installed JRE
There you can remove the "JRE System Library", then you can add and configure another already installed JRE/JDK for this specific project.
You need the JDK for building which includes a JRE, but for deploying you only need the JRE.
The JDK includes the ability to compile Java source into executable code, where as the JRE can only execute that executable code.
You can download JDK from Oracle's site here: Oracle Java JDK 8

Funtime errors using a Java Library requires me to have JRE 8, but Library requires JDK 6 using IDEA

I started a new project that is just a hello world that has the Commons IO v2.4 Apache Library that uses JDK 1.6 but is unable to run after I build the jar. I added it to the Libraries and Modules just fine, and it executes the methods that I took from the libraries fine on Compile time, but I am using JRE 1.7. I took of the methods to prove that it is just the fact that it is interacting with this library. I did nothing else to this new project.
The JDK for the library is 1.6 but is demanding 1.8 JRE. Is there somethign that I'm missing here? I want to let users run my jar with their minimum JRE being 1.6 so I can target more users, but this is throwign an error.
The actual Error that is being thrown is the major.min error of 52.0, which means that it needs to run it at 1.8 JRE to run a simple hello world.
Try manually selecting language level for your project.
Right click project > Open Module Settings:
On right side under sources tab, change language level to required JDK.
Then click on Project tab on left and make sure both JDK version and language version are at correct version.

How do i use diffrent jdks for Netbeans and Eclips

I have both Net-beans and eclipse IDEs installed in my laptop, But there is a per-devolved system that want lower version of JDK. so I installed net-beans older version too. but then JDK does not support my eclipse version. can I use two JDK in once?? and what should I do for working in both IDE in different versions.
Eclipse / Net beans need JRE to run in first place. If the version of JRE you install is not supported by the version of Eclipse/Netbeans u have, then you have to get a compatible version of Eclipse/Netbeans that match your installed JRE. (Alternatively you can change the JRE version)
Now coming to JDK. You need JDK only to compile you code inside Eclipse/Netbeans. You can have any number of JDKs installed and you can configure 'per project'.
In Eclipse, this is how you configure the JDK for the project
Java Build Path -> Libraries -> Add Libraries -> JRE System Library
In the next screen you add the desired JDK from your system , by locating it in the file browser.
P.S : Havent used Netbeans, but sure it is supported

Using a JAR package that uses a different Java version in eclipse

I have Java 8 and I've been trying to use a JAR package that uses JRE 6.
In 'Create a Java Project' I used the 'Use a project specific JRE' and also
created a run configuration but when I try to set the alternate JRE to 6, the 'run' button gets blocked out. Are they not compatible or am I missing a step? I've also tried changing the PATH destination, though I'm not sure if that is even relevant to my problem.
EDIT: I am using a JAR package from an online source that is Java 6 compatible and am trying to integrate it into Eclipse Mars with Java 8 installed.
A few items to check, under Project settings: (most of these can be set workspace-wide as well)
Java Build Path > Libraries. Replace JRE System Library with a jdk6 execution environment or alternate JRE
Java Compiler > JDK compliance. Set to 1.6
System:
Check Installed JREs and Execution environments. Make sure a JRE is linked to the Execution Environment for JavaSE-1.6 (with the checkbox).
Did you try just adding the external JAR to the project? Most (non-executable) JARs that were originally made for older versions of java should still work today.
To add an external JAR: right-click on your project in the package explorer and go to Build Path >> Add External Archives... then select your JAR from there. Be sure to leave the project set up for JRE8.
The reason that your run button is blocked out when you switched to JRE6 was because Eclipse detected that it was not installed and therefore cannot run it as JRE6.

Eclipse Design Tab detects wrong Java

When I click on the design tab I get this error:
Incompatible Java Versions
Eclipse is running under 1.7, but this Java project has a 1.8 Java compliance level, so WindowBuilder will not be able to load classes from this project. Use a lower level of Java for the project, or run Eclipse using a newer Java version.
I've checked in window>preferences that:
>java>compiler is set to 1.8
>java>installed JREs has a 1.8 JDK as the default
Have I missed something?
looks like JAVA_HOME is set to the java 7 one, will this require a restart?
You're actually executing eclipse with Java 7, you can update JAVA_HOME to point to Java 8, and then restart eclipse (not your computer).

Categories

Resources