Launching Eclipse

 

In this section you will learn:

·         Which parameters to specify when you launch Eclipse for the first time

·         How to create a new workspace

·         How to launch Eclipse in different Java VMs

·         How to launch several Eclipse instances

 

When launching Eclipse, you first activate the platform runtime. This requires a Java VM and either accesses an assigned workspace or creates one if none exists. It also finds out what plug-ins are registered and launches them as necessary.

 

You can control the way Eclipse is launched by specifying the following parameters:

 

Workspace

Each instance of Eclipse is always assigned to exactly one workspace. Before you start Eclipse, you can specify the workspace in which it is to run using the - data command line argument. If you do not specify a workspace, Eclipse uses the default workspace.

 

Java Virtual Machine

You can run an Eclipse platform on different Java VMs. When you launch Eclipse for the first time, you must specify a Java VM installed on your machine using the - vm command line argument. This VM will then be used the next time you launch Eclipse.

 

 

Launching Eclipse using a shortcut

When you start Eclipse for the first time:

1.       If this is not the case, create a shortcut to eclipse.exe on your desktop.

2.       Before you start Eclipse, select this shortcut with the right mouse button and choose Properties from the context menu.

  1. Choose the Shortcut tab.
  2. In the Target field, insert the two arguments –data <my workspace location> and –vm <java vm location> in the command line statement.

Example

…\eclipse.exe  -data C:\JavaProjects\MyWorkspace -vm C:\SDK_1.4\bin\java.exe

  1. Choose OK to confirm your entries.
  2. To launch Eclipse, double-click the shortcut.

 

Launching Eclipse using a batch file

One easy way of launching Eclipse is to use a batch file.

Create a batch file (.bat), specifying your launch parameters in it. You can create several configuration batch files in this way and then use each as required to launch Eclipse with different launch parameters.

Example

The following batch file specifies the workspace path and Java VM used to launch Eclipse, and also writes error log information to the console.

 

 

cd C:\JavaDev\eclipse

eclipse.exe -consolelog -debug -data C:\Eclipse\MyWorkspace -vm C:\SDK_1.4\bin\java.exe

 

 

Example

The following batch file specifies a Java VM and a special application, which Eclipse launches instead of the Workbench. (By default, you do not specify an -application argument, so Eclipse launches the Workbench). This allows you to launch your own Workbench.

 

 

cd C:\JavaDev\eclipse

eclipse.exe -vm C:\SDK_1.4\bin\java.exe -application com.xyz.MyLauncher

 

 

Result

If the workspace you specify does not yet exist, the Eclipse IDE creates one when it launches. In general, Eclipse starts with the Eclipse workbench as the launcher.

 

You can now start another Eclipse instance. However, this is only possible if you specify another workspace, by entering –data <my other workspace location> as an argument in Target.