This post is all about understanding the eclipse.ini file and troubleshooting the errors due to wrong/inappropriate usage of eclipse.ini file
What is eclipse.ini?
eclipse.ini is a text file containing command-line options that are added to the command line used when Eclipse is started
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 is used.
Location of eclipse.ini
Windows/Linux OS : In eclipse directory example C:\eclipse\Profiles\Eclipse 4.2 Classic\eclipse.ini
Mac OS : Eclipse.app/Contents/MacOS/eclipse.ini
eclipse.ini looks something like this
-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.6\bin\javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx1024m
Lets understand each section of eclipse.in and how we can use these options:
Specifying the heap space
Below are the options in eclipse.ini to specify heap space
-Xms40m
-Xmx512m
this sets the heap space to 40MB initially and a maximum of 512MB, incase you want to increase the heap space you can use the options like
-Xms256m
-Xmx1024m
this sets the heap space to 256MB initially and a maximum of 1024MB
Specifying the max PermGen size
-XX:MaxPermSize=256m
this set the max PermGen size to 256m
Specifying 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.
The most recommended way to specify a JVM for Eclipse to run in is to put startup configuration into the eclipse.ini file
Windows example:
-vm
C:\Java\JDK\1.6\bin\javaw.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
Linux example:
-vm
/opt/sun-jdk-1.6.0.02/bin/java
Mac OS example:
-vm
/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/java