1. 程式人生 > >Eclipse 執行命令列引數大全

Eclipse 執行命令列引數大全

包括英文版本和中文版本兩種的說明, 特別需要值得一提的是那個 -nl 引數, 可以指定程式啟動時所使用的語言. 例如:
eclipse -nl en_US
將啟動英文語言, 這個特性在安裝了國際化語言包以後特別有用, 可以方便的切換各個語言的版本. 注意 IBM WSAD v5.1 也支援這個功能.

執行 Eclipse

將 Eclipse 驅動程式安裝(解壓縮)到某個目錄(例如,c:/eclipse)中之後,通過執行頂級安裝目錄中的 Eclipse 可執行檔案來啟動"工作臺"。在 Windows 系統上,該可執行檔案稱為 eclipse.exe,而在 Linux 系統上稱為 eclipse。注意:

下列討論描述 Windows 系統上的設定。Linux 上的設定是相似的。

如果您沒有另行指定,則平臺將預設工作區目錄建立為可執行檔案的兄弟目錄(例如 c:/eclipse/workspace)。此工作區目錄用作專案的預設內容區,還用於儲存任何必需的元資料。要進行共享安裝或多工作區安裝,應明確指出工作區的位置而不是使用預設值。有兩種控制工作區位置的方法:使用當前工作目錄或使用 -data 命令列自變數。

將工作區位置設定為在當前工作目錄內

在此方案中,工作區位置將是當前工作目錄中稱為 workspace 的目錄。

實現此目的最容易的方法可能是使用下列步驟來建立快捷方式:

  1. 導航到 Windows 資源管理器中的 eclipse.exe 並使用右鍵拖動來建立 eclipse.exe 的快捷方式。
  2. 編輯快捷方式的屬性,以使啟動位置:欄位標識工作區位置的父目錄(例如,c:/users/robert)。
  3. 關閉屬性對話方塊並雙擊快捷方式(如果提供的目錄為 c:/users/robert,則工作區位置將為 c:/users/robert/workspace)。

當然,您也可以使用命令提示符(通過將目錄切換為工作區父目錄然後執行 eclipse.exe)來獲得同樣的效果。

使用 -data 設定工作區的特定位置

要使用 -data 命令列自變數,只要將 -data your_workspace_location(例如,-data c:/users/robert/myworkspace)新增至快捷方式屬性中的目標

欄位或顯式地將它包括在命令列上。

使用 -vm 設定 java VM

建議顯式指定在執行 Eclipse 時要使用哪個 Java VM。使用 -vm 命令列自變數(例如,-vm c:/jre/bin/javaw.exe)可以實現此目的。如果不使用 -vm,則 Eclipse 將使用在 O/S 路徑上找到的一個 Java VM。當安裝其它產品時,它們可更改您的路徑,導致在下一次啟動 Eclipse 時使用另一 Java VM。

執行 Eclipse 中的高階主題

Eclipse 可執行檔案及平臺本身提供了人們感興趣的開發或除錯 Eclipse 各部件的許多執行選項。執行 Eclipse 可執行檔案的一般格式是:

