Hot answers tagged

333

Remove all the Java related packages (Sun, Oracle, OpenJDK, IcedTea plugins, GIJ): dpkg-query -W -f='${binary:Package}\n' | grep -E -e '^(ia32-)?(sun|oracle)-java' -e '^openjdk-' -e '^icedtea' -e '^(default|gcj)-j(re|dk)' -e '^gcj-(.*)-j(re|dk)' -e '^java-common' | xargs sudo apt-get -y remove sudo apt-get -y autoremove Purge config files (careful. This ...


282

You can do this for; Final Update JDK sudo apt-get install openjdk-8-jdk JRE sudo apt-get install openjdk-8-jre Old Update I found two repository but I do not recommend OpenJDK builds (all archs) ppa:openjdk-r/ppa OpenJDK 8 backport for trusty ppa:jochenkemnade/openjdk-8 Original Message If you really want to use OpenJDK, you have to compile ...


187

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


159

Switching between installed Java versions can be accomplished using the update alternatives command. To get a list of your installed Java platforms, run the following command from the terminal: sudo update-alternatives --config java This will give you a list output similar to this: There are 2 choices for the alternative java (providing /usr/bin/java). ...


149

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 last upload for OpenJDK 7 was done '2016-04-22' with version 7u95 and still available as 'latest', where Ubuntu 14.04 has been updated to 7u181. UPDATE : ...


106

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 java version as default (needs root permissions): sudo update-java-alternatives --set /path/to/java/version ...where /path/to/java/version is one of those ...


105

The simplest way is: update-java-alternatives -l shows you all the Java versions you have installed. java -version shows you the Java version you are using. java -showversion shows you the Java version you are using and help. Normally it would be OpenJDK.


100

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" and you know which files will be silently overwritten.


84

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 automatically and started showing me the source code.


78

You can completely remove the OpenJDK and fresh Install Oracle Java JDK by following these steps: Remove OpenJDK completely by this command: sudo apt-get purge openjdk-\* Download the Oracle Java JDK here. Note: download appropriate file, for example if your system is x64 Ubuntu (i.e, Debian) the download file is named like this: jdk-8u51-linux-x64.tar....


76

Installing JDK To install JDK, you can refer to help.ubuntu.com/community/Java. If you want to install openJDK, sudo apt-get install openjdk-7-jdk If you want to install Oracle JDK, you can use PPA from webup8 team. sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java7-installer Installing IntelliJ IDEA [...


69

Great question, I was wondering this myself. I found that you can use the following to remove the openjdk-7-jre on Ubuntu 13.04: sudo apt-get autoremove openjdk-7-jre Press 'y' and then press enter when prompted to confirm this change. This should also clean up all the additional dependency libraries that were installed with it. I also found you can use ...


65

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 contained more recent security updates. Please refer to the other answers until this can be resolved (sorry, no ETA). It does not look like the maintainer of ...


63

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. Our plan is to release OpenJDK 10 as the default JRE/JDK 1 for Bionic, and then move the default JRE/JDK in main to OpenJDK 11 in September/October 2018 as an ...


62

OpenJDK 8 was released in March 2014. As of the time of this question, there are no OpenJDK 8 packages in the official Ubuntu repositories for any Ubuntu release. They "will be available soon", as the JDK 8 project page says, for some definition of soon. First, the OpenJDK 8 packages will land in the Ubuntu development release. This may happen during the 14....


59

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 /usr/bin/java). Selection Path... ------------------------------------------------------------ 0 /usr/lib/jvm/java-9-oracle/bin/java... * 1 ...


59

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 other releases) despite the error message about not overwriting a file provided by its dependency openjdk-9-jdk-headless: Normally try to install the openjdk-9-jdk ...


58

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


56

Alternate install Java for Chrome, can also install icedtea: sudo apt-get install icedtea-7-plugin Then link icedtea in to chromium plugin folder thusly cd /usr/lib/chromium-browser/plugins and link sudo ln -s /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/IcedTeaPlugin.so


55

If you are using Debian Jessie (or Ubuntu 13.10+), try sudo apt-get install lib32stdc++6


46

This problem is occurring because the Android SDK is compiled for a 32-bit GNU/Linux system, and your Ubuntu system is a 64-bit GNU/Linux system. The solution should be easy (since Ubuntu fully supports running 32-bit programs on a 64-bit OS)--just install the 32-bit versions of the libraries it needs. The simplest and easiest way to do this is to install ...


45

This guide (Which took me a little over 3 days to write and test) was made to solve most problems regarding the correct installation of Minecraft. It is very thorough and oriented for Ubuntu 11.10+ since this was the first version to include OpenJDK 1.7, but it might still be missing more information to solve more problems regarding Minecraft. I also did ...


41

This command should tell you what is currently providing the Java virtual machine (java) and the Java compiler (javac): file /etc/alternatives/java /etc/alternatives/javac This assumes the "alternatives" system is working properly, which might not be the case, depending on how Java has been "messed up" in the past. To check this, run: file `which java ...


39

There are currently two Java versions (vendors, if you will) available: Oracle's (previously Sun) JDK, the closed source Java, with commercial support from Oracle 'n stuffs. OpenJDK, the open source Java. Oracle released part of their source and renamed it. In the days of Java 6, there used to be a big difference between the two of them, OpenJDK running ...


37

Simply do (in terminal): update-alternatives --list java And you'll get an output like this: michael@NEXUS-TWO:/usr/lib/x86_64-linux-gnu/bamf$ update-alternatives --list java /usr/bin/gij-5 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java The last line is the place your java is in.


36

This thread was the fix for me. Specifically, installing this package: sudo apt-get install lib32z1 lib32z1-dev


35

Note – This will only work with 14.10 or later: 1 year late, but as today it works as expected with apt-get. For installing JDK: $ sudo apt-get install openjdk-8-jdk For installing JRE: $ sudo apt-get install openjdk-8-jre How to set the default JDK Fastest way Run $ sudo update-alternatives --config java and enter the number for which JDK to ...


34

Actually, a better answer is to enter the following at the command prompt. sudo update-ca-certificates -f


31

You can use the following command: sudo apt-get purge openjdk-8-jre openjdk-8-jre-headless openjdk-7-jre gcj-4.7-base gcj-4.7-jre openjdk-6-jre-headless In this way no new packages will be installed. Here is my output for the above command: Reading package lists... Done Building dependency tree Reading state information... Done Package 'gcj-4.7-...


29

You can select java version using update-alternatives command. Run below command in terminal. sudo update-alternatives --config java And type selection number that you want to use. Like this: Caution: The above description is the procedures for changing a default version. It is not an answer of this question, but it leaves for reference.


Only top voted, non community-wiki answers of a minimum length are eligible