I am a regular IntelliJ user, but most of my co-workers use Eclipse. A lot of them say the latest version of Eclipse "2020-09", which requires a JRE "higher than Java 8" in order to run, cannot be used to develop projects requiring JRE8.
This is pretty surprising to me, since I know it is possible to install multiple JDKs and JREs on one machine, I've done it plenty of times.
What is the typical way a person would configure Eclipse 2020-09 (already installed) to work on a project that requires a Java 8 JRE?
JRE 8 apps in eclipse workspace is possible by having the jre 8 jdk. It is true that in order to use eclipse 2020-09 you need java 11+ jdk/jre, but making projects that support jre 8 is still possible.Even I still use 2020-06 and before. Here is a method you could use to get JRE 8 implemented back in your project. Although you can change the defaults, this one will help you change the environment back to java 8 for 1 project.
Right click the library named somthing like "JRE system library[JavaSE-11]". Press properties. This is what you will see JRE System Library chooser image
Choose "Alternate JRE" then click "Installed JREs"Step Image
Press "Add" then you will see 3 options. Choose standard VM. Find your java 8 jdk directory. Usually it is something like C:\Program Files\Java\jdk1.8.0_251.
You can configure the default arguments for your jvm runtime. Then simply hit ok,select the jdk-8 library and close it. Then choose alternate jre again and in the drop-down choose jdk-1.8.0 or some name like that. This will only work if you also have java 8 installed alongside java 11 that is configured properly JDK
You can use Java 11 to start the Eclipse 2020-09 and configure a project to compile with Java 8. The problem is if you want a Eclipse plugin that uses CORBA for example. This module was removed from Java 11 earlier. In this case, I recommend to use Eclipse 2020-06.
Earlier versions of 2020-09 was working with Java 8. I had it, too. Then I updated and I got the same error message like you.
I propose to use an older one or to install JRE 11 and set the JAVA_HOME env variable to it.
The inside the IDE you can set java 8 like an JDK and develope your project with Java 8 while eclipse is running with 11.
Related
I removed java-11 and installed jdk-1.8. Now when I try to start eclipse then its throwing the following error:
Being a beginner I searched and found some solutions but not worked for me
Ok. I'm going to make some assumptions based on some implications of what you've said here.
I assume that you had Java 11 installed, and you had installed Eclipse, and it was working.
You then, for some reason that I can't understand, decided to uninstall Java 11 and replace it with Java 8.
The error message is because when you had Java 11 installed and you installed Eclipse, Eclipse stored the path to the Java 11 distribution in the "eclipse.ini" file. Now that Java 11 is gone, it cannot start up.
The easiest way to fix this is to reinstall Java 11, and hopefully it will install into the same location as that error message shows it is looking for it.
Now, to address why you might have thought to replace Java 11 with Java 8. I'm guessing you're working on an application that requires Java 8 to compile and run. In this context, it's somewhat understandable that you would have done what you did, but it was the wrong thing to do.
Eclipse can run with one Java version, but build and run applications with a different Java version. In fact, I think it's generally a good idea to run Eclipse with the newest version of Java it can run (generally about a version short of the latest), but build your applications with the version of Java required for those applications.
So, you should have both Java 11 (or newer) AND Java 8 installed. Run Eclipse with Java 11, and build and run your applications with Java 8. In Eclipse, you have to register the Java 8 distribution in "Installed JREs" in Eclipse preferences, and also record that Java distribution in the "JavaSE-1.8" Execution Environment, in the preferences tab right below "Installed JREs". Set your application to require "JavaSE-1.8".
I had java version 8 previous and my eclipse worked just fine. But now I have java version 7 and I can't open eclipse on my computer. What should I do? please help.
I think there are two options:
Upgrade to Java version 8 (or newer).
If you can't do that, downgrade to a version of eclipse that supports Java 7. eclipse 4.5 (Mars) (or earlier as noted on the linked page), as of eclipse 4.6 (Neon) Java 8 is required.
I feel I should note that newer versions of Java (and eclipse) can still target Java 7 (and many earlier versions).
But now I have java version 7 and I can't open eclipse on my computer. What should I do?
Use versions that work together. When you for example look at your second screen shot, it says something like "requiredJavaVersion=1.8" or so.
In other words: you can't just come in and run eclipse with any version of java.
The other answer gives you the required details.
And a final note here: in case you tried to start eclipse with that older JVM in order to "allow" to ensure that eclipse won't allow "java 8" stuff in a project: that isn't the right way then. Instead: eclipse allows you to "define" JDKs to be used for your project. So you can easily tell eclipse: "I have a Java7 jdk sitting here, please use that for project X".
You do not need to run eclipse itself with a Java7 JVM in order to use a Java7 JDK for an eclipse project!
There will be a file under the Eclipse installation directory named as eclipse.ini.
It will launch the eclipse for that specific jdf and you can change the path to your jdk7.
Hope it helps.
It depends basically on which version of the eclipse you have.
If you have eclipse 4.6(Neon) or the latest version, then you must need a newer JDK version of Java (>=1.8 which you need to download). Or If you want to roll back to an older version of Eclipse then consider downloading eclipse 4.5(Mars).
Or If you have an eclipse version of 4.5(Mars) or older then see in eclipse.ini
-Dosgi.requiredJavaVersion = 1.8 and change it to -Dosgi.requiredJavaVersion = 1.7 which can be found in the folder containing eclipse.exe file.
How can I change the Projects Runtime Platform?
(standard NetBeans [8.1] Java Project [Java Application])
Details:
using Ubuntu with NetBeans 8.1
I have installed JDK 1.6, JDK 1.7 + JDK 1.8
My projects platform is Java 6.
My systems default Java is Java 7.
NetBeans-IDE was started with Java 8.
When I run the project via the IDE (Run project), the Project-Platform is used (which is Java 6).
I cannot change the Runtime Platform!
It's always: Project Platform
I tried to Manage Platforms..., but I still can't change the value of the Runtime Platform-ComboBox.
EDIT:
As I wrote in the comments, I don't want to change the Project-Platform.
The project should be compiled with Java 6 but run with Java 8 (when click on Run project).
What I want is:
Project-Platform = Java 6 (used to compile),
Runtime-Platform = Java 8 (used to run).
How can I change the Projects Runtime Platform?
Unfortunately you can't. As you point out, its value can only be Project Platform. Of course that invites the question "What is the point of even having that Runtime Platform field?".
I suspect that it may have been (unwisely) added to the GUI so that at some time in the future it will be possible to actually select a different JDK to run against. There is an open Bug Report for this: Bug 186747 - Can't Build and Run with Different Java Versions.
It's also worth noting that the Help documentation for the Run screen does not mention that Runtime Platform field. My own view is that the field should be removed until it serves a useful purpose.
What I want is: Project-Platform = Java 6 (used to compile),
Runtime-Platform = Java 8 (used to run).
Unfortunately that can't be done, as shown by the open bug. The best you can do right now is:
Create platforms for JDK 6 and JDK 8 in NetBeans.
Set the Java Platform to JDK 1.6 on the Libraries screen, and set the Source/Binary Format to JDK 6 on the Sources screen, then build to verify that no invalid APIs are being used.
Switch the Java Platform to 1.8 on the Libraries screen to run your 1.6 code under 1.8.
I realize that you don't want to do that, but unfortunately there's no silver bullet in the current release of NetBeans (8.2).
An alternative approach would be to build and run using only JDK 8, but include the Animal Sniffer Maven plugin "for checking projects against the signatures of an API", to verify that your 1.6 code was not using illegal APIs. But of course that's only viable for Maven projects.
Please look at Netbeans Project Setup - Setting the Target JDK in a Project
You just have to change the Runtime Platform at the Libraries option, that's all.
Just went through this pain for Apache NetBeans 14. I was trying to set a remote debug for a Raspberry Pi.
It works only if the jdk match on both the local and remote versions. In my case I set them both to 17.
I would have expected that the default jdk on the local machine should have been able to be changed but I fail to determine how.
I am running Ubuntu on the local machine so maybe the platform cannot be changed (don't know). Moving on.
Changed runtime platform
May be its a newbie question...
I want to use latest eclipse available. It requires Java 8. However, our company uses java 6 for all projects.
So:
Should I download eclipse that is compatible with Java 6 only ?
or I can configure Java 6 for all the projects regardless what eclipse uses?
Would there be any issues, if its possible to use two versions (one for eclipse and another one for project)?
I know its a newbie questions. But the search did not yield a proper response.
no, you can use the latest Java for Eclipse. The JDK used for project can be configured per project or per workspace. You can install as much JDKs as you desire. i.e. You can start Eclipse using a 32Bit JDK while using a 64Bit JDK for Java EE-Servers or Projects, it has basically nothing to do with the JRE used for Eclipse. You just need to set it up.
As we know, we are in transition between Java 7 and Java 8. I have both Java 7 and Java 8 JDK installed. However in the interests of keeping a hands-off approach I want to make java 7 JDK my default Java build environment.
Leaving Java 8 JDK installed for trials, testing, and migration.
However at the current time, Netbeans 8 insists that Java 8 is-the default.
What I'd like to set: Java 7 is default.
And only specify Java 8 on a per-project basis until I'm satisfied with the new build. At that point, I imagine we would change our default Java. The challenge is that there's no clear way to change a default Java configuration.
This is not helped by the fact that the "Java Platform Manager"is not part of "Options", and lives on the Tools menu / "Java Platforms. I have been able to to this successfully with IDEAJ when moving from Java 6 to Java 7. Everyone is using Netbeans on this project so we need to achieve the same end with Netbeans. To be clear, I'm comfortable using Java 8 for the Netbeans runtime. It is just project builds that I want as a specific Java 7 target environment.
According to the topic below: In NetBeans how do I change the Default JDK?, changing NETBEANS_JDKHOME will also change my netbeans running environment. So I would prefer to just set the build-target generally. Thanks in advance!
see also:
In NetBeans how do I change the Default JDK?
Netbeans v8 README: "nbjdk.active [since 5.0u1] - name of a Java platform (JDK) to use when building and running".
If I understand you question properly, each project can be assigned it's own Java Platform property, for example, right click the project in question and select "Properties"...
From the properties dialog, select "Libraries" and then select the "Java Platform" you want to use...
Personally, I find having the platforms pre-configured simpler.
If you're upgrading a project, you may also need to check the "Source/Binary Format" property in the "Sources" sections (it's own the bottom), as it will stay at the level of the old version of Java (if you downgrade, it adjusts automatically)
One solution is to change the netbeans configuration file netbeans.conf with is located in ...\NetBeans 8.0\etc.
But it does not work well...
The bypass we found is to spefify the jdk in the shortcut that launch Netbeans into
"...\NetBeans 8.0\bin\netbeans.exe" --jdkhome "C:\Program Files (x86)\Java\jdk1.7.0_60"