How to add java 8 to eclipse - java

I've an old machine running Windows XP 32.
Because Oracle dropped support for WXP 32 bits, I've manually installed the jdk following
the awesome answer here:
installing JDK8 on Windows XP - advapi32.dll error
I've however not added it yet to the JAVA_PATH, which is set to jdk 6. I don't know if it would harm or not to add it as well, but I want to be conservative here because a lot of programs in this machine need jdk 6. I don't want to break anything working now.
I'd like to toy around in eclipse to test the new Java 8 features. I've manually added the new jre 8 in the "Installed JREs" section under window -> preferences. In the compiler combo, the highest level available is 1.7 (installed jdk7 some time ago, this time using the official installer, but I still keep java 6 as the default in the system). I don't see any option to add the new level.
Consequently, when creating a new project using the new JRE, a warning is shown saying:
The current workspace uses a 1.4 JRE with compiler compliance level
1.6. This is not recommended and either the JRE or the compiler compliance level should be changed.
Seems a problem derived from the manual installation of the JDK.
I'm using Eclipse Kepler v4.3.1, but I have also tested this in older 3.x install with identical results.
Any help will be appreciated.

Support for Java 8 in Eclipse Kepler 4.3.2 is described here. This basically says specify
http://download.eclipse.org/eclipse/updates/4.3-P-builds/
as the 'Work with' site on Install New Software and select 'Eclipse Java 8 Support'.
Recent builds of Eclipse 4.4 Luna (since 18 March 2014) have Java 8 support included (but Luna is still under development).
Update:
Eclipse Luna (4.4) was released on 25 June 2014

Related

What glassfish version is suitable for jdk 10

I am trying to setup netbeans 15 for Java development but the glassfish installed could not be added. The wizard asked me to create domain manually on command prompt but while trying to do that I got the error message:
glassfish requires version 6 but your jdk version is 0.
I have ensured my environment variables are well set
It is tricky to ensure that you are using an appropriate version combination of NetBeans, Java and GlassFish. I don't know of any single piece of documentation that helps, but this is what you can do:
Refer to the Release Notes for your NetBeans installation (e.g. Downloading Apache NetBeans 15) to determine which Java versions it supports.
Refer to the Eclipse GlassFish documentation to determine which Java versions GlassFish 6.x supports.
In your case, although you don't mention you GlassFish version, since you are using NetBeans 15 you must use a JDK >= 11. From the Release Notes for NetBeans 15:
The Apache NetBeans 15 binary releases require JDK 11+, and officially
support running on JDK 11 and JDK 17.
So your current NetBeans environment which uses JDK 10 is invalid. GlassFish is not your biggest concern; you need to update NetBeans to use a valid JDK first.
This answer summarizes GlassFish 6.x <=> JDK compatibility. If you are using a GlassFish release < 6 then you must use JDK 8 which is not supported by any recent release of NetBeans.
And regardless of all that, unless you have a compelling reason for doing so, you should stop using JDK 10. It is unsupported, may present security risks, and is definitely problematic for a working NetBeans/Java/GlassFish environment. Once you have installed a valid JDK, also ensure that you remove all traces of JDK 10 from your environment.
One stable combination you might consider is NetBeans 15 + JDK 11 + GlassFish 6.1, but there are plenty of other possibilities.
Update your question if you still have problems after upgrading your JDK.

How to Use Java 8 settings to build project in eclipse 4.18(2020-12)

*Due to some project requirements I "have" to use eclipse 4.18 (2020-12) which uses Java 11 by default and is mandatory to start.
But my entire project is/was written in Java 1.7 earlier. Now , in my mac i have both java 1.8 and 11 installed also my eclipse settings are such shown below.
I have made sure removed all java 11 references in my eclipse and made the project and workspace configure to take the 1.8 jdk and run at 1.7 compiler level.*
but when i run ,project -->clean-->build, i run into the JaxB missing in java 11 ( in java 11 JAXB was removed and my project uses jaxB extensively) This is known.
So i am wondering what am i missing that my projects are still building my project with java 11 and not java 1.7 (using jdk 1.8 configured).
Please help.. stuck on this since some days.
machome
Eclipse Compiler setting-1
Eclipse Setting Execution Envs
Eclipse installed JRE's
Eclipse Project specific setting
Java 11 JaxB error
If Eclipse itself is being run with Java 11, and you have a plug-in installed that has not been properly update to work under Java 11, as it appears, you will need an updated version of that plug-in. Update to the latest "oracle design studio", and if you still see this problem, contact Oracle support.
The latest Eclipse may require Java 11 to run, but it's simple to set up Eclipse projects that use older Java versions. Don't mess with the Java version it uses to start up, as long as that is a proper Java 11 version.
As one commenter mentions, you'll have to have a particular Java distribution configured in "Installed JREs->Execution Environments", and then you'll have to have the project configured to use that Java version symbol, like "JavaSE-1.7".

Which version of Java is supported by Eclipse Helios?

