I am unable to install JDK on Linux Mint.

I tried the following:

apt-get install openjdk-7-jdk openjdk-7-doc openjdk-7-jre-lib

with the output:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Couldn't find package openjdk-7-jdk

Can anyone help?

  • 1
    Please post your /etc/apt/sources.list
    – A.B.
    Apr 10, 2015 at 13:21
  • @A.B. In Linux Mint, there is nothing in this file usually. Nov 24, 2016 at 7:34
  • Please post ls -l /etc/apt/sources.list.d/ Nov 24, 2016 at 7:34

4 Answers 4


You can also use the WebUpd8 repository:

First upgrade your system:

sudo apt-get update
sudo apt-get upgrade

And if there is no problem, you may add this repository:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

This will also add JAVA_HOME to your PATH.


I'm not completely sure about this problem, but it looks like your dependencies are broken or your package list is outdated.

1) So, try to update your package list:

sudo apt-get update

2) And check your dependencies:

sudo apt-get check

3) If there are some broken dependencies:

sudo apt-get clean
sudo apt-get autoclean
sudo apt-get remove
sudo apt-get autoremove

4) Get back to steps 1) and 2)

If it still doesn't work, try to find and install the package from Synaptic package manager.


Listing your /etc/apt/sources.list.d/ folder would be of help here.

To check if your current repository is updated with the package you want to install, run apt-cache search openjdk-7-jdk if you don't see any listing, you have an obsolete repository on your machine.

Option A: Get the relevant repository for openjdk and add it in your sources.list or better create new file inside /etc/apt/sources.list.d/.

Option B: Try to install the Oracle java, it's more stable and has more support that openjdk


Don't worry about installing through apt. Just download the JDK package directly from Oracle and dowload the script from

NO LONGER VALID LINK: http://1drv.ms/1woCbS5

and paste it into text editor and save it as .sh file. Then you should make the file executable by chmod 755 filename.sh. If you have any doubts please comment.

I got this code from https://askubuntu.com/questions/56104/how-can-i-install-sun-oracles-proprietary-java-jdk-6-7-8-or-jre.

But since it contained JDK 7, I made it to JDK8. Make sure you delete /usr/lib/jvm folder by using rm -rf jvm-folder-path.

  • Please check your spelling, grammar, punctuation before posting here. Nov 24, 2016 at 8:04
  • And don't provide links that may expire. Nov 24, 2016 at 8:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .