I cant get it install and I need it running for a job application i need to put in online.
jre-7u51-linux-i586.tar.gz
that's the file and every time I try to install it wont complete, says cannot find file.
You can use
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-jdk7-installer
This will install Oracle JVM and will update it when needed.
But if you want to install JVM manually, you should use these commands:
tar -xzf jre-7u51-linux-i586.tar.gz
sudo mv jre1.7.0_51/ /usr/lib/jvm/jre1.7.0_51
Then run
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jre1.7.0_51/jre/bin/java
and
$ sudo update-alternatives --config java
There are 3 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
--------------------------------------------------------------------------------
* 0 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 auto mode
1 /usr/lib/jvm/ia32-java-6-sun/jre/bin/java 63 manual mode
2 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 manual mode
3 /usr/lib/jvm/java-6-sun/jre/bin/java 63 manual mode
4 /usr/lib/jvm/jre1.7.0_51/jre/bin/java 4 manual mode
Press enter to keep the current choice[*], or type selection number:
Follow the instructions on screen. Your numbers would be quite different from mine.
update-alternatives: --install needs <link> <name> <path> <priority>
and it exits.
If you want to have Java 7, follow this:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer oracle-java7-set-default
Oracle java is better than the openjdk in terms of performance IMO
Now the commands should be:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update #(skip this line for Ubuntu 18.04)
sudo apt-get install oracle-java8-installer
oracle-java8-set-default will be installed automatically on Ubuntu. For other OSes, the last line should be
sudo apt-get install oracle-java8-installer oracle-java8-set-default
The sudo apt-get
procedures don't currently work due to changes at Oracle. @Danatela had the best answer that worked for me. There is only one change to using his sudo update-alternatives --install
command.
The command should include a priority value at the end so is looks like --install <link> <name> <path> <priority>
I updated the current JDK (complete file is jdk-12.0.2_linux-x64_bin.tar.gz) in the following command:
sudo update-alternatives --install /usr/bin/java java /usr/lib/java/jdk-12.0.2_51/bin/java 1
where link = /user/bin/java
, name = java
, path = /usr/lib/java/jdk-12.0.2_51/bin/java
, and priority = 1
(auto)