Installing eclipse for multiple programming languages
I can do almost everything I need to do in OS X but just occasionally I need Linux. So I recently installed a VirtualBox VM running Ubuntu 9.10. I use Eclipse as my favoured IDE since I can run it on all three of the major OSes and it has good support for C, C++ and Java which is what I use mostly for work. So the next thing for me was to install Eclipse. This is where things became interesting.
My usual technique for installing Java and Eclipse on Linux is to grab the JDK from Sun’s site and Eclipse from the Eclipse site. (Never try to run Eclipse on GNU Java, it just doesn’t work.) I did this, installed Java, unpacked Eclipse and ran it. It just didn’t seem to run right. I suspected some Ubuntu 9.10 incompatibility since it was shortly after the release. So I decided to use the Ubuntu packages for Sun’s Java and Eclipse. It worked but the latter was somewhat minimalist.
I really wanted to run ‘proper’ Eclipse as released by Eclipse so it was time to Google for the problem and I found this link. It turns out that there is a bug in Eclipse to do with GTK which will be fixed in the next release. However you can work around it. Put the following shell script in to your Eclipse directory and when you run Eclipse using that and not the binary directly its fixed.
#!/bin/bash export GDK_NATIVE_WINDOWS=1 /path/to/eclipse/eclipse
Anyway that’s a bit of an aside. So now the post proper, how do you install Eclipse for multiple languages? This is what I did.
Eclipse for C/C++
Java Development Tools
These come from http://download.eclipse.org/eclipse/downloads. Scroll down the page until you find ‘JDT Runtime Binary’ and select the latest version. This will download a ZIP file containing all the additional Java classes which provide the Java Development Tools.
Eclipse ZIP files are typically one of two kinds. Either a collection of files you unzip in the directory where you eclipse directory is or one which that’s an ‘All in 1′ update site. The latter is a zip file that you can install via the Eclipse IDE itself since it contains the appropriate site.xml file used by the Eclipse installer.
The Eclipse JDT ZIP is not an update site so you will need to unzip in it in the directory you untarred the original files. I.e. /usr/local. If there are any clashes (because the file already exists) just select ‘N’ meaning don’t overwrite.
Once you’ve unpacked start Eclipse (sudo /path/to/eclipse/eclipse.sh) to ensure it looks sane. You run it as root until you’re completely installed so that the extensions are installed for all users. Hopefully, if all is well, you should see C/C++, CVS and Java projects available in the Projects menu. Leave Eclipse running.
DLTK, EMF-XSD and GEF
DLTK is the Dynamic Languages Toolkit extension; EMF is the Eclipse Modelling Framework extension and GEF is the Graphical Editing Framework. These form dependencies on the Web Tools and the PHP Development Tools. Download the ‘All in 1′ update sites for these as follows.
Go to http://download.eclipse.org/technology/dltk/downloads/. Select ‘Stable’ and then the ‘All in 1 Update Site’ bundle. Save the ZIP somewhere sensible.
Go to http://www.eclipse.org/modeling/emf/downloads/?project=emf. Select the ‘All in 1 Update’ bundle and again save it.
Go to http://www.eclipse.org/gef/downloads/ and select the ‘All in 1 Update’ and save it.
In the help menu select ‘Install new software’. The top right of the dialog that appears is an ‘Add’ button which adds a new install site, i.e. a URI from which new software can be installed. Click on it.
A new dialog appears with two fields. Type ‘DLTK Local’ in the first (‘local’) field. This is the short name the install site will be known as locally. Click on the ‘Archive’ button and navigate to the DLTK ZIP file you downloaded. Select it. Then click the ‘OK’ button in the new site dialog.
Now Eclipse will display what software is available from your install site (i.e. the DLTK ZIP file). If you expand the tree you will see a whole selection of different components. Some will have ‘SDK’ as part of the name. These components are ones which allow you to develop the Eclipse components themselves. You don’t need these if you are using Eclipse to develop regular code so ignore those. For DLTK I selected the core component and support for Python and Ruby (since I want to learn them at some point).
Click ‘Next’. All the dependencies should be there. Eclipse may install additional packages which are dependencies on the one’s you’ve selected. It may also show a licence agreement you need to agree to. Click through until ‘Finish’ is shown. Click ‘Finish’ to install the software. Eclipse may want to restart at this point, everyone apart from Ubuntu 9.10 users can click ‘Restart’ here. Because of the bug Ubuntu 9.10 users should click ‘No’ and exit and restart Eclipse manually using the shell script as described above.
Do the same for the EMF-XSD package and select ‘XSD-XL Schema Model, XSD Documentation and XSD Edit’. (Probably not all needed but useful). Install and restart as before. Add the GEF ZIP to the install sites so that it can be found later but don’t bother installing anything if you don’t want to. This seems to be needed by the Web Tools but I didn’t want anything from it myself.
You should now have Ruby and Python projects as well as DTD, XSD, etc. projects available in the projects menu. Quit Eclipse.
Web Tools Platform
Like the JDT ZIP this is not an install site so needs to be unpacked in the same directory as you unpacked Eclipse and the JDT ZIP. You will need to be superuser as before. Again there may be files that already exist so you have to stop them from being over written.
PHP Developer Tools
Finally we can install PDT. You can get the all in one update site from http://www.eclipse.org/pdt/downloads/ as a ZIP. In Eclipse using the ‘Install New Software’ dialog add it as an install site, select the PDT tools and install them. Eclipse will install anything it needs from the other install sites you used earlier. Finally restart Eclipse one last time.
Yay! You should have Eclipse installed for a whole bucket load of languages. Because you installed the plug-ins as superuser they are available for everyone on your system. Finally, because you don’t want to have to do this all over again should something go wrong, tar up the entire Eclipse directory and put it somewhere safe.