[Java – Ubuntu] Install the JDK and Eclipse on Ubuntu offline

The way in order to install ubuntu software center or online, then you can do easily. Following his room stating how to install offline when no network.

1. Install JDK

You Click here download the appropriate JDK and extract it out. (his jdk1.7.0_21)

Run the following command to create a directory jvm

sudo mkdir /usr/lib/jvm/

cd to the directory where the file is unzipped and run:

sudo mv jdk1.7.0_21/ /usr/lib/jvm/jdk1.7.0_21

2. Install Java

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0_21/jre/bin/java 0 

give a true copy of your jdk

3. Download and install Eclipse SDK

You Click here to download Eclipse. The SDK (Eclipse Classic) is so common to many languages (if only C / C or Java, you can download the individual (Eclipse for Java Developers hoặc Eclipse for C/C Developers, …)).

cd to the directory eclipse just down load and run the following command:

tar xzf eclipse-SDK-3.6.2-linux-gtk.tar.gz
sudo mv eclipse /opt/eclipse
cd /opt
sudo chmod -R +r eclipse
cd eclipse
sudo chmod +x eclipse
Attention: in current 1 and current 3 you enter the file name, depending on the file that you have downloaded.

Run the following command to create executable shell for eclipse:

cd /usr/local/bin
sudo touch eclipse
sudo chmod 755 eclipse
sudo gedit eclipse
Gedit editor will be displayed. You insert this code into and save:
#!/bin/sh
export ECLIPSE_HOME=/opt/eclipse
$ECLIPSE_HOME/eclipse $*
Create a shortcut for Eclipse
Run the following command:

sudo gedit /usr/share/applications/eclipse.desktop

then insert this code into:

[Desktop Entry]
Encoding=UTF-8
Name=Eclipse
Comment=Eclipse Helios IDE
Exec=eclipse
Icon=/opt/eclipse/icon.xpm
Terminal=false
Type=Application
Categories=GNOME;Application;Development
StartupNotify=True

Save & quit. Giờ thì Eclipse đã có trong danh sách Search Applications của bạn 😀

Fix java command does not translate

After completing the above steps, if you can not translate java command, set an environment variable in java 2 command:

export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_21/
export PATH=$JAVA_HOME/bin:$PATH

Source & refer: http://ubuntu102.blogspot.com, http://wikilinux.vn, http://littlebookwormblog.wordpress.com