208
votes
Accepted
Switch between multiple java versions
Apt-get won't overwrite the existing java versions.
To switch between installed java versions, use the update-java-alternatives command.
List all java versions:
update-java-alternatives --list
Set ...
200
votes
How to install OpenJDK 8 on 14.04 LTS?
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-8-jdk
sudo update-alternatives --config java
sudo update-alternatives --config javac
154
votes
How do I install openjdk 7 on Ubuntu 16.04 or higher?
Security Warning
Packages in the PPA mentioned below are not updated with security
patches to Java. Do not use in production; see alternative answers
instead.
At time of writing, the ...
142
votes
Switch between multiple java versions
Use
sudo update-alternatives --config java
which lists all installed versions with current active one marked and provides dialog to switch:
There are 3 choices for the alternative java (providing /...
122
votes
Accepted
How to install JDK sources?
Example for Java 8:
sudo apt-get install openjdk-8-source
apt-get puts it under the relevant JDK location as src.zip: /usr/lib/jvm/java-8-openjdk-amd64/src.zip
Intellij IDEA recognized it ...
102
votes
Accepted
Can not install 'openjdk-9-jdk' because it tries to overwrite file aready included in 'openjdk-9-jdk-headless'
You can directly do sudo apt-get -o Dpkg::Options::="--force-overwrite" install openjdk-9-jdk. If you are here, you already tried the installation without the -o Dpkg::Options::="--force-overwrite" ...
66
votes
How do I install openjdk 7 on Ubuntu 16.04 or higher?
Edit 22-Jul-2019: This answer currently does not work. The below referenced JDK packages are no longer available on Debian Experimental. In any case, they lagged behind Ubuntu Trusty's packages which ...
66
votes
Accepted
How to find path to java?
Simply do (in terminal):
update-alternatives --list java
And you'll get an output like this:
$ update-alternatives --list java
/usr/bin/gij-5
/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
The last ...
63
votes
Accepted
Why is OpenJDK 10 packaged as openjdk-11-*?
This is because those packages will become OpenJDK 11 when that is released. See this mailing list post:
On behalf of the Ubuntu Foundations Team, I am requesting an SRU
exception for OpenJDK. ...
59
votes
Can not install 'openjdk-9-jdk' because it tries to overwrite file aready included in 'openjdk-9-jdk-headless'
I was able to solve the error myself by forcing the file override when installing the .deb package with dpkg.
Here's my workaround to install openjdk-9-jdk on Ubuntu 16.04 Xenial (not tested on ...
58
votes
Accepted
How can I install OpenJDK on Ubuntu 16.04?
had the same problem too.. but i solved it with these commands:
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-7-jre
39
votes
How to install JDK sources?
In case of java 11 (on Ubuntu 18.04) I did:
First I install jdk 11:
sudo apt install openjdk-11-jdk
I install the sources like this:
sudo apt-get install openjdk-11-source
And I found them in /...
33
votes
Jenkins error "Incorrect Java version" for Java11. After removing Java11 and installing Java8. java is not found anywhere
I've just encountered this problem, and it actually looks like an issue in /etc/init.d/jenkins testing for the Java version. I just posted a solution here: https://dorian.fraser-moore.com/works/...
26
votes
17.10 openjdk and oracle jdk 8 and 9 the trustAnchors parameter must be non-empty
I reinstalled everything using apt-get and that didn't solve the problem.
The solution that I found to work: Go to Oracle and download the tar.gz version of jdk-8. Then copy the cacerts file from ...
25
votes
How to find path to java?
You need to dig into symbolic links. Below is steps to get Java directory
Step 1:
$ whereis java
java: /usr/bin/java /etc/java /usr/share/java
That tells the command java resides in /usr/bin/java.
...
24
votes
How can I install OpenJDK on Ubuntu 16.04?
The one I did on 16.04 was:
For OpenJDK 8.X
sudo apt install openjdk-8-jre
For OpenJDK 9.X
sudo apt install openjdk-9-jre
Note: There was no openjdk-6-jre nor openjdk-7-jre for me on Ubuntu 16.04....
23
votes
Accepted
Trying To Install Java 8.. Unable to locate package openjdk-8-jre
OpenJDK8 is not included in Ubuntu 14.04 repositories.
You can install Openjdk8 to Ubuntu 14.04 from a PPA this way:
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get ...
22
votes
Accepted
Is the openjdk-r ppa trustworty?
Yes, it is trustworthy.
The PPA is run by Matthias Klose (Member of Ubuntu, Canonical Partner Developer, Gnome3 Team, Edubuntu developer, Xubuntu developer, ...) .
References :
Matthias Klose ...
19
votes
Accepted
How to install the OpenJDK 8 (Ubuntu 19.04)?
As of now, 30 April 2019 02:00 UTC, Open JDK 8 and its associated packages have been added back to the normal Ubuntu 19.04 Disco Dingo repositories.
So you can now do the usual
sudo apt install ...
18
votes
Accepted
How to install OpenJDK 8 on 14.04 LTS?
As of 2017-08-08 I found that this question and its answers had become a bit overwhelming to dig through to understand the issue, so I have summarized the findings in this answer.
The very short ...
18
votes
Switch between multiple java versions
Configuring Java
You can configure which version is the default for use in the command line by using update-alternatives, which manages which symbolic links are used for different commands.
sudo ...
17
votes
Setup and install IntelliJ with JDK
New way: you can use Ubuntu Make. To install on 16.04 (Xenial) [and later]
sudo apt install ubuntu-make
If your Ubuntu version if before 16.04 (codename Xenial), you can install from the Ubuntu Make ...
17
votes
Setting JDK 7 as default
The most voted answer which suggests to use
update-alternatives
only partially answers the question. By using it you very likely to end up with your Java environment being inconsistent.
This is ...
17
votes
Accepted
How to get Scilab 6.0.1 working on Ubuntu 18.04 LTS?
* Repository-based method (Scilab works, ATOMS does not work)
Update 2021-09-30.
Nowadays Scilab is working again, installable by sudo apt-get install scilab. ATOMS still does not work because of bug ...
16
votes
How do I install openjdk 7 on Ubuntu 16.04 or higher?
You can download a OpenJDK 7 from Azul which may fit your needs. They both have a DEB (for the package system) and a ZIP distribution. I have only worked with the ZIP distribution.
http://www.azul....
15
votes
Accepted
How to tell if a certain package exists in the apt repos?
First of all the availability of packages (and different versions) depend highly on the release you have.
One can do
apt-cache search --names-only '^openjdk-8-.*'
to look for package names that ...
15
votes
Accepted
How to install JDK8 on Ubuntu 16?
Usually you install the openjdk like this:
sudo apt-get install openjdk-8-jdk
Maybe this is the problem. You can look this up at
http://openjdk.java.net/install/index.html.
If you do this you ...
14
votes
Accepted
Unable to open .jar files with Java
You seem to be using a development version of java : Java 9 has not been released yet.
So, first of all, you should remove this version of java, and install the default one :
sudo apt-get remove ...
14
votes
Java can't find cacerts
Run the following commands:
sudo dpkg --purge --force-depends ca-certificates-java
sudo apt-get install ca-certificates-java
Worked for me.
14
votes
java.lang.NoClassDefFoundError: javafx/application/Application
You are getting this error because your runtime PATH to javafx is probably incorrect or missing.
Please, follow these steps:
Check the path of JavaFX. (example: /usr/share/openjfx/lib/)
Then run ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
openjdk × 589java × 455
jdk × 160
apt × 64
software-installation × 55
oracle × 43
minecraft × 38
14.04 × 28
package-management × 28
eclipse × 28
18.04 × 24
netbeans × 22
icedtea × 21
environment-variables × 20
jre × 20
command-line × 18
12.04 × 18
16.04 × 16
javafx × 15
server × 14
installation × 13
firefox × 12
uninstall × 11
android × 11
intellij × 11