eclipse [platform options] [-vmargs [Java VM arguments]]
原因
-arch architecture
定義 Eclipse 平臺在其上執行的處理器體系結構。Eclipse 平臺通常使用 Java os.arch 屬性的常用值來計算最佳設定。如果在此處指定該項,則這是 Eclipse 平臺使用的值。此處指定的值可作為 BootLoader.getOSArch() 用於外掛。示例值有:"x86"、"sparc"、"PA-RISC"和"ppc"。 2.0
-application applicationId
要執行的應用程式。應用程式由向 org.eclipse.core.runtime.applications 擴充套件點提供擴充套件的外掛來宣告。通常不需要此自變數。如果指定了此項,則該值會覆蓋配置提供的值。如果不指定此項,則會執行"Eclipse 工作臺"。 1.0
-boot bootJarURL
(建議不使用;用 -configuration 代替;支援 1.0 相容)。Eclipse 平臺的引導外掛程式碼(boot.jar)的位置,表示為 URL。如果指定此項,則會用它來為裝入 Eclipse 平臺載入程式類裝入器的類裝入器設定類路徑。僅當更改 startup.jar 和 boot.jar 的相對位置時才需要它。注意,不允許使用相對 URL。 *1.0
-classloaderproperties [file]
如果指定的話,則使用給定位置處的類裝入器屬性檔案來啟用平臺類類裝入器增強。檔案自變數可以是檔案路徑或 URL。注意,不允許使用相對 URL。單擊此處以獲得更多詳細資訊。 2.0.2
-configuration configurationFileURL
Eclipse 平臺配置檔案的位置,表示為 URL。配置檔案確定 Eclipse 平臺、可用外掛集和主要功能部件的位置。注意,不允許使用相對 URL。當安裝或更新 Eclipse 平臺時配置檔案被寫至此位置。 2.0
-consolelog
將 Eclipse 平臺的錯誤日誌映象到用來執行 Eclipse 的控制檯。與 -debug 組合時很方便使用。 1.0
-data workspacePath
要執行 Eclipse 平臺的工作區的路徑。工作區位置也是專案的預設位置。相對於從中啟動 eclipse 的目錄來解釋相對路徑。 1.0
-debug [optionsFile]
將平臺置於除錯方式,並從給定位置處的檔案裝入除錯選項(如果指定的話)。此檔案指示哪些除錯點可用於外掛以及是否已啟用它們。如果未給出檔案位置,則平臺在啟動 eclipse 的目錄中查詢稱為".options"的檔案。URL 和檔案系統路徑都可作為檔案位置。 1.0
-dev [classpathEntries]
將平臺置於開發方式。將可選類路徑條目(用逗號分隔的列表)新增至每個外掛的執行時類路徑。例如,當工作區包含要開發的外掛時,指定 -dev bin 會為每個外掛專案的名為 bin 的目錄新增類路徑條目,允許在其中儲存最新生成的類檔案。除去了冗餘或不存在的類路徑條目。 1.0
-endsplash params
用於在 Eclipse 平臺啟動並執行時關閉閃屏的內部選項。此選項在閃屏處理鏈中不同的位置有不同的語法和語義。 2.0
-feature featureId
主要功能部件的標識。主要功能部件為 Eclipse 的已啟動例項提供了產品個性,並確定使用的產品定製資訊。 2.0
-keyring keyringFilePath
磁碟上授權資料庫(或"金鑰環"檔案)的位置。此自變數必須與 -password 選項配合使用。相對於從中啟動 eclipse 的目錄來解釋相對路徑。 1.0
-nl locale
定義 Eclipse 平臺在其上執行的語言環境的名稱。Eclipse 平臺通常自動計算最佳設定。如果在此處指定該項,則這是 Eclipse 平臺使用的值。此處指定的值可作為 BootLoader.getNL() 用於外掛。示例值有:"en_US"和"fr_FR_EURO"。 2.0
-nolazyregistrycacheloading
取消啟用裝入優化的平臺外掛登錄檔快取記憶體。預設情況下,僅當需要時才從登錄檔快取記憶體(可用時)中裝入擴充套件的配置元素,以減少記憶體佔用。此選項將在啟動時強制完全裝入登錄檔快取記憶體。 2.1
-noregistrycache
繞過讀寫內部外掛登錄檔快取記憶體檔案。 2.0
-nosplash
執行平臺而不顯示閃屏。 1.0
-os operatingSystem
定義 Eclipse 平臺在其上執行的作業系統。Eclipse 平臺通常使用 Java os.name 屬性的常用值來計算最佳設定。如果在此處指定該項,則這是 Eclipse 平臺使用的值。此處指定的值可作為 BootLoader.getOS() 用於外掛,並用於解析外掛清單檔案中提及的路徑中 $os$ 變數的出現。示例值有:"win32"、"linux"、"hpux"、"solaris"和"aix"。 1.0
-password password
授權資料庫的密碼。與 -keyring 選項配合使用。 1.0
-perspective perspectiveId
啟動時要在活動工作臺視窗中開啟的透檢視。如果沒有指定該引數,則將開啟關閉時活動的透檢視。 1.0
-plugincustomization
	  propertiesFile
