Check if you have Java installed on your system. To do this, you have to run the Java version command from terminal.
Command : java -version
If java is already present in your system then you will see something like the below
Java HotSpot(TM) Server VM (build 23.6-b04, mixed mode)
If you don't have java installed then you can install it by following this post
-> Download the Oracle Java JDK/JRE for Linux from here.
Make sure you select the correct compressed binaries for your system architecture 32-bit or 64-bit
(which end in tar.gz).
-> Copy the Oracle Java binaries into
/usr/local/java directory
In most cases, the Oracle Java binaries are downloaded to:
/home/"your_user_name"/Downloads
-> Once you have downloaded , the next step is to install it. The following lines will guide you in the installation process.
Installation instructions for 32-bit Oracle Java on 32-bit Ubuntu Linux
Type the following commands in the terminal
1. Command to traverse to the location where you have downloaded the Oracle java binaries
cd /home/"your_user_name"/Downloads
2. Command to copy the downloaded jdk into an appropriate location for easy installation and configuration
sudo cp -r jdk-7u21-linux-i586.tar.gz /usr/local/java
3. Command to copy the downloaded jre into an appropriate location for easy installation and configuration
sudo cp -r jre-7u21-linux-i586.tar.gz /usr/local/java
4. Now traverse to the directory where you have copied the jre and jdk by typing the following command.
cd /usr/local/java
Installation instructions for 64-bit Oracle Java on 64-bit Ubuntu Linux
Type the following commands in the terminal
Type the following commands in the terminal
1. Command to traverse to the location where you have downloaded the Oracle java binaries
cd /home/"your_user_name"/Downloads
2. Command to copy the downloaded jdk into an appropriate location for easy installation and configuration
sudo cp -r jdk-7u21-linux-x64.tar.gz /usr/local/java
3. Command to copy the downloaded jre into an appropriate location for easy installation and configuration
sudo cp -r jre-7u21-linux-x64.tar.gz /usr/local/java
4. Now traverse to the directory where you have copied the jre and jdk by typing the following command.
cd /usr/local/java
The next step is to Unpack the compressed Java binaries, in the directory /usr/local/java
For 32-bit : Type the following commands
sudo tar xvzf jdk-7u21-linux-i586.tar.gz
sudo tar xvzf jre-7u21-linux-i586.tar.gz
For 64-bit : Type the following commands
sudo tar xvzf jdk-7u21-linux-x64.tar.gz
sudo tar xvzf jre-7u21-linux-x64.tar.gz
By now, you should have two uncompressed binary directories in /usr/local/java for the Java JDK/JRE
Type ls -a to check it
, it should display as shown below
jdk1.7.0_21
jre1.7.0_21
Now Edit the system PATH file /etc/profile and add the following system variables to your system path.
note:- you can use nano, gedit or any other text editor, as root, open up /etc/profile.
For gedit: Type the following command
sudo gedit /etc/profile
For nano: Type the following command
sudo nano /etc/profile
Scroll down to the end of the file using your arrow keys and add the following lines to the end of your /etc/profile file:
JAVA_HOME=/usr/local/java/jdk1.7.0_21
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
JRE_HOME=/usr/local/java/jre1.7.0_21
PATH=$PATH:$HOME/bin:$JRE_HOME/bin
export JAVA_HOME
export JRE_HOME
export PATH
Save the /etc/profile file and exit.
Reload your system wide PATH /etc/profile by typing the following command:
. /etc/profile
leave your doubts or suggestions in comments section..
nice post
ReplyDeleteThanks a lot abdulla !!! pls let us know if you would like to have posts on some other topic too
Deletehttp://wetechies.blogspot.in/2013/05/installing-tomcat-in-linux.html
osmaniye
ReplyDeleterize
sakarya
samsun
sivas
6HAS