Eclipse PDT IDE for PHP MySQL 32 Bit install on 64 Bit Ubuntu

Posted by on Feb 29, 2008 in Eclipse, Programming, Technology, Ubuntu60 comments

Eclipse SDKPlease Note: This article is now deprecated in favour of “Full 64 Bit (or 32 Bit) Web Development and PHP/MySQL IDE with Eclipse 3.4 Ganymede and PDT 2”. Thanks!

Update 12/04/08: I have now successfully installed the x64 version of Eclipse – see 64 Bit Eclipse: Linux Installation, including PDT, WTP (WST), ATF, and MySQL (SQL Explorer Plugin) for a step by step guide, or continue reading this article if you want to install the 32 bit version.

32 Bit installation

I went through several different methods of installing the Eclipse IDE on my Ubuntu system. I tried the obvious first – installing via the Synaptic Package Manager, but found it a bit of a pain to install any plugin packages I downloaded (I also use WST and SqlExplorer in addition to PDT). So, I uninstalled, then tried the 64 Bit version of the SDK (which at the time was pretty buggy, and unstable), in the hope that I’d be able to plug in a 64 Bit version of the PDT, which I soon found doesn’t exist yet! So, I finally settled for installing the 32 Bit version of Eclipse PDT, which enabled me to install the plugins too.

In order to install and run this successfully, I first downloaded the 32 Bit Java Runtime Environment installer “Linux (self-extracting file)” from http://www.java.com/en/download/linux_manual.jsp (or direct link to the file), and saved the jre-6u3-linux-i586.bin to my desktop.

Once the file downloaded, I opened up a Terminal (Applications -> Accessories -> Terminal), and typed

cd /usr/java

(if the java directory doesn’t exist, it need to be created:

sudo mkdir /usr/java
cd /usr/java

I also wanted a 64 bit version of the JRE installing, so within the /usr/java directory, created two more sub directories:

sudo mkdir 32
sudo mkdir 64

then copied the newly downloaded JRE installation file from the desktop to the /usr/java/32 directory, and made the file executable:

cd 32
sudo mv ~/Desktop/jre-6u3-linux-i586.bin /usr/java/32/jre-6u3-linux-i586.bin
sudo chmod a+x jre-6u3-linux-i586.bin

then execute the binary:

sudo ./jre-6u3-linux-i586.bin

Accept the terms, and so on and so forth… When it says “Done”, it’s, well, done!

ls

should return:

jre1.6.0_03

Note: If you download a newer version of JRE, then you’ll need to change the above commands containing “jre-6u3-linux-i586.bin” to “jre-6u<version>-linux-i586.bin” where <version> is 3, 4, 5 etc.!

Now for Eclipse. I downloaded the latest version from http://download.eclipse.org/tools/pdt/downloads/ (the current stable version is R20080103) – I click on the link for the latest release, and downloaded the pdt-all-in-one-R20080103-linux-gtk.tar.gz file to the desktop. Once it finished, I went back to the terminal, and entered the /opt directory, moved the Eclipse package to the /opt directory, and extracted the new files:

cd /opt
sudo mv ~/Desktop/pdt-all-in-one-R20080103-linux-gtk.tar.gz /opt
sudo tar -zxvf pdt-all-in-one-R20080103-linux-gtk.tar.gz

This extracts the Eclipse IDE into a directory called, oddly enough, “eclipse”. However, I’m experimenting with the 64 bit version too, so I changed the directory name to eclipse32:

sudo mv eclipse eclipse32

As it was, Eclipse wouldn’t run, since it doesn’t know where to find the JRE I’d just installed, so, I had to create a small shell script in order for it to run correctly:

cd eclipse32
gksu gedit eclipse.sh

This opened up a text editor, with a blank file called “eclipse.sh”. The shell script is:

#!/bin/bash
PATH=/usr/java/32/jre1.6.0_03/bin:$PATH
/opt/eclipse32/eclipse

PATH=/usr/java/32/jre1.6.0_03/bin:$PATH should point to the bin directory of the previously installed.

The script also needed to be executable:

sudo chmod 755 eclipse.sh

and I also changed the ownership of all the files and directories to my username:

sudo chown -R username:group *

That was pretty much it – I could run Eclipse by opening a Terminal window and running

cd /opt/eclipse32
./eclipse.sh

which got a little tiresome after the first time, so I created a menu item (System -> Preferences -> Main Menu) which pointed to /opt/eclipse32/eclipse.sh, and even included the png Eclipse logo for the icon :)

Any plugins can be downloaded, and extracted into the relevant directories – or, installed by the Eclipse Update Manager.

I’ve recently written a post on “Eclipse PDT and MySQL – SQL Explorer Plugin“, for anyone who needs to set up MySQL connections in Eclipse.

Tags: , , , , , , , ,