Programmatically configure Eclipse Installed JREs - eclipse

I want to configure my Eclipse environment to use the JDK instead of the standard JRE. I'm doing this because I use m2eclipse, which requires tools.jar from the JDK to run.
I'm running Eclipse 3.5.1 on Windows 7 32-bit with JDK 1.6.0_16.
On my system, I have the JDK installed to "C:\Program Files\Java\jdk" (symlink to the latest install).
I add the -vm option to eclipse.ini to point to the JDK
-vm
C:/Program Files/Java/jdk/bin
I've confirmed that eclipse is in fact starting with the desired JVM. In the configuration details
eclipse.vm=c:/Program Files/Java/jdk/bin\..\jre\bin\client\jvm.dll
Additionally, in my environment,
JAVA_HOME=c:\Program Files\Java\jdk
However, in Window | Preferences | Java | Installed JREs, the only JRE listed is the one in "C:\Program Files\Java\jre6". This JRE ends up being the one under which Maven is run, and so my maven builds fail.
I know I can manually change the Installed JRE to point to the JDK, and this is what I've done in the past. However, I'd like to find a way to script this change so that I can automate the installation of a dev environment.
Where is this setting stored? What is the best way to automatically configure Eclipse to use the JDK as the only Installed JRE?

The setting is stored in
<workspace>\.metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.jdt.launching.prefs
I would recommend setting your JDK manually in Preferences / Java / Installed JRE, as well as Preferences / Java / Installed JRE / Execution Environment.
Then, whenever you need an eclipse with that exact configuration, just copy over this file with your preset config file, and launch that eclipse.
Extract from that config file:
org.eclipse.jdt.launching.PREF_DEFAULT_ENVIRONMENTS_XML=
<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?>
<defaultEnvironments>
<defaultEnvironment environmentId\="JavaSE-1.6"
vmId\="57,org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType13,1255369536255"/>
</defaultEnvironments>
eclipse.preferences.version=1
org.eclipse.jdt.launching.PREF_VM_XML=
<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?>
<vmSettings defaultVM\="57,org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType13,1255369536255">
<vmType id\="org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType">
<vm id\="1255369536255"
javadocURL\="http\://java.sun.com/javase/6/docs/api/"
name\="jdk1.6.0_16" path\="C\:\\Prog\\Java\\jdk1.6.0_16">
<libraryLocations>
<libraryLocation jreJar\="C\:/Prog/Java/jdk1.6.0_16/jre/lib/resources.jar"
jreJavadoc\="http\://java.sun.com/javase/6/docs/api/"
jreSrc\="C\:/Prog/Java/jdk1.6.0_16/src.zip"
pkgRoot\=""/>

Related

version 1.7 of the jvm is not suitable for this product. version 1.8 greater is required for eclipse nano in window

