Learning Pages
LearningPages.org.uk


Home  Mobile  

7 Training Secrets

Anecdotes
Consultants
eBooks
Gurus
Hints and Tips
Icebreakers
Links
MTTP
Quotes
Resources
Venues
News

Shop

Web Services
Data Services

Support

Support us

Follow us on Twitter    
How to Install Java on Linux
(the easy way)
mwls.com



After spending many hours searching the Internet and following many different instructions and typing thousands of commands into the terminal with the process always failing (usually at the last input), I've finally found a way of installing Java on Debian, Linux Mint and Ubuntu etc..


Check Installation and Version

To run Java programs you need to have the Java Runtime Environment (JRE) installed. You can see whether it is already installed by using the Terminal. First update the package index:

sudo apt-get update

and then check the version:

java -version

If it returns "The program java can be found in the following packages", Java hasn't been installed yet. If Java is installed, it might not be the version you want, so use the following instructions to install the correct version.


Install

Execute the following command where the number 8 (in this case) is the Java version that you want to install:

sudo apt-get install openjdk-8-jre

If you get an error message similar to "E: Unable to locate package openjdk-8-jre" then try installing a different repository:

sudo apt-add-repository ppa:openjdk-r/ppa

sudo apt-get update

Try installing again.

Configure

List the installed Java versions:

sudo update-alternatives --config java

Choose version by entering the 'Selection' number of required version.

Java Development Kit

If you want to develop Java programs, you will need to install the Java Development Kit (JDK). You can install the JDK by following the above instructions but substituting:

sudo apt-get install openjdk-8-jre with

sudo apt-get install openjdk-8-jdk



 

top