Database Reference
In-Depth Information
$ java -version
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b19) Java
HotSpot(TM) 64-Bit Server VM (build 24.67-b09, mixed mode)
The
sudo alternatives --config java
command can be used to switch the
default version.
Once all this is done, the
Bash
profile can be updated to have
JAVA_HOME
. To do this,
you need to append the following line in
~/.bashrc
:
export JAVA_HOME=/usr/java/jre1.6.0_34
Debian and Ubuntu systems
Fortunately, installing Java on Ubuntu is much easier than on RHEL. It is probably not the
official way to install Java, but is certainly the most popular way. It takes away the pain of
downloading manually and copying over the server. Here are the steps:
1. Add the
webupd8team
PPA repository to the machine:
sudo add-apt-repository ppa:webupd8team/java
2. Update the package list from the repositories and install Java 7:
sudo apt-get update
sudo apt-get install oracle-java7-installer
This will open an interactive shell where you need to accept the Oracle license to
be able to complete the installation.
3. Check your Java version:
$ java -version
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04,
mixed mode)