I am trying to launch Eclipse Nano in Windows 7, but getting the error:
Version 1.7 of the JVM is not suitable for this product. version 1.8 greater is required for Eclipse Nano in Windows
I already have Java 8 installed on the system
Simply download 1.8 JDK from Java SE Development Kit 8 Downloads install it, then copy the jre folder & paste it in:
"C:\Program Files (x86)\EclipseNeon\"
Then rename the folder to "jre", start the eclipse again it should work.
sudo /usr/sbin/update-alternatives --config java
and select the jvm 1.8
I faced the same issue (Windows 10). You need to set the "JAVA_HOME" system environment variable to point to JDK 8 folder and edit the "Path" system environment variable to have a new path to JRE 8's bin folder, this should be at the top of the list.
I too got the same error while installing
Possible reason for the error - The eclipse version, you are installing and the Java version should be of same bit, i.e. either 32 bit or 64 bit
Solution: I have downloaded both the java for 64 bit and 32 bit and installed, now my problem is gone.
Please let me know if it works for you.
When you download the latest eclipse, and extract it, you can find the folder named eclipse-installer with eclipse-inst file inside it. Instead of double-clicking it to start installation, just navigate to the folder in terminal and run ./eclipse-inst command. It does the entire installation for you. It worked for me and hope who also got the same problem(version 1.7 of the jvm is not suitable for this product. version 1.8 greater is required) gets solved. :)
On a Windows system I had the same problem.
Although I had only Java 1.8 installed, I found that I also had a 1.7 upgrade file installed too (which didn't get uninstalled automatically when I installed 1.8).
Uninstalling this upgrade file allowed me to install Eclipse IDE.
I had the same issue and I had a different solution to this problem.
Though I set the JAVA_HOME to 1.8 (Both through CMD and environment variables), the error was persisting.
So I opened CMD prompt, typed:
java - version
to find out 1.7 was the version my system was set to. Until then I had no clue from where it was fetching this version.
And then I changed it to 1.8 using this command:
set path=C:\.....eclipse\jdk1.8.0_141-b15\bin
AND IT WORKED!
Recheck if it is set to 1.8 with the same command:
java -version
You should be good to go now!
if it's a 64-bit Eclipse. You'll need to explicitly download and install the 64-bit Java 8 or later.
download it from here
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
tips for windows users
Version 1.7 of the JVM is not suitable for this product. version 1.8
greater is required
user get above error message because they had multiple jdk version or they do not have latest version of jdk installed , even if you install latest version of jdk and you if you have not removed old version of jdk like 1.7 you will get the above error message , so better to get rid of old version of jdk and jre etc.
-> ignore this step if you have insallted latest version of jdk already
download 32 or 64 bit latest jdk from : https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
-> go to C:\Program Files\Java and look for old version of jdk , let say if you have 1.7 versions of jdk delete them so that you are left only with latest version , you can remove old versions of jre too here just by deleting.
-> next run eclipse you will not get v1.7 message
Find the JVM
If a JVM is installed in the eclipse/jre directory, Eclipse will use it; otherwise the launcher will consult the eclipse.ini file and the system path variable. Eclipse DOES NOT consult the JAVA_HOME environment variable.
To explicitly specify a JVM of your choice, you can use the -vm command line argument:
eclipse -vm c:\jre\bin\javaw.exe ''start Java by executing the specified java executable
eclipse -vm c:\jre\bin\client\jvm.dll ''start Java by loading the jvm in the eclipse process
Go to Eclipse directory, find and open eclipse.ini configuration file then modify below parameter to your desired version, it will work.
-Dosgi.requiredJavaVersion=1.8
It worked for me
Eclipse will consider the version that is mentioned in eclipse.ini file, this error
means that your installed java version (in environment variable) and the mentioned java
version in eclipse.ini file is not matching.
You may just change the java version there (it will be in eclipse-installation-dir).
Change the property as below:-
-Dosgi.requiredJavaVersion=
Updating below line in eclipse.ini worked for me
-Dosgi.requiredJavaVersion=1.8
Two things:
Check this question here as it's similar and has some good pointers Eclipse - no Java (JRE) / (JDK) ... no virtual machine
Also, get the latest JRE and JDK from Oracle vs from java.com http://www.oracle.com/technetwork/java/javase/downloads/index.html
Today I meet the same question. I download the file that named "eclipse-inst-linux64.tar.gz". When I open the eclipse, it shows "Version 1.7.0_121 of the JVM is not suitable for this product. Version: 1.8".Then execute
cd /usr/bin/
sudo ln -s /Your_JAVA_PATH /usr/bin/java
Then you can install eclipse.
Make sure java and eclipse versions are same(32bit or 64bit)
Try running eclipse-installer as administrator(this worked for me)
If you need to skip this step just simply change Required Version number, ex:
open with any text editor instalation path/AptanaStudio3.ini
and change
-Dosgi.requiredJavaVersion=1.8 to -Dosgi.requiredJavaVersion=1.7
This is just for skipping this step.
I had both 1.7 and 1.8 in path and 1.7 was on top and 1.8 below in Pah, so i moved 1.7 below 1.8, thats it it worked.
Go to Oracle's website and download the newest version of Java JDK. (https://www.oracle.com/java/technologies/javase-downloads.html)
Install the program on your computer.
Remove all old environment variables related to Oracle and Java.
Set the environment variables related to the new installation all the way to the bin folder. (include the bin folder in the environment variables section)

Eclipse (No JVM was found)

Eclipse gave me an error specifying that no JRE is installed while I was trying to configure Erlide in eclipse.
I added path to erlang directory in 'System Variables'. Then I installed erlang plugin for eclipse, added erlang installation directory path in Eclipse preferences and restarted Eclipse.
After restarting eclipse started giving me error about JRE.
Below steps might help you to solve your problem.
Install JDK and JRE - Here are step by step Instructions OR ANOTHER
Verify you setup JAVA_HOME and JRE_HOME and PATH into environment variable.
You can also investigate your Java version via Command Prompt:
Open a Command Prompt (Navigate to “Start” => “Run” and type “cmd”)
Then enter the following command:
java –version
If you don't see your java version you have to follow step 1 carefully again
Installed eclipse/ if already installed open the same. Here are step by step Instructions
NOTE: Make sure that you have same bits for both JDK and EClipse (32 or 64). One way is to verify in your ini file.
To develop a Java program, you need a JDK not only a JRE.
Do you have a JDK installed? Have you tried to run jar, $ set | grep "JAVA_HOME" (Linux) or C:\> set | find "JAVA_HOME" (Windows) in your command prompt to see if you have Java configured in your machine?
Once you install your JDK you need to set this environment variable.
Maybe Earlide is not compatible with your JDK 1.8, can you try with jdk 1.6

What To Add In Config.ini File In Java RCP Application To Take JRE 1.6?

I have multiple JRE installed in my machine (Jre 1.6 and Jre 1.7). I build my application with Jre 1.6.
But When I launch my java RCP application, it always takes Jre 1.7.
Can I add something in my config.ini file to always make it launch with Jre 1.6 ?
Can I make it take Jre 1.6 as Jre 1.6 is used to build the code ?
you have to use -vm option in eclipse.ini as below.
-vm
jre6/bin/javaw.exe
User can also change the path information with the absolute location of other JDK/JRE installed under his local system.
For e.g. in Windows we can have
-vm
C:/Java/JDK16/bin/javaw.exe
for more help see the link.

Get Eclipse IDE to show version of Java RE it's using

I've just installed proper JRE rather than the OpenJDK, I was wondering if there is an easy way to find out which RE Eclipse is using? Maybe in a help menu or something.
Thanks
Go to Window > Preferences > Java > Installed JREs. The checked JRE is the one which Eclipse uses by default. This JRE is used to compile and run the code.
The JRE used by Eclipse to run itself is the either the one specified in the eclipse.ini or the java executable in your system path. From the Eclipse docs:
Find the JVM
If a JVM is installed in the eclipse/jre directory, Eclipse will use
it; otherwise the launcher will consult the eclipse.ini file and the
system path variable. Eclipse DOES NOT consult the JAVA_HOME
environment variable.
To explicitly specify a JVM of your choice, you can use the -vm
command line argument:
eclipse -vm c:\jre\bin\javaw.exe ''start Java by executing the specified java executable
eclipse -vm c:\jre\bin\client\jvm.dll ''start Java by loading the jvm in the eclipse process
If you want to know what JDK is being used to execute Eclipse: Help, About Eclipse SDK, Installation Details, tab Configuration
Sure. Go to Window/Preferences/Installed JREs, then choose one that you prefer.
You can also choose JRE on project level. Open project properties and choose "Java compiler". Then you can configure different JRE for specific project.
I assume you want to know which version Eclipse uses to execute itself.
It would simply run with the same JRE that would execute when you issue java from command line.
You can modify -vm param in your eclipse.ini file to run with some other JRE e.g.:
-vm
c:/Java/jdk1.6.0_16/bin

Point eclipse IDE to use another JRE / JDK other than one specified in JAVA_HOME

I am having two JRE / SDK in my development environment, however it was necessary in my situation to set JAVA_HOME to 1.4.2, this is causing my eclipse IDE to stop running as it required 1.6 and above.
May i know how i can modify eclipse ini or environment home to use my other 1.6 installation?
Please try the eclipse.ini entry above the varargs (the following two lines must be two lines in the eclipse.ini file)
-vm
C:\Java\JDK\1.5\bin\javaw.exe
Find the JVM
Right click the project in Package Explorer -> Configure Build Path
Add Library -> JRE System Library
Set JRE system library to JDK
Verify JDK is the reference library
From the menu in the top.. Proceed as follows--
Project-->Properties--> Java Build Path--> Libraries--> JRE System Library.
Now click Edit . Select Alternate JRE. Click Installed JRE. Provide path to your other JDK. Then FINISH.
That's it.