2. Installing JDK
Download JDK from Oracle site
http://www.oracle.com/technetwork/java/javase/downloads
The installation file I use is jdk-7u2-linux-i586.tar.gz.
Change directory to install the JDK code in /opt
cd /opt
extract the JDK files
sudo tar -xvzf <location of downloaded JDK>/jdk-7u2-linux-i586.tar.gz
This will put the JDK into the newly created directory named jdk1.7.0_02
Update environment variables to point to the newly installed JDK by editing the /etc/environment file.
sudo nano /etc/environment
Add the JAVA_HOME variable, and add JDK bin to the PATH variable.
JAVA_HOME="/opt/jdk1.7.0_01"
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/jdk1.7.0_01/bin"
Refresh the environment variable.
source /etc/environment
Verify that the updated environment variables are in place and the path to the JDK is valid
$ echo $JAVA_HOME
/opt/jdk1.7.0_01
$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/jdk1.7.0_01/bin
$ javac -version
javac 1.7.0_01
3. Update Java alternative list. You want to set a higher priority for the new JDK.(If you have already
installed open-jdk)
$ update-alternatives --verbose --query java
Link: java
Status: auto
Best: /usr/lib/jvm/java-6-openjdk/jre/bin/java
Value: /usr/lib/jvm/java-6-openjdk/jre/bin/java
Alternative: /usr/lib/jvm/java-6-openjdk/jre/bin/java
Priority: 1061
Slaves:
java.1.gz /usr/lib/jvm/java-6-openjdk/jre/man/man1/java.1.gz
So, let’s make the new JDK our default…
sudo update-alternatives --install /usr/bin/java java /opt/jdk1.7.0_02/bin/java
update-alternatives: using /opt/jdk1.7.0_01/bin/java to provide /usr/bin/java (java) in auto mode.
Now type
java -version
java version "1.7.0_02"
Java(TM) SE Runtime Environment (build 1.7.0_01-b08)
Java HotSpot(TM) 64-Bit Server VM (build 21.1-b02, mixed mode)
4. Installing eclipse
1. Download Eclipse Indigo from homepage (eclipse-jee-indigo-SR1-linux-gtk.tar.gz for 32 bit OS)
2. Extract to a folder (can use Archive Manager or tar command)
cd /opt
sudo tar -xvzf <eclipse tar ball directory>/eclipse-jee-indigo-SR1-linux-gtk.tar.gz
sudo chown -R root:root eclipse
sudo chmod -R +r eclipse
3. Run Eclipse from command line:
cd <eclipse foler>./eclipse
4. If we get the warning about the GTK same as below:
Gtk-WARNING **: Unable to locate theme engine in module_path: "pixmap",
just install the missing module using below command:
sudo apt-get install gtk2-engines-pixbuf
5. OPTIONAL STEP TO CREATE A LAUNCHER ON DESKTOP
Creating an eclipse executable in path
sudo touch /usr/bin/eclipse
sudo chmod 755 /usr/bin/eclipse
sudo nano /usr/bin/eclipse
Copy this to nano, then save & exit
#!/bin/sh
#export MOZILLA_FIVE_HOME="/usr/lib/mozilla/"
export ECLIPSE_HOME="/opt/eclipse"
$ECLIPSE_HOME/eclipse $*
Create a gnome menu item
sudo nano /usr/share/applications/eclipse.desktop
Copy this to nano, then save and exit
[Desktop Entry]
Encoding=UTF-8
Name=Eclipse
Comment=Eclipse IDE
Exec=eclipse
Icon=/opt/eclipse/icon.xpm
Terminal=false
Type=Application
Categories=GNOME;Application;Development;
StartupNotify=true
Launch eclipse for the first time
/opt/eclipse/eclipse -clean &
6. Prepare Android SDK
1. Download the file “android-sdk-linux.tar.gz” from the babbage
2. Extract it to /opt directory
cd /opt
sudo tar -xvzf <path to the sdk file>/android-sdk-linux.tar.gz
Add ADT plugin to eclipse
Help → Install New Software → Add
7.
8.
9. Finally goto Windows -> Preferences & there you will see a selection “Android”. Select it and set the SDK location