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/OpenFileFeature"

(Linux GTK)
(Windows)
Line 23: Line 23:
 
  eclipse.exe --launcher.openFile %1
 
  eclipse.exe --launcher.openFile %1
 
# 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.
 
# 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
+
# 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! :-)

Revision as of 16:01, 29 January 2010

Opening files in Eclipse from the command line, or through file associations

Background

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. 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. The remaining work, targeted for 3.6 M6, is described in bug 301030.

How To Enable

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 <file to open>

Windows

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 <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:

  1. 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
  1. 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.
  2. 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! :-)

Copyright © Eclipse Foundation, Inc. All Rights Reserved.