Creating Eclipse Workspace Launchers in OS-X

2007:09:01

The Problem

I often run multiple instances of Eclipse in different workspaces for development -

  • One for front-end application work in Flex
  • One for back-end services work in Java

Since I develop on OS X and use Quicksilver, I’d love to just launch each instance using Quicksilver.

Step 1 – Create a Separate Eclipse Launcher

There are lots of ways to launch separate Eclipse instances. The way outlined below lets you launch separate instances from the dock, Spotlight or, my preferred mechanism, Quicksilver.

First, open up a Terminal and type the following. Make sure to replace ‘/Applications/eclipse’ with the path to your eclipse installation.

cd /Applications/eclipse

Next we make a copy your existing Eclipse.app. Name this whatever you like as long as it ends with ‘.app’. For this example, we’ll call it ‘MyEclipse.app’.

cp -R Eclipse.app MyEclipse.app

Now we need to edit some files in MyEclipse.app. Note – Replace ‘vi’ with your favorite editor.

cd MyEclipse.App/Contents
vi Info.plist

Now you’ll want to replace

<key>CFBundleName</key>
    <string>Eclipse</string>

with

<key>CFBundleName</key>
  <string>MyEclipse</string>

Step 2 – Set Default Workspace

Now that we have a separate Eclipse Launcher, lets configure it to open a specific workspace. For the example, replace ‘/Full/Path/To/Your/Workspace’ with your actual workspace directory.

Using the same Terminal session, we edit the file ‘eclipse.ini’ to configure Eclipse. Make sure you are still in the ‘/Applications/eclipse/MyEclipse.app/Content/’ directory.

cd MacOS
vi eclipse.ini

At the top of the file, add

-data
/Full/Path/To/Your/Workspace

Note – Its important that you put -data and /Full/Path/To/Your/Workspace on separate lines. ‘eclipse.ini’ is parsed in such away that options and the arguments to the options have to be on their own line.

Problem Solved!

At this point, you can open a Finder window to your Eclipse installation directory (i.e. ‘/Applications/eclipse’) and drag ‘MyEclipse.app’ to your dock if you wish. Or you can just launch it using Spotlight or Quicksilver. ‘MyEclipse.app’ will launch an eclipse using the workspace you assigned in Step 2. You can repeat this process for any number of Eclipse launchers you want.

Launching under Spotlight

MyEclipse.app in Spotlight

Launching in Quicksilver

MyEclipse.app in Quicksilver