Optimizing Eclipse with eclipse.ini VM Arguments

The eclipse.ini file is a key configuration file for controlling the startup settings of Eclipse. By adjusting this file, you can specify important VM arguments, such as which JDK Eclipse should use, as well as set memory options like permgen space, and define heap sizes through parameters like Xms and Xmx.

Locating the eclipse.ini File

The location of the eclipse.ini file varies depending on your operating system:

  • Windows: The file is typically found in the same directory as the eclipse.exe file.
  • Mac OS X: The file is located within the app package. Navigate to it by right-clicking on the Eclipse app, selecting “Show Package Contents,” and then opening the path Contents/Eclipse.

Here’s a basic example of an eclipse.ini file layout:

 
-startup
../Eclipse/plugins/org.eclipse.equinox.launcher_1.3.100.v20150511-1540.jar
--launcher.library
../Eclipse/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.300.v20150602-1417
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.7
-XstartOnFirstThread
-Dorg.eclipse.swt.internal.carbon.smallFonts
-XX:MaxPermSize=256m
-Xms256m
-Xmx1024m
-Xdock:icon=../Resources/Eclipse.icns

Important Notes on eclipse.ini Configuration

  1. Lines above -vmargs represent startup options for Eclipse, while anything below it is passed as JVM arguments.
  2. Make sure to place all VM-related settings (like the JDK path) above -vmargs, as anything after -vmargs is processed solely as JVM arguments.
  3. The --launcher.XXMaxPermSize parameter sets the maximum permgen space for the Eclipse launcher. Increasing this can help if Eclipse is struggling with memory during startup.

Setting the JVM with eclipse.ini VM Arguments

If you have multiple JDK versions installed, you can specify the one you want Eclipse to use by defining the -vm argument before -vmargs. Here’s how to set JDK 8 on Mac OS X, for example:

 
-vm
/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/bin
-vmargs

On other operating systems, you would simply adjust the path to match the location of the JDK’s bin directory.

Managing Permgen Space

If you encounter an OutOfMemoryError related to PermGen space, particularly when working on large projects or using Maven, you might need to increase permgen space. This can be done by adding -XX:MaxPermSize=512M in the eclipse.ini file.

Note: Starting from Java 8, there is no more PermGen space, so this setting is obsolete with JDK 8 and beyond.

Configuring Heap Space

To increase the maximum heap space available to Eclipse, you can edit the -Xmx parameter. For instance, to allocate 2 GB of heap memory, set the following:

This adjustment can resolve OutOfMemoryError issues caused by insufficient heap space, especially useful for resource-intensive projects.

Create a Free Account

Register now and get access to our Cloud Services.

Posts you might be interested in:

centron Managed Cloud Hosting in Deutschland

Android ProgressBar Tutorial in Kotlin

Guide, Linux Basics
Android ProgressBar Tutorial in Kotlin In this tutorial, we’ll discuss and implement ProgressBar in our Android Application using Kotlin. Content1 What is a ProgressBar?2 Android ProgressBar Types3 ProgressBar Attributes4 Android…