包含外掛首選項預設設定的屬性檔案的位置。這些預設設定覆蓋在主要功能部件中指定的預設設定。相對於從中啟動 eclipse 的目錄來解釋相對路徑。 2.0
-plugins pluginsFileURL
(建議不使用;用 -configuration 代替;支援 1.0 相容)。 指定 Eclipse 平臺查詢外掛的檔案的位置,表示為 URL。該檔案為屬性檔案格式,其中鍵是任意使用者定義名稱,值是指向 plugin.xml 檔案的顯式路徑或指向包含外掛的目錄的路徑的用逗號分隔的列表。注意,不允許使用相對 URL。如果指定此項,則此選項會導致建立適當的臨時配置。 *1.0
-refresh 
啟動時執行工作區的全域性重新整理的選項。這將使從上次平臺執行以來在檔案系統中所做的任何更改一致。 1.0
-showlocation 
用於在視窗標題欄中顯示工作區的位置的選項。在發行版 2.0 中,此選項僅與 -data 命令列自變數一起使用。 2.0
-showsplash params
用於顯示閃屏(由可執行的 Eclipse 平臺啟動器執行)的內部選項。此選項在閃屏處理鏈中不同的位置有不同的語法和語義。 2.0
-vm vmPath
要用來執行 Eclipse 平臺的"Java 執行時環境"(JRE)的位置。如果不指定此項,則 JRE 位於 jre(它是 Eclipse 可執行檔案的兄弟目錄)。相對於從中啟動 eclipse 的目錄來解釋相對路徑。 1.0
-ws windowSystem
定義 Eclipse 平臺在其上執行的 Windows 系統。Eclipse 平臺通常使用 Java os.name 屬性的常用值來計算最佳設定。如果在此處指定該項,則這是 Eclipse 平臺使用的值。此處指定的值可作為 BootLoader.getWS() 用於外掛、用於配置 SWT 以及用於解析外掛清單檔案中提及的路徑中 $ws$ 變數的出現。示例值有:"win32"、"motif"和"gtk"。 1.0

將 -vmargs 條目後面的所有自變數(但不包括 -vmargs)作為虛擬機器自變數(即,在要執行的類的前面)直接傳遞到所指示的 Java VM。注意:如果 Eclipse 啟動在 Java vm 自變數(-vmargs)之後提供的自變數(例如,-data),則 Eclipse 將不會啟動並且您將接收到"JVM 已終止。出口程式碼為 1"的錯誤。

在不同的 VM 上執行 

在 J9 上執行 Eclipse

當在 J9 版本 1.5 上執行 Eclipse 時,建議使用以下 VM 選項:

eclipse.exe [eclipse arguments] -vm path_to_j9w.exe 
            -vmargs -ms:32 -mm:2048 -mo:32768 -moi:32768 -mca:32 -mco:128 -mx:2000000

當在 J9 版本 2.0 上執行 Eclipse 時,J9W 選擇的預設自變數應為合適的選項。但是,要覆蓋 Eclipse 可執行檔案以內部方式自動設定的引數,必須指定 -vmargs 不帶任何引數,如下所示:

eclipse.exe [eclipse arguments] -vm path_to_j9w.exe -vmargs

有關進一步資訊,參考 J9 VM 文件和幫助。

在 IBM Developer Kit, Java(TM) Technology Edition VM 上執行 Eclipse

IBM Developer Kit, Java(TM) Technology Edition 1.3 Linux 的預設 VM 設定適合進行初期研究工作,但在進行大型開發時是不夠的。對於大型開發,應修改 VM 自變數以使有更多的堆可用。例如,下列設定將允許 Java 堆增大為 256MB:

-vmargs -Xmx256M 

 
Copyright IBM Corporation and others 2000, 2003

Running Eclipse

After you install (unzip) the Eclipse driver in a directory (such as c:/eclipse), start the Workbench by running the Eclipse executable file found in the top level install directory. The executable file is called eclipse.exe on Windows systems and eclipse on Linux systems. Note: the following discussion describes setting up on Windows systems. Setup on Linux is analogous.

If you do not specify otherwise, the platform creates a default workspace directory as a sibling of the executable (for example, c:/eclipse/workspace). This workspace directory is used as the default content area for your projects as well as for holding any required metadata. For shared or multi-workspace installs you should explicitly state the location of your workspace rather than using the default. There are two ways to control the location of your workspace: using the current working directory or using the -data command line argument.

Setting the workspace location to be inside the current working directory

In this scenario, the workspace location will be a directory called workspace inside the current working directory.

Perhaps the easiest way of doing this is to create a shortcut using the following steps:

  1. Navigate to eclipse.exe in the Windows Explorer and using a right button drag, create a shortcut to eclipse.exe.
  2. Edit the properties of the shortcut such that the Start in: field identifies the parent directory of your workspace location (for example, c:/users/robert).
  3. Close the properties dialog and double-click on the shortcut (if the provided directory was c:/users/robert, the workspace location would be c:/users/robert/workspace).