I'm new to Eclipse and Java. Whenever I run the Java program in Eclipse there is a major.minor 52 exception. I want to know which version of Java is supported by Eclipse Helios. My computer is Windows 7 32-bit OS. So I can't download any other version of Eclipse. Please help me with a favorable answer.
The class file major.minor version 52 error means that Java 8 or newer is required.
Eclipse Helios (3.6) is very old (10 years and 14 releases old). It probably doesn't understand anything above Java 6.
There are 32 bit version of Eclipse newer than this.
Eclipse 4.9 (2018-09) was the last 32 bit Eclipse - that supports Java 8.
OK. Lets start with some history.
Eclipse Helios (3.6) was released in 2010. It supported the latest version of Java that was available at the time; i.e. Java 7.
Eclipse Juna (4.4) was the first release of Eclipse to support Java 8 language features.
Java 7 has been end-of-life for a few years now.
Java 8 (the oldest available version of Java with free support) was released in 2014. This corresponds to the classfile version number (52) of the application that you are trying to run.
Java 8 is also that last version of Java for which you can get a Windows 32 bit version from Oracle.
So what can you do?
If you want to run a pre-built Java application which has classfile version 52, you will have to download and install Java 8.
If you are prepared to rebuild the application, then depending on the application you will probably still need to upgrade to Java 8 to do that. (It depends on whether the application uses Java 8 language constructs or library classes and methods that were introduced in Java 8. It is likely that one or both of those is true.)
If you are going to upgrade to Java 8, it would be advisable to Eclipse to (at least) Luna, but you could go all the way to the 2018-03 release ... which is the last version that supported 32bit Windows.
You could probably also run the application from the command line; i.e. without using any IDE at all. But that would apply to a tool that was designed to run as an Eclipse plugin, etc.
But my strongest advice is to get a machine that can run a 64 bit OS. You can probably get one for USD $300 or less. If your current hardware cannot run a 64bit OS, it must be pretty old, and I am surprised that it still works reliably.
Which version of Java is supported by Eclipse Helios?
Java 7 and earlier versions.
So I can't download any other version of Eclipse.
That is not true. But simply upgrading Eclipse won't solve the problem. You need to upgrade Java as well if you want to run that application.

JDK 1.8 not supported by vs code?

Does VS Code (code-runner extension) support JDK 1.8? In the morning I was using JDK 12 , but then I downgraded to JDK 1.8 to try out applet viewer and stuff. Unfortunately now it doesn't even highlight the code.
Someone please tell me the problem and its solution.
JDK 1.8 is supported by VSCode.
Read https://code.visualstudio.com/docs/languages/java and install needed extensions.
Update 2021
Currently to use the Java extension in VSCode its required JDK 11, but you can still use older versions of JDK in your projects. See this to get information about how to configure other JDK version for your project.
Java 1.8 was no longer supported since "Language support for Java" extension upgrade to 0.68.0, I downgraded to 0.64.1 which works for me.
As stated here:
Note: Although the Java language server requires JDK version 11 or above to run, this is NOT a requirement to your project's runtime.
This means that you need to have JDK 11 or higher installed. You can also install older JDKs and configure the runtimes. Just open the Command Palette (Ctrl+Shift+P) and type the command Java: Configure Java Runtime. If you have JDK 8 installed and have properly configured maven or gradle, this isn't even necessary. Visual Studio Code will correctly pick up the correct JDK.
VS Code no longer supports JDK 1.8. The "Java Extension Pack" relies upon "Language Support for Java(TM) by Red Hat" which documents Java 11 is the minimum requirement. See here: https://marketplace.visualstudio.com/items?itemName=redhat.java
Tis unfortunate, guess I'm switching back to eclipse

Netbeans and JDK 10

I have been using Netbeans upto 8.2 for several years. But now I have installed JDK 10 and was forced to migrate to Eclipse. But I do not feel very comfortable. I would like to go back to Netbeans.
Does Netbeans support JDK version 10 now? I mean July, 2018.
Yes, NetBeans supports Java 10, but there are several important caveats to be aware of:
NetBeans 8.2 does not support Java 10. It just won't work.
NetBeans 9 supports Java 10. It was released yesterday (July 29, 2018).
NetBeans 9 only officially supports Java SE. Some options (plugins) available on NetBeans 8.2 are not provided on NetBeans 9 by default, such as Java EE and C/C++. However, there is a way to add those options (at your own risk). See this answer to How to get Netbeans 9 to deploy a valid webapp on Tomcat for details. Also see What's Happened to My Favorite NetBeans Plugins?
Notes:
NetBeans 8.2 is an Oracle product, but they are in the process of handing the NetBeans components over to Apache, and NetBeans 9 comes from Apache. The transition explains why many plugins are not available in the initial release of NetBeans 9, but they will become available in coming releases.
The NetBeans 9 download is in the form of a single zip file for all operating systems. Just unzip to a folder, then locate and run netbeans64.exe (or netbeans.exe for 32-bit).
Updated to add further notes:
You can safely install and run NetBeans 8.2 and NetBeans 9 concurrently.
The default platform for NetBeans 9 is still Java 8. You must explicitly add JDK 10 as a platform: Tools > Java Platforms > Add Platform...
To create a Java 10 project, open the project's properties and ensure that the following are set:
Properties > Libraries > Java Platform: JDK 10
Properties > Sources > Source/Binary Format: JDK 10
An easy way to verify that JDK 10 is set up correctly is to create a trivial Java application and put this code in the main() method: var v = 123; System.out.println("v=" + v); If that compiles and runs you are fine (and vice versa).
Netbeans 9 started working for me after I moved to JDK 10.0.2 instead of 10.0.1 ..... may be it will help guys who are struggling like me.
Enjoy.

Categories