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
Related
In my installation of Eclipse IDE (Mars 4.5) it has not automatically linked rt.jar and jfxrt.jar to src.zip and javafx-src.zip. I know how to do this manually by browsing to the .zip files within the JDK installation.
What I want to know is if there is a way to ensure this happens automatically when installing Eclipse / Java. I'm pretty certain I know someone who didn't link to the source manually and it is linked on their installation.
For example, if you install the JDK before Eclipse, or vice-versa, does this make any difference?
Also, when you make the link, where abouts is the preference information stored on the file system - is it somewhere within the same folder that eclipse.exe exists?
To make sure that Eclipse is running in your JDK instead of a JRE (The JDK installation typically puts a JRE on the system executable path), you should always specify it via eclipse.ini. The -vm option described there tells Eclipse exactly what JVM you want it to run in.
Another option is to add the JDK to the Installed JREs section of your Eclipse preferences and set that as the default for all projects. The default JVM used for projects is the same as the one Eclipse itself runs in, so you don't necessarily need to do both.
Once you have the JDK set as the default JVM, you can open a project's Properties, select Java Build Path section, then look at the Libraries tab. You should see your JDK as the JRE System Library, including its rt.jar and corresponding source attachment. Like this:
I am trying to use Eclipse on a friends computer but we keep getting this when we run Eclipse
We have the environmental variable set as well.
Edit
it was working before he installed the black berry plug in.
The variable JAVA_HOME is not required by Eclipse. If your Java installation does not put the Java executables in the PATH, you should add those manually.
A faster way to have your Eclipse up and running consists in modifying the eclipse.ini and using the -vm option.
http://wiki.eclipse.org/Eclipse.ini#-vm_value:_Windows_Example
I had the same problem. For me, I needed the JDK. So I had to install the JDK. It should match the build platform that is, 64bit vs. 32bit windows. After that, I removed, the -vm line from the eclipse.ini file (the suggested fix). It was giving me the "Can't create virtual machine" error. The current release of JDK is version, 7 whereas the Android Developers Toolkit version of eclipse is currently based on JDK 6. But it seems to work. Eclipse came up and is functional. Haven't actually written a program yet.
Go to eclipse folder (where eclipse is installed) and open eclipse.ini file in your editor and add the following code after openFile tag.
-vm C:\Program Files\JDK6\bin\javaw.exe
That's all.
I had a similar problem, since our Java and JDK is consistently updated by our service desk, including uninstalling old JDKs. They take care of the PATH for us, but then the JRE that Eclipse was used to "seeing" was gone. So, the thing that has worked best for me is to modify the shortcut's "target" from:
"C:\Program Files\Eclipse\Eclipse IDE for Java EE Developers\eclipse.exe"
to
"C:\Program Files\Eclipse\Eclipse IDE for Java EE Developers\eclipse.exe" -vm "C:\Program Files\Java\<jdkver>\jre\bin\javaw.exe"
That will point Eclipse toward to the JRE in the JDK you want it to use, and then you can update that shortcut when your JDK updates.
This is on Windows 64bit, obviously.
It can also happen on mismatch of JAVA and Eclipse bit version.
for eg:
If in your System java is 32 bit and you are trying to install Eclipse of 64 bit then the same situation might occur.
Because Eclipse will look Java in Program Files while at the same time Java may be present in Program Files (x86).
So in this case eclipse will not get java and throw the same error.
While installing eclipse, Jre missing :
I solved my error as follows:-
This error may comes if you have 2 program files folder in your system.
"Program files" &
"Program files x86".
Please install JDK&JRE in the "Program files" folder.
Hope your jre missing error get solved.
this works for me:
open eclipse.ini file in your editor and add the line: -vm C:\Program Files\JDK11\bin\javaw.exe
update system PATH with correct JDK path.
Downloaded latest eclipse for Java EE
Opened... error .. opening...JRE/JDK must be available for running eclipse..
Unlike normal my java is installed in G:/
Do I have to make any changes to ecplise.ini in -vm tag ?
Like adding java jdk bin path ?
Did not work somehow !
Any idea ?
Eclipse looks at PATH variable for choosing which JRE to use, if that is configured eclipse will work correctly, if you don't have or want to point eclipse to a specific Java Installation then you can provide following argument in eclipse.ini
-vm
G:\Java
You can see different runtime options available here.
You can start Eclipse by running eclipse.exe on Windows or eclipse on other platforms. This small launcher essentially finds and loads the JVM. On Windows, the eclipsec.exe console executable can be used for improved command line behavior.
Alternatively, you can launch Eclipse by directly invoking the JVM as follows:
java -jar eclipse/plugins/org.eclipse.equinox.launcher_1.0.0.v20070606.jar
NOTE: The version of org.eclipse.equinox.launcher in the above command must match the version actually shipped with Eclipse. For more details on launching Eclipse using Java (not eclipse.exe) with the launcher, see Starting Eclipse Commandline With Equinox Launcher.
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
See the launcher page for more details on specifying a JVM.
eclipse.ini
The most recommended way to specify a JVM for Eclipse to run in is to put startup configuration into the eclipse.ini file in the same folder as the Eclipse executable (eclipse.exe on Windows). The Eclipse program launcher will read arguments from either the command-line or the configuration file named eclipse.ini. To specify a JVM using configuration file, include the -vm argument in eclipse.ini, for example:
-vm
c:/jre/bin/javaw.exe
Note: there are no quotes around this path as would be required when executing the same from the command-line were the path to contain white space, etc. This is a common mistake when using Windows.
Eclipse now will launch without additional arguments in the command-line, with the JVM specified in the eclipse.ini configuration file.
You should always use -vm so you can be sure of what VM you are using. Installers for other applications sometimes modify the system path variable, thus changing the VM used to launch Eclipse without your knowing about it.
The format of the eclipse.ini file is very particular; it is strongly recommended to read eclipse.ini and follow the examples there.
When Eclipse starts, you are prompted to choose a workspace location on start-up. This behavior can be configured in the Preferences. You can manually specify the workspace location on the command line, using the -data command-line argument.
OLD: Starting Eclipse 3.2
In Eclipse 3.2 and earlier, there was an additional file in the root of Eclipse: startup.jar. This jar file contained the classes needed to start the platform. In 3.3 and above the equivalent classes are in the org.eclipse.equinox.launcher bundle.
To start 3.2 by directly invoking the JVM use the following command:
java -cp eclipse/startup.jar org.eclipse.core.launcher.Main
Eclipse 3.2 did not contain a console version of the executable.
OLD: Oracle/Sun VM 1.6.0_21 on Windows
The Eclipse 3.3 - 3.6 launchers for Windows had a problem with the Oracle/Sun Java VM version '1.6.0_21-b06'.
UPDATE: Oracle/Sun have released a respin of their JDK/JRE to fix this, so the recommended resolution of this problem is to download and re-install version 1.6.0_21-b07'. Make sure you have b07 or higher by running java -version.
Before the fix was released, there were three choices to work around this:
1----switch back to '1.6.0_20' (as of July 19, 2010 it can still be downloaded here)
Change the commandline for launching or add the following line after "-vmargs" to your Eclipse.ini file:
-XX:MaxPermSize=256m
(Detailed instructions/examples)http://wiki.eclipse.org/Eclipse.ini
2----For 32-bit Helios, download the fixed eclipse_1308.dll and place it into
(eclipse_home)/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.0.v20100503(https://bugs.eclipse.org/bugs/attachment.cgi?id=174640)
{The Java bug was closed for voting and comments at 6969236 on the Java BugParade because the change has been reverted; the related Eclipse bug report is open for voting and comments at bug 319514.}
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.
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\=""/>