Of course you can get the same effect using a command prompt by changing directory to your workspace parent's directory and then running eclipse.exe.

Setting a specific location for the workspace with -data

To use the -data command line argument, simply add -data your_workspace_location (for example, -data c:/users/robert/myworkspace) to the Target field in the shortcut properties, or include it explicitly on your command line.

Setting the java VM using -vm

It is recommended that you explicitly specify which Java VM to use when running Eclipse. This is achieved with the -vm command line argument (for example, -vm c:/jre/bin/javaw.exe). If you don't use -vm, Eclipse will use the first Java VM found on the O/S path. When you install other products, they may change your path, resulting in a different Java VM being used when you next launch Eclipse.

Advanced Topics in Running Eclipse

The Eclipse executable and the platform itself offer a number of execution options of interest to people developing or debugging parts of Eclipse. The general form of running the Eclipse executable is:

eclipse [platform options] [-vmargs [Java VM arguments]]
Since
-arch architecture
Defines the processor architecture on which the Eclipse platform is running. The Eclipse platform ordinarily computes the optimal setting using the prevailing value of Java os.arch property. If specified here, this is the value that the Eclipse platform uses. The value specified here is available to plug-ins as BootLoader.getOSArch(). Example values: "x86", "sparc", "PA-RISC", "ppc". 2.0
-application applicationId
The application to run. Applications are declared by plug-ins supplying extensions to the org.eclipse.core.runtime.applications extension point. This argument is typically not needed. If specified, the value overrides the value supplied by the configuration. If not specified, the Eclipse Workbench is run. 1.0
-boot bootJarURL
(Deprecated; replaced by -configuration; supported for 1.0 compatibility). The location of the Eclipse platform's boot plug-in code (boot.jar), expressed as a URL. If specified, it is used to set the classpath for the class loader that loads the Eclipse platform bootstrap class loader. Only required when changing the relative location of startup.jar and boot.jar. Note that relative URLs are not allowed. *1.0
-classloaderproperties [file]
Activates platform class loader enhancements using the class loader properties file at the given location, if specified. The file argument can be either a file path or a URL. Note that relative URLs are not allowed. Click here for more details. 2.0.2
-configuration configurationFileURL
The location for the Eclipse Platform configuration file, expressed as a URL. The configuration file determines the location of the Eclipse platform, the set of available plug-ins, and the primary feature. Note that relative URLs are not allowed. The configuration file is written to this location when the Eclipse platform is installed or updated. 2.0
-consolelog
Mirrors the Eclipse platform's error log to the console used to run Eclipse. Handy when combined with -debug. 1.0
-data workspacePath
The path of the workspace on which to run the Eclipse platform. The workspace location is also the default location for projects. Relative paths are interpreted relative to the directory that Eclipse was started from. 1.0
-debug [optionsFile]
Puts the platform in debug mode and loads the debug options from the file at the given location, if specified. This file indicates which debug points are available for a plug-in and whether or not they are enabled. If a file location is not given, the platform looks in the directory that eclipse was started from for a file called ".options". Both URLs and file system paths are allowed as file locations. 1.0
-dev [classpathEntries]
Puts the platform in development mode. The optional classpath entries (a comma separated list) are added to the runtime classpath of each plug-in. For example, when the workspace contains plug-ins being developed, specifying -dev bin adds a classpath entry for each plug-in project's directory named bin, allowing freshly generated class files to be found there. Redundant or non-existent classpath entries are eliminated. 1.0
-endsplash params
Internal option for taking down the splash screen when the Eclipse platform is up and running. This option has different syntax and semantics at various points along the splash screen processing chain. 2.0
-feature featureId
The ID of the primary feature. The primary feature gives the launched instance of Eclipse its product personality, and determines the product customization information used. 2.0
-keyring keyringFilePath
The location of the authorization database (or "key ring" file) on disk. This argument must be used in conjunction with the -password option. Relative paths are interpreted relative to the directory that Eclipse was started from. 1.0
-nl locale
Defines the name of the locale on which the Eclipse platform is running. The Eclipse platform ordinarily computes the optimal setting automatically. If specified here, this is the value that the Eclipse platform uses. The value specified here is available to plug-ins as BootLoader.getNL(). Example values: "en_US" and "fr_FR_EURO". 2.0
-nolazyregistrycacheloading
Deactivates platform plug-in registry cache loading optimization. By default, extensions' configuration elements will be loaded from the registry cache (when available) only on demand, reducing memory footprint. This option will force the registry cache to be fully loaded at startup. 2.1
-noregistrycache
Bypasses the reading and writing of an internal plug-in registry cache file. 2.0
-nosplash
Runs the platform without putting up the splash screen. 1.0
-os operatingSystem
Defines the operating system on which the Eclipse platform is running. The Eclipse platform ordinarily computes the optimal setting using the prevailing value of Java os.name property. If specified here, this is the value that the Eclipse platform uses. The value specified here is available to plug-ins as BootLoader.getOS(), and used to resolve occurrences of the $os$ variable in paths mentioned in the plug-in manifest file. Example values: "win32", "linux", "hpux", "solaris", "aix". 1.0
-password password
The password for the authorization database. Used in conjunction with the -keyring option. 1.0
-perspective perspectiveId
The perspective to open in the active workbench window on startup. If this parameter is not specified, the perspective that was active on shutdown will be opened. 1.0
-plugincustomization
	  propertiesFile
