Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Eclipse.ini"

(Overview)
m (added a note about spaces in windows paths)
(11 intermediate revisions by 3 users not shown)
Line 4: Line 4:
 
Eclipse startup is controlled by the options in <code>$ECLIPSE_HOME/eclipse.ini</code>. If <code>$ECLIPSE_HOME</code> is not defined, the default <code>eclipse.ini</code> in your Eclipse installation directory (or in the case of Mac, the <code>Eclipse.app/Contents/MacOS</code> directory) is used.  
 
Eclipse startup is controlled by the options in <code>$ECLIPSE_HOME/eclipse.ini</code>. If <code>$ECLIPSE_HOME</code> is not defined, the default <code>eclipse.ini</code> in your Eclipse installation directory (or in the case of Mac, the <code>Eclipse.app/Contents/MacOS</code> directory) is used.  
  
<code>eclipse.ini</code> is a text file containing command-line options that are added to the command line used when Eclipse is started up. There are many options available, please see [http://help.eclipse.org/kepler/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/misc/runtime-options.html here].  
+
<code>eclipse.ini</code> is a text file containing command-line options that are added to the command line used when Eclipse is started up. There are many options available, please see [http://help.eclipse.org/mars/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/misc/runtime-options.html here].  
  
 
'''''Important:'''''  
 
'''''Important:'''''  
  
 +
#'''''You can, and should, experiment with changes to the launch command from your Command Prompt/Terminal before changing the <code>eclipse.ini</code> itself.'''''
 
#'''''Each option and each argument to an option must be on its own line.'''''  
 
#'''''Each option and each argument to an option must be on its own line.'''''  
 
#'''''All lines after <code>-vmargs</code> are passed as arguments to the JVM, so all arguments and options for eclipse must be specified before <code>-vmargs</code> (just like when you use arguments on the command-line)'''''  
 
#'''''All lines after <code>-vmargs</code> are passed as arguments to the JVM, so all arguments and options for eclipse must be specified before <code>-vmargs</code> (just like when you use arguments on the command-line)'''''  
 
#'''''Any use of <code>-vmargs</code> on the command-line replaces all <code>-vmargs</code> settings in the .ini file unless <code>--launcher.appendVmargs</code> is specified either in the .ini file or on the command-line. ([http://help.eclipse.org/kepler/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fmisc%2Fruntime-options.html&resultof=%22launcher%2eappendvmargs%22%20 doc])'''''
 
#'''''Any use of <code>-vmargs</code> on the command-line replaces all <code>-vmargs</code> settings in the .ini file unless <code>--launcher.appendVmargs</code> is specified either in the .ini file or on the command-line. ([http://help.eclipse.org/kepler/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fmisc%2Fruntime-options.html&resultof=%22launcher%2eappendvmargs%22%20 doc])'''''
 +
#'''''-XX VM arguments are subject to change without notice, even during minor updates. If the JVM keeps exiting with code 2 instead of starting Eclipse, try removing them.
 +
#'''''Make a backup--keep a copy of the original contents on hand so you don't break your installation and have to download it all again.'''''
  
 
<br>  
 
<br>  
Line 45: Line 48:
 
The following examples of <code>eclipse.ini</code> demonstrate correct usage of the -vm option.  
 
The following examples of <code>eclipse.ini</code> demonstrate correct usage of the -vm option.  
  
'''''Note the format of the -vm option - it is important to be exact''''':  
+
'''''Note the format of the <code>-vm</code> option - it is important to be exact''''':  
  
*The -vm option and its value (the path) must be on separate lines.  
+
*The <code>-vm</code> option and its value (the path) must be on separate lines.  
 
*The value must be the full absolute or relative path to the Java executable, not just to the Java home directory.  
 
*The value must be the full absolute or relative path to the Java executable, not just to the Java home directory.  
*The -vm option must occur before the -vmargs option, since everything after -vmargs is passed directly to the JVM.
+
*The <code>-vm</code> option must occur '''''after''''' the other Eclipse-specific options (such as <code>-product</code>, <code>--launcher.*</code>, etc), but '''''before''''' the <code>-vmargs</code> option, since everything after <code>-vmargs</code> is passed directly to the JVM.
 
*For the 32-bit Eclipse executable (eclipse.exe on Windows) a 32-bit JVM must be used and for the 64-bit Eclipse executable a 64-bit JVM must be used. 32-bit Eclipse will not work with a 64-bit JVM.
 
*For the 32-bit Eclipse executable (eclipse.exe on Windows) a 32-bit JVM must be used and for the 64-bit Eclipse executable a 64-bit JVM must be used. 32-bit Eclipse will not work with a 64-bit JVM.
  
Line 70: Line 73:
 
openFile
 
openFile
 
-vm
 
-vm
C:\Java\JDK\1.6\bin\javaw.exe
+
C:\Java\JDK\1.8\bin\javaw.exe
 
-vmargs
 
-vmargs
 
-Dosgi.requiredJavaVersion=1.5
 
-Dosgi.requiredJavaVersion=1.5
Line 81: Line 84:
 
== -vm value: Windows Example  ==
 
== -vm value: Windows Example  ==
  
This is how the <code>-vm</code> argument might look on Windows (your exact path to <code>javaw.exe</code> could be different, of course):  
+
This is how the <code>-vm</code> argument might look on Windows (your exact path to <code>javaw.exe</code> could be different, of course. Please beware of paths that contain a space, the examples below do not have any spaces, and using quotation marks around paths that contain spaces does not seem to work):  
  
 
  -vm
 
  -vm
 
  C:\jdk1.7.0_21\bin\javaw.exe  
 
  C:\jdk1.7.0_21\bin\javaw.exe  
  
An alternative way is to insert the following VM option before the -vmargs option in the Eclipse shortcut properties(edit the field Target inside the "Shortcut" tab):
+
Or
  
-vm C:\jdk1.7.0_21\bin\javaw.exe  
+
-vm
 +
C:\progra~1\Java\jre1.8.0_112\bin\javaw.exe  
 +
 
 +
An alternative way is to insert the following VM option before the -vmargs option in the Eclipse shortcut's properties (edit the field Target inside the "Shortcut" tab):
  
 +
-vm C:\jdk1.7.0_21\bin\javaw.exe
 
or  
 
or  
 +
-vm C:\jdk1.7.0_21\jre\bin\java.exe
  
-vm C:\jdk1.7.0_21\jre\bin\java.exe
+
This might not work on all systems. If you encounter "''Java was started but returned exit code=1''" error while starting the eclipse, modify the <code>-vm</code> argument to point to <code>jvm.dll</code> (exact path could be different):  
 
+
+
<br> This might not work on all systems. If you encounter "''Java was started but returned exit code=1''" error while starting the eclipse, modify the <code>-vm</code> argument to point to <code>jvm.dll</code> (exact path could be different):  
+
  
 
  -vm
 
  -vm
Line 104: Line 109:
 
This is how the -vm argument might look on Linux (your exact path to <code>java</code> could be different, of course):  
 
This is how the -vm argument might look on Linux (your exact path to <code>java</code> could be different, of course):  
  
  -vm
+
-vm
 
  /opt/sun-jdk-1.6.0.02/bin/java
 
  /opt/sun-jdk-1.6.0.02/bin/java
  
 
== -vm value: Mac OS X Example  ==
 
== -vm value: Mac OS X Example  ==
  
On a '''Mac OS X''' system, you can find <code>eclipse.ini</code> by right-clicking (or Ctrl+click) on the Eclipse executable in Finder, choose Show Package Contents, and then locate <code>eclipse.ini</code> in the <code>MacOS</code> folder under <code>Contents</code>.  
+
On a '''Mac OS X''' system, you can find <code>eclipse.ini</code> by right-clicking (or Ctrl+click) on the Eclipse executable in Finder, choose Show Package Contents, and then locate <code>eclipse.ini</code> in the <code>Eclipse</code> folder under <code>Contents</code>. The path is often
 +
<pre>
 +
/Applications/Eclipse.app/Contents/Eclipse/eclipse.ini
 +
</pre>
  
To specify Java 6 for OS X:
+
For versions of Mac OS X 10.7+ the location is something like
 +
<code>/Library/Java/JavaVirtualMachines/&lt;JRE_NAME&gt;/Contents/Home/bin</code>
  
  -vm
+
For example, the latest JDK 1.8 (as of July 2015) is
/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/java
+
<code>/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/bin</code>
  
For versions of Mac OS X 10.7+ the location has changed to  
+
For standard Mac Java installations and so you don't have to continually update the setting when you install new Java VMs, set the <code>-vm</code> flag to simply <code>/usr/bin</code>:
<pre>/Library/Java/JavaVirtualMachines/&lt;''jdk_name_ver''&gt;/Contents/Home/...
+
<pre>
 +
-vm
 +
/usr/bin
 +
</pre>
 +
 
 +
Here is additional information:
 +
 
 +
Perhaps the best way to determine the location for the JDK you want to use is with the utility
 +
<pre>/usr/libexec/java_home --verbose</pre>
 +
From the list produced by that command, select the JDK you want to use and put that path into the eclipse.ini file, making sure to append <code>/bin/java</code> to the path (eg, <code>/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home/bin/java</code>
 +
 
 +
Note that the full path can either include <code>java</code> or not. For example, the following will both work:
 +
<pre>
 +
-vm
 +
/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/bin
 +
</pre>
 +
<pre>
 +
-vm
 +
/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/bin/java
 
</pre>
 
</pre>
To be safer, determine the location for the JDK you intend to use via the utility /usr/libexec/java_home and put this value with .../bin/java appended into the Eclipse.ini file.
 
  
 
= See Also  =
 
= See Also  =

Revision as of 08:19, 15 December 2016

Overview

Eclipse startup is controlled by the options in $ECLIPSE_HOME/eclipse.ini. If $ECLIPSE_HOME is not defined, the default eclipse.ini in your Eclipse installation directory (or in the case of Mac, the Eclipse.app/Contents/MacOS directory) is used.

eclipse.ini is a text file containing command-line options that are added to the command line used when Eclipse is started up. There are many options available, please see here.

Important:

  1. You can, and should, experiment with changes to the launch command from your Command Prompt/Terminal before changing the eclipse.ini itself.
  2. Each option and each argument to an option must be on its own line.
  3. All lines after -vmargs are passed as arguments to the JVM, so all arguments and options for eclipse must be specified before -vmargs (just like when you use arguments on the command-line)
  4. Any use of -vmargs on the command-line replaces all -vmargs settings in the .ini file unless --launcher.appendVmargs is specified either in the .ini file or on the command-line. (doc)
  5. -XX VM arguments are subject to change without notice, even during minor updates. If the JVM keeps exiting with code 2 instead of starting Eclipse, try removing them.
  6. Make a backup--keep a copy of the original contents on hand so you don't break your installation and have to download it all again.


By default, eclipse.ini looks something like this (the exact contents will vary based on operating system and which Eclipse package you have):

-startup
../../../plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
../../../plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.100.v20110502
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-XX:MaxPermSize=256m
-Xms40m
-Xmx512m

Among other things, this sets the heap space to 40MB initially and a maximum of 512MB, and also specifies a maximum PermGen size of 256MB. A max heap of 512MB might be OK for some users, but it's often necessary to bump that value up for large project sets or when some third-party plugins are installed.

Specifying the JVM

One of the most recommended options to use is to specify a specific JVM for Eclipse to run on. Doing this ensures that you are absolutely certain which JVM Eclipse will run in and insulates you from system changes that can alter the "default" JVM for your system. Many a user has been tripped up because they thought they knew what JVM would be used by default, but they thought wrong. eclipse.ini lets you be CERTAIN.

The following examples of eclipse.ini demonstrate correct usage of the -vm option.

Note the format of the -vm option - it is important to be exact:

  • The -vm option and its value (the path) must be on separate lines.
  • The value must be the full absolute or relative path to the Java executable, not just to the Java home directory.
  • The -vm option must occur after the other Eclipse-specific options (such as -product, --launcher.*, etc), but before the -vmargs option, since everything after -vmargs is passed directly to the JVM.
  • For the 32-bit Eclipse executable (eclipse.exe on Windows) a 32-bit JVM must be used and for the 64-bit Eclipse executable a 64-bit JVM must be used. 32-bit Eclipse will not work with a 64-bit JVM.

Here is an example of what eclipse.ini might look like on a Windows system after you've added the -vm argument and increased the maximum heap space:

-startup
plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502
-product
org.eclipse.epp.package.java.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vm
C:\Java\JDK\1.8\bin\javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx1024m

Remember that the exact values will differ slightly depending on operating system and Eclipse package.

-vm value: Windows Example

This is how the -vm argument might look on Windows (your exact path to javaw.exe could be different, of course. Please beware of paths that contain a space, the examples below do not have any spaces, and using quotation marks around paths that contain spaces does not seem to work):

-vm
C:\jdk1.7.0_21\bin\javaw.exe 

Or

-vm
C:\progra~1\Java\jre1.8.0_112\bin\javaw.exe 

An alternative way is to insert the following VM option before the -vmargs option in the Eclipse shortcut's properties (edit the field Target inside the "Shortcut" tab):

-vm C:\jdk1.7.0_21\bin\javaw.exe 

or

-vm C:\jdk1.7.0_21\jre\bin\java.exe

This might not work on all systems. If you encounter "Java was started but returned exit code=1" error while starting the eclipse, modify the -vm argument to point to jvm.dll (exact path could be different):

-vm
C:\Development\Java\64bit\jdk1.7.0_09\jre\bin\server\jvm.dll

-vm value: Linux Example

This is how the -vm argument might look on Linux (your exact path to java could be different, of course):

-vm
/opt/sun-jdk-1.6.0.02/bin/java

-vm value: Mac OS X Example

On a Mac OS X system, you can find eclipse.ini by right-clicking (or Ctrl+click) on the Eclipse executable in Finder, choose Show Package Contents, and then locate eclipse.ini in the Eclipse folder under Contents. The path is often

/Applications/Eclipse.app/Contents/Eclipse/eclipse.ini

For versions of Mac OS X 10.7+ the location is something like /Library/Java/JavaVirtualMachines/<JRE_NAME>/Contents/Home/bin

For example, the latest JDK 1.8 (as of July 2015) is /Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/bin

For standard Mac Java installations and so you don't have to continually update the setting when you install new Java VMs, set the -vm flag to simply /usr/bin:

-vm
/usr/bin

Here is additional information:

Perhaps the best way to determine the location for the JDK you want to use is with the utility

/usr/libexec/java_home --verbose

From the list produced by that command, select the JDK you want to use and put that path into the eclipse.ini file, making sure to append /bin/java to the path (eg, /Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home/bin/java

Note that the full path can either include java or not. For example, the following will both work:

-vm
/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/bin
-vm
/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/bin/java

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.

Copyright © Eclipse Foundation, Inc. All Rights Reserved.