I want to play Java games on my Ubuntu 16.04 LTS Laptop. I have looked at many tutorials across the web and keep getting confused and hitting error messages. Please help. (Former Windows User)
-
1Please edit your question to clearly explain exactly what you have tried and the complete, exact error messages that resulted. The details matter a lot. – user535733 Feb 19 '17 at 01:16
-
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable) E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it? – Owen. Feb 19 '17 at 14:06
-
I can't do anything because of this message – Owen. Feb 19 '17 at 14:07
-
Next time, look just a little harder: http://askubuntu.com/questions/15433/unable-to-lock-the-administration-directory-var-lib-dpkg-is-another-process – user535733 Feb 19 '17 at 14:10
3 Answers
You can install java from the commandline with:
$ sudo apt install openjdk-8-jdk
You can get to a terminal commandline by hitting this keyboard shortcut: Alt+Ctrl+T
The $ you see in the commanline is the prompt you see when your enter the terminal mode. Type in the text the follows and press ENTER.

- 25,036
If you would like to use Oracle's Java, you can install it with a PPA. First open a terminal by using Ctrl+Alt+T and run the following commands:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
The first command adds the PPA so you are able to download Java. The second command 'refreshes' or 're-syncs' the avaliable packages. The last one installs Oracle's Java, version 8.
After it has installed, you can check by running:
java -version

- 5,193

- 61
-
1Please use the
{}
button in the editor for multiline terminal commands, and surround keys with<kbd>
and</kbd>
. – Chai T. Rex Feb 19 '17 at 02:05
I prefer to install Oracle's Java. Here are the steps:
Open a terminal with CTRL + ALT + T
, or just type terminal
in dash.
Then start typing . . .
1) First add the PPA
sudo add-apt-repository ppa:webupd8team/java
2) Update your repositories
sudo apt-get update
3) Install Java version of your preference
sudo apt install oracle-java8-installer
If you prefer to install another Java version, just change "8" to your desired version, for example, if you want to install Java 6 just type this: sudo apt install oracle-java6-installer
4) Mark Java version as default (if you installed Java 8)
sudo apt install oracle-java8-set-default
In this link you can find more information about: http://tipsonubuntu.com/2016/07/31/install-oracle-java-8-9-ubuntu-16-04-linux-mint-18/
-
After doing your third step, a EULA came up, and when I click OK nothing happens – Owen. Feb 19 '17 at 14:31
-
You have to press Tab until it highlights the OK, then press Enter. – Chai T. Rex Feb 19 '17 at 19:32