Download jdk (which automatically includes jre) through Java JDK Download (Also, see the screenshot attached.)
Once downloaded, you can follow instructions over here,
Say you downloaded a .bin file, such as jdk-6u17-linux-i586.bin
$pwd
/home/myName
$ls
jdk-version-6-u17-linux-i586.bin
$chmod +x jdk-6u17-linux-i586.bin
going to directory where I want java to be installed
$cd /usr/local/
executing the .bin file
$/home/myName/jdk-6u17-linux-i586.bin
it will display some text on screen, that is the license agreement. Keep pressing enter to scroll. It is a long document, so you might want to press enter around 50 times or more. When the license agreement ends, you will see a question
Do you agree above license terms? [yes or no]
type yes and press enter.
and watch it installed.
After installation is done, the prompt will come back to you.
Now for the one last step. We need to create a link.
$ln -s /usr/local/jdk1.6.0_17/bin/java /usr/bin/java
(I am assuming, upon running the .bin file, you will see a folder named jdk1.6.0_17 in /usr/local/. The folder name could change, but it will be created in /usr/local/)
$java -version
It should show you the version installed.
$whereis java
will show you were java files and jave executable are placed.
If above two, does not work, it means java did not set in the path.
Your java is installed in /usr/local
Go there and look for folder. It should be jdk-1.6.0_17 (or something like that),do
$cd jdk-1.6.0_17/bin/
$pwd
/usr/local/jdk-1.6.0_17/bin/
Your path to java is /usr/bin/java (which is link to /usr/local/jdk-1.6.0_17/bin/java). You will need to set path in your .bash_profile
Look for my previous post on how to do it.


No comments:
Post a Comment