I got this error when I tried to install java on Ubuntu 10.04
apt-get sun-java6-sdk
E: Package sun-java6-jdk has no installation candidate ubuntu 10.04
to get rid of this I added
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
sudo apt-get install sun-java6-jdk
and then I was able to install
Then I need to set JAVA_HOME and JRE_HOME
find where is java
so I did
Step 1)
find / -name java
I got
/usr/bin/java
/usr/lib/jvm/java-6-sun-1.6.0.20/bin/java
/usr/lib/jvm/java-6-sun-1.6.0.20/jre/bin/java
/usr/lib/jvm/java-6-openjdk/bin/java
/usr/lib/jvm/java-6-openjdk/jre/bin/java
/usr/share/java
/var/www/efront/www/editor/tiny_mce_new/plugins/java
/var/www/efront/www/editor/tiny_mce/plugins/java
/var/www/efront/www/content/lessons/1/java
/var/www/atutor/tools/packages/scorm-1.2/java
/var/lib/dpkg/alternatives/java
/etc/ssl/certs/java
/etc/alternatives/java
/etc/bash_completion.d/java
in second line is java6-sun that is what I needed
Step 2) in /etc/profile added following lines
JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.20/bin
JRE_HOME=/usr/lib/jvm/java-6-sun-1.6.0.20/jre/bin
PATH=$JAVA_HOME:$JRE_HOME:$PATH
Step 3 ) Note in above I have kept JAVA_HOME before $PATH in third line so as to give priority to sun java on the default java of Ubuntu.
In other wise case it will first search for /usr/bin/java and not
/usr/lib/jvm/java-6-sun-1.6.0.20/bin/java
which is what I need.
No comments:
Post a Comment