Now I am going to explain to you how we can install Oracle JDK 7 in Ubuntu. We can do this with a few simple steps.
What you have to do is to open the terminal in Ubuntu and type the following commands
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
Type your password whenever you are prompted to do so when executing these commands.
Oracle JDK 7 will now be installed in your computer. To verify this you can type the following command in the terminal.
java -version
The following figure will show you how you will see the terminal after executing the above command. It should be something similar.

Now you are done. :)
In order to put the JDK that you just installed, to the PATH environment variable so that it can be accessed by any program that requires Java to run, you can follow the steps explained below.
You should edit the .bashrc file. Execute the following command for that.
gedit ~/.bashrc
I used gedit here. But you can use what ever the editor you want for that.
Now add the following lines to the end of the file .bashrc
export JAVA_HOME=the/path/to/the/directory/where/your/java/is/installed
export PATH=${JAVA_HOME}/bin:${PATH}
You should not change the second line, but change the first line accordingly.
To verify whether the variable is properly set, type the following command.
echo $JAVA_HOME
Then you should see the path that you set getting printed on the terminal. If in case the path is not shown, you will have to restart your computer. Then the path will be shown if you have correctly followed the steps given above.
Now you are ready to go. Cheers. :)
Comments
Post a Comment