Difference between revisions of "FAQ How do I run Eclipse?"

From Eclipsepedia

Jump to: navigation, search
(Oracle/Sun VM 1.6.0_21 on Windows)
m (eclipse.ini)
 
(23 intermediate revisions by 11 users not shown)
Line 1: Line 1:
== Oracle/Sun VM 1.6.0_21 on Windows ==
+
== Starting Eclipse ==
The Eclipse 3.3 - 3.6 launchers for Windows have a problem with the Oracle/Sun Java VM version '1.6.0_21'. You have three choices to work around this:
+
<ol>
+
<li>switch back to ''''1.6.0_20'''' (as of July 19, 2010 it can still be downloaded [http://java.sun.com/javase/downloads/widget/jdk_javafx.jsp here]</li>
+
<li>For Helios, download the fixed [https://bugs.eclipse.org/bugs/attachment.cgi?id=174343 eclipse_1308.dll] and place it into<br/><tt>(eclipse_home)/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.0.v20100503</tt></li>
+
<li>For older Eclipse versions, change the commandline for launching or add the following line after "-vmargs" to your <tt>[[eclipse.ini]]</tt> file:<br/>
+
<tt>-XX:MaxPermSize=256m</tt><br/>
+
([[eclipse.ini|Detailed instructions/examples]])</li>
+
</ol>
+
  
The bug itself is open for voting and comments as [http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6969236 6969236] on the Java BugParade, and as {{bug|319514}} on the Eclipse side.
+
When you unzip Eclipse, the directory layout looks something like this:  
 
+
<pre>   eclipse/
== Eclipse 3.3 ==
+
When you unzip the Eclipse SDK, it creates a base install directory called <tt>eclipse</tt>.
+
The directory layout looks something like this:
+
<pre>
+
  eclipse/
+
 
       features/ ''the directory containing Eclipse features''
 
       features/ ''the directory containing Eclipse features''
 
       plugins/ ''the directory containing Eclipse plugins''
 
       plugins/ ''the directory containing Eclipse plugins''
Line 25: Line 12:
 
       notice.html
 
       notice.html
 
       readme
 
       readme
</pre>
+
</pre>  
You can start Eclipse by running <tt>eclipse.exe</tt> on Windows or <tt>eclipse</tt>
+
You can start Eclipse by running <tt>eclipse.exe</tt> on Windows or <tt>eclipse</tt> 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.  
on other platforms. This small launcher essentially finds and loads the JVM that is on your PATH.
+
On Windows, the eclipsec.exe console executable can be used for improved command line behaviour.
+
  
Alternatively,
+
Alternatively, you can launch Eclipse by directly invoking the JVM as follows:  
you can launch Eclipse by directly invoking the JVM as follows:
+
<pre>   java -jar eclipse/plugins/org.eclipse.equinox.launcher_1.0.0.v20070606.jar
<pre>
+
</pre>  
  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]].
</pre>
+
  
'''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 3.3 launcher, see [[Starting Eclipse Commandline With Equinox Launcher]].
+
== Find the JVM ==
  
=== Starting Eclipse 3.2===
+
If a JVM is installed in the <tt>eclipse/jre</tt> directory, Eclipse will use it; otherwise the launcher will consult the eclipse.ini file and the system path variable. Eclipse '''DOES NOT''' consult the <tt>JAVA_HOME</tt> environment variable.  
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 the equivalent classes are in the org.eclipse.equinox.launcher bundle.
+
  
To start 3.2 by directly invoking the JVM use the following command:
+
To explicitly specify a JVM of your choice, you can use the <tt>-vm</tt> command line argument:  
<pre>
+
<pre>   eclipse -vm c:\jre\bin\javaw.exe              ''start Java by executing the specified java executable
    java -cp eclipse/startup.jar org.eclipse.core.launcher.Main
+
  eclipse -vm c:\jre\bin\client\jvm.dll        ''start Java by loading the jvm in the eclipse process
</pre>
+
</pre>  
Eclipse 3.2 did not contain a console version of the executable.
+
See the [[Equinox Launcher#Finding_a_VM.2C_Using_JNI_Invocation_or_Executing_Java|launcher]] page for more details on specifying a JVM.  
  
== Find the JRE ==
+
== eclipse.ini ==
If available under the <tt>eclipse/jre</tt>  directory, the Eclipse JRE will be used;
+
otherwise the launcher will consult the system path variableEclipse will <b>NOT</b> consult the <tt>JAVA_HOME</tt> environment variable.
+
  
To explicitly specify a JVM of your choice, you can use the <tt>-vm</tt> command
+
The '''most recommended''' way to specify a JVM for Eclipse to run in is to put startup configuration into the <code>[[eclipse.ini]]</code> file in the same folder as the Eclipse executable (<code>eclipse.exe</code> on Windows). The Eclipse program launcher will read arguments from either the command-line or the configuration file named <code>[[eclipse.ini]]</code>. To specify a JVM using configuration file, include the -vm argument in <code>[[eclipse.ini]]</code>, for example:
line argument:
+
<pre>-vm
<pre>
+
c:/jre/bin/javaw.exe
  eclipse -vm c:\jre\bin\javaw.exe             ''start Java by executing the specified java executable
+
</pre>  
  eclipse -vm c:\jre\bin\client\jvm.dll        ''start Java by loading the jvm in the eclipse process
+
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 -vm c:\jre\bin                        ''look for Java in the jre/bin directory
+
</pre>
+
  
See the [[Equinox_Launcher#Finding_a_VM.2C_Using_JNI_Invocation_or_Executing_Java|launcher]] page for more details on specifying a JVM.
+
Eclipse now will launch without additional arguments in the command-line, with the JVM specified in the <code>[[eclipse.ini]]</code> configuration file.  
  
=== Specifying the JVM in Eclipse 3.2===
+
You should always use <tt>-vm</tt> 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.  
Eclipse 3.2 was not able to using the JVM shared library to load the VM in the Eclipse process.  The only way to specify the JVM to use in 3.2 was to specify the java(w).exe:
+
  eclipse -vm C:\jre\bin\javaw.exe
+
  
'''Warning:''' When doing this on windows be sure to use double-quotes around the path and not to cut and paste from other entries, even this one, since it may introduce invisible incompatibilities causing that JVM not to be found and another JVM on the system to be used instead. ''Check Help -> About Eclipse Platform -> Configuration Details -> View Error Log'' for symptoms of using the wrong JVM.
+
'''''The format of the <tt>eclipse.ini</tt> file is very particular; it is strongly recommended to read '''''[[eclipse.ini|'''''eclipse.ini''''']]''''' and follow the examples there.''' ''
  
== eclipse.ini ==
+
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 <tt>-data &lt;workspace-path&gt;</tt> command-line argument.
Another option is to put startup configuration into an <code>[[eclipse.ini]]</code> file. The Eclipse program launcher will read arguments from either the command-line or the configuration file named <code>[[eclipse.ini]]</code>. To specify a JVM using configuration file, create a text file named <code>[[eclipse.ini]]</code> in the same folder as <code>eclipse.exe</code> with these contents:
+
<pre>
+
-vm
+
c:/jre/bin/javaw.exe
+
</pre>
+
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 <code>[[eclipse.ini]]</code> configuration file. Windows users: please be sure that the file you created has .ini extension, you may need to uncheck the 'Folder Options:View:Hide file extensions for known file types' from the Windows Explorer's Tools menu..
+
== OLD: Starting Eclipse 3.2  ==
  
You should always use <tt>-vm</tt> so you can be sure of what VM you are using.
+
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.  
Installers for other applications sometimes modify the system path variable,  
+
thus changing the VM used to launch Eclipse without your knowing about it.
+
  
The first time the <tt>eclipse</tt> command is executed,
+
To start 3.2 by directly invoking the JVM use the following command:
the platform creates a workspace directory, such as <tt>eclipse/workspace</tt>
+
<pre>   java -cp eclipse/startup.jar org.eclipse.core.launcher.Main
The workspace will contain all your projects, along with private metadata
+
</pre>  
computed by various plug-ins.  
+
Eclipse 3.2 did not contain a console version of the executable.  
  
In Eclipse 3.0, you are prompted to choose a workspace location on start-up.
 
Previously, the platform stored the workspace in the Eclipse install directory
 
by default.  In all versions of Eclipse, you can manually specify the workspace
 
location on the command line, using the <tt>-data &lt;workspace-path&gt;</tt>
 
command-line argument. The easiest way to quickly start Eclipse on different
 
workspaces for versions before Eclipse 3.0 is to create shortcuts or shell
 
scripts for each launch.
 
  
The use of <tt>-data</tt> is advised because using the default workspace location
+
== OLD: Oracle/Sun VM 1.6.0_21 on Windows  ==
will make it much more difficult for you to upgrade to new versions of Eclipse.
+
  
== See Also: ==
+
The Eclipse 3.3 - 3.6 launchers for Windows had a problem with the Oracle/Sun Java VM version '1.6.0_21-b06'.  
* [[FAQ How do I increase the heap size available to Eclipse?]]
+
* [[FAQ How do I increase the permgen size available to Eclipse?]]
+
* [[FAQ Who shows the Eclipse splash screen?]]
+
* [http://www.eclipse.org/swt/launcher.html The Eclipse Program Launcher]
+
* [http://wiki.eclipse.org/index.php/Category:Equinox Equinox Wiki Category]
+
* Running Eclipse 3.3M5+
+
:* [[Starting Eclipse Commandline With Equinox Launcher]]
+
:* [[Automated PDE JUnit Testing With Eclipse 3.3M5]]
+
* [http://www.64bitjungle.com/ubuntu/install-java-jre-160-update-x-on-hardy-as-the-default-java-runtime Preparing for Eclipse in Linux: Installing JRE 1.6.0 (Update x) as the Default Runtime]
+
  
 +
'''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' or higher from [http://www.java.com http://www.java.com] (alternative link is [http://java.sun.com/javase/downloads/index.jsp http://java.sun.com/javase/downloads/index.jsp]). Make sure you have b07 or higher by running <tt>java -version</tt>.
  
<hr><font size=-2>This FAQ was originally published in [http://www.eclipsefaq.org Official Eclipse 3.0 FAQs]. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the [http://www.eclipse.org/legal/epl-v10.html Eclipse Public License v1.0].</font>
+
Before the fix was released, there were three choices to work around this:  
  
== User Comments ==
+
#switch back to ''''1.6.0_20'''' (as of July 19, 2010 it can still be downloaded [http://java.sun.com/javase/downloads/widget/jdk_javafx.jsp here])
 +
#Change the commandline for launching or add the following line after "-vmargs" to your <tt>[[Eclipse.ini]]</tt> file:<br> <tt>-XX:MaxPermSize=256m</tt><br> ([[Eclipse.ini|Detailed instructions/examples]])
 +
#For 32-bit Helios, download the fixed [https://bugs.eclipse.org/bugs/attachment.cgi?id=174640 eclipse_1308.dll] and place it into<br><tt>(eclipse_home)/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.0.v20100503</tt>
  
The -data option does not work if a relative path is specified. If this is true, please point it out the FAQ above. Thank you.
+
The Java bug was closed for voting and comments at [http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6969236 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}}.
 +
 
 +
 
 +
== See Also:  ==
 +
 
 +
*[[FAQ How do I increase the heap size available to Eclipse?]]
 +
*[[FAQ How do I increase the permgen size available to Eclipse?]]
 +
*[[FAQ Who shows the Eclipse splash screen?]]
 +
*[http://www.eclipse.org/swt/launcher.html The Eclipse Program Launcher]
 +
*[http://wiki.eclipse.org/index.php/Category:Equinox Equinox Wiki Category]
 +
*Running Eclipse 3.3M5+
 +
 
 +
:*[[Starting Eclipse Commandline With Equinox Launcher]]
 +
:*[[Automated PDE JUnit Testing With Eclipse 3.3M5]]
 +
 
 +
*[http://www.64bitjungle.com/ubuntu/install-java-jre-160-update-x-on-hardy-as-the-default-java-runtime Preparing for Eclipse in Linux: Installing JRE 1.6.0 (Update x) as the Default Runtime]
 +
 
 +
<br>
 +
 
 +
----
 +
 
 +
<font size="-2">This FAQ was originally published in [http://www.eclipsefaq.org Official Eclipse 3.0 FAQs]. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the [http://www.eclipse.org/legal/epl-v10.html Eclipse Public License v1.0].</font>
 +
 
 +
== User Comments  ==
 +
 
 +
The -data option does not work if a relative path is specified. If this is true, please point it out the FAQ above. Thank you.  
  
 
Specifying -vm "c:\program files\..." seems to work for galileo.
 
Specifying -vm "c:\program files\..." seems to work for galileo.
 +
 +
A comment on the JVM search order (on Windows) - My testing (Windows 7, Eclipse 3.4.1) shows that Eclipse also looks for a JVM in the registry, in my case HKLM\Software\Wow6432Node\JavaSoft\Java Runtime Environment. I believe the correct search order would be 1: eclipse/jre directory, 2: eclipse.ini file, 3: registry, 4: System path variable. Can anyone else confirm this? If that is the case I think the text above should be updated.

Latest revision as of 15:10, 22 November 2012

Contents

[edit] Starting Eclipse

When you unzip Eclipse, the directory layout looks something like this:

   eclipse/
      features/			''the directory containing Eclipse features''
      plugins/			''the directory containing Eclipse plugins''
      eclipse.exe		''platform executable''
      eclipse.ini
      eclipsec.exe              ''(windows only) console executable''
      epl-v10.html		''the EPL license''
       jre/			''the JRE to run Eclipse with''
      notice.html	
      readme	

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.

[edit] 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.

[edit] 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 <workspace-path> command-line argument.

[edit] 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.


[edit] 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' or higher from http://www.java.com (alternative link is http://java.sun.com/javase/downloads/index.jsp). 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)
  2. Change the commandline for launching or add the following line after "-vmargs" to your Eclipse.ini file:
    -XX:MaxPermSize=256m
    (Detailed instructions/examples)
  3. 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

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.


[edit] See Also:



This FAQ was originally published in Official Eclipse 3.0 FAQs. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the Eclipse Public License v1.0.

[edit] User Comments

The -data option does not work if a relative path is specified. If this is true, please point it out the FAQ above. Thank you.

Specifying -vm "c:\program files\..." seems to work for galileo.

A comment on the JVM search order (on Windows) - My testing (Windows 7, Eclipse 3.4.1) shows that Eclipse also looks for a JVM in the registry, in my case HKLM\Software\Wow6432Node\JavaSoft\Java Runtime Environment. I believe the correct search order would be 1: eclipse/jre directory, 2: eclipse.ini file, 3: registry, 4: System path variable. Can anyone else confirm this? If that is the case I think the text above should be updated.