Reputation: 20856
Im trying to install Java in install but for some reason its not working.
I tried the same way as mentioned in this website-http://www.java.com/en/download/help/linux_install.xml#enable
I see Java installed in my desktop when I try this command,
premvidya@ubuntu:~/Desktop$ ls jre1.6.0_31 jre-6u31-linux-i586(2).bin jre-6u31-linux-i586.bin
but when I try java - version, I get the following error,
premvidya@ubuntu:~/Desktop$ java -version The program 'java' can be found in the following packages: * gij-4.3 * java-gcj-compat-headless * openjdk-6-jre-headless * cacao * gij-4.2 * jamvm * kaffe Try: sudo apt-get install bash: java: command not found
Any help would be appreciated.
Upvotes: 0
Views: 1662
Reputation: 972
Hi user1050619,
I have come across the solution which will work on any version of Ubuntu definitely keeping other java versions intact.
I have used standalone installation of Java.
For this, please download tar.gz version of Java from Oracle website.
Suppose, your jdk installation tar file at location /home/don/
don@ubuntu ~ $ tar zxf jdk-7u45-linux-i586.tar.gz
don@ubuntu ~ $ sudo bash
[sudo] password for don:
ubuntu ~ # mv /home/don/jdk1.7.0_45/ /usr/lib/jvm/
ubuntu ~ # cd /usr/lib/jvm/
ubuntu jvm # update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0_45/bin/java 3
ubuntu jvm # update-alternatives --config java
Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/lib/jvm/java-7-openjdk-i386/jre/bin/java 1071 auto mode 1 /usr/lib/jvm/java-7-openjdk-i386/jre/bin/java 1071 manual mode 2 /usr/lib/jvm/jdk1.7.0_45/bin/java 3 manual mode Press enter to keep the current choice[*], or type selection number: 2 update-alternatives: using /usr/lib/jvm/jdk1.7.0_45/bin/java to provide /usr/bin/java (java) in manual mode
java -version
and you are done here without any hassles.
Happy programming !!
Upvotes: 1
Reputation: 1744
it should be "apt-cache search java6" or just "apt-cache search java". It'll give you a list of all the package related to java. If you want to install sun's java then you download the java-**.bin file like you did and then run "sudo /bin/sh jre-6u31-linux-i586.bin" That'll run the installer from the sun java you downloaded and begin to install. Answer the question and install the package.
Upvotes: 0
Reputation: 1783
Why are you trying to manually install java? There is a repository for this, and it's all managed for you. Uninstall whatever you have put on your system manually and install it via command line.
apt-get cache search java apt-get cache search jdk
or start Ubuntu Software Center -> search for java.
Once installed via apt-get, the new java commands will be available immediately in your PATH, so long as you haven't removed anything...
Upvotes: 2