Java Version alternatives alternatives
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/ jdk1.8.0/bin/java" 1
sudo update-alternatives --config java
set environment variables as follows
Edit the system Path file /etc/profile
sudo gedit /etc/profile
Add following lines in end
Java is typically installed in /usr/java locate the version you have and then do the following:
Assuming you are using bash (if you are just starting off, i recommend bash over other shells) you can simply type in bash to start it.
Edit your ~/.bashrc file and add the paths as follows:
for eg. vi ~/.bashrc
insert following lines:
export JAVA_HOME=/usr/java/<your version of java>
after you save the changes, exit and restart your bash or just type in bash to start a new shell
Type in export to ensure paths are right.
Type in java -version to ensure Java is accessible.