Skip to main content
Jump to: navigation, search



Based on work in SWT (bug 201154) and the native launcher (bug 178927), the Eclipse IDE now supports opening a file from the command line, or opening a file that has been associated with the Eclipse executable (bug 4922).

If an instance of Eclipse is already running, that instance will open the file. Otherwise, a new instance will be started. As of 3.6 M5, this feature is not fully finished and not enabled by default, but we encourage those interested in this feature to give it a try and provide feedback, for example on the bugs linked to above. The remaining work, targeted for 3.6 M6, is described in bug 301030.

How To Use the Feature

There are platform-specific differences as described below.

Mac Cocoa

On Mac Cocoa, the feature works without having to tweak anything. You can right-click (or Ctrl-click) on a file and pick "Open With", then select Eclipse.

Linux GTK

To enable the feature on Linux GTK, as of 3.6 M5, the Eclipse IDE needs to be launched with a command line that looks like:

eclipse --launcher.openFile <absolute path of file to open>

You can also right-click on a file, select "Open With>Other Application" and enter a custom command:

'<path to eclipse executable>' --launcher.openFile


To enable the feature on Windows, as of 3.6 M5, the Eclipse IDE needs to be launched with a command line that looks like:

eclipse.exe --launcher.openFile <absolute path of file to open>

On Windows, there are several ways to associate a file type with Eclipse such that you can "Open With" Eclipse, or double-click on a file that has Eclipse defined as the default application:

Batch file

Create a .bat file that passes the openFile option as shown below, then use "Open With" and select the .bat file:

eclipse.exe --launcher.openFile %1

Change eclipse.ini

Add "--launcher.openFile" to your "eclipse.ini" file, in a line immediately above "-vmargs". Then use "Open With" and select "eclipse.exe". This has the disadvantage that you won't be able to start the eclipse.exe from the command line or a .bat file with additional arguments - the first argument you pass will be interpreted as a file.


Change the Windows registry similar to how an installer would do it, by inserting a key under HKEY_CLASSES_ROOT\<file type>\Shell\Open\Command and a key for the file type under HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\<.extension>\OpenWithProgids (good luck! :-)

Back to the top