The location of a properties file containing default settings for plug-in preferences. These default settings override default settings specified in the primary feature. Relative paths are interpreted relative to the directory that eclipse was started from. 2.0
-plugins pluginsFileURL
(Deprecated; replaced by -configuration; supported for 1.0 compatibility). The location of the file that specifies where the Eclipse platform finds plug-ins, expressed as a URL. The file is in property file format where the keys are arbitrary user defined names and the values are comma separated lists of either explicit paths to plugin.xml files, or paths to directories containing plug-ins. Note that relative URLs are not allowed. If specified, this option causes the creation of a suitable temporary configuration. *1.0
-refresh 
Option for performing a global refresh of the workspace on startup. This will reconcile any changes that were made in the file system since the platform was last run. 1.0
-showlocation 
Option for displaying the location of the workspace in the window title bar. In release 2.0 this option only worked in conjunction with the -data command line argument. 2.0
-showsplash params
Internal option for showing the splash screen (done by the executable Eclipse platform launcher). This option has different syntax and semantics at various points along the splash screen processing chain. 2.0
-vm vmPath
The location of Java Runtime Environment (JRE) to use to run the Eclipse platform. If not specified, the JRE is at jre, sibling of the Eclipse executable. Relative paths are interpreted relative to the directory that eclipse was started from. 1.0
-ws windowSystem
Defines the window system on which the Eclipse platform is running. The Eclipse platform ordinarily computes the optimal setting using the prevailing value of Java os.name property. If specified here, this is the value that the Eclipse platform uses. The value specified here is available to plug-ins as BootLoader.getWS(), used to configure SWT, and used to resolve occurrences of the $ws$ variable in paths mentioned in the plug-in manifest file. Example values: "win32", "motif", "gtk". 1.0

All arguments following (but not including) the -vmargs entry are passed directly through to the indicated Java VM as virtual machine arguments (that is, before the class to run). Note: If an Eclipse startup argument, such as -data, is provided after the Java vm arguments (-vmargs), Eclipse will not start and you will receive a "JVM terminated. Exit code=1" error.

Running on Different VMs 

Running Eclipse on J9

When running Eclipse on J9 version 1.5, it is recommended that you use the following VM options:

eclipse.exe [eclipse arguments] -vm path_to_j9w.exe 
            -vmargs -ms:32 -mm:2048 -mo:32768 -moi:32768 -mca:32 -mco:128 -mx:2000000

When running Eclipse on J9 version 2.0, the default arguments chosen by J9W should be suitable. However, to override the parameters which are automatically set internally by the Eclipse executable, you must specify -vmargs with no following arguments as follows:

eclipse.exe [eclipse arguments] -vm path_to_j9w.exe -vmargs

Please refer to the J9 VM documentation and help for further information.

Running Eclipse on the IBM Developer Kit, Java(TM) Technology Edition VM

The default VM settings for IBM Developer Kit, Java(TM) Technology Edition 1.3 Linux work well for initial exploration, but are not sufficient for large scale development. For large scale development you should modify your VM arguments to make more heap available. For example, the following setting will allow the Java heap to grow to 256MB: 

-vmargs -Xmx256M