On a new Debian system I installed JRE using

sudo apt-get install default-jre

Then I downloaded a jar-file and tried running it:

java -jar server.jar

The file threw an exception:

java.lang.unsupportedclassversionerror unsupported major.minor version 52.0

So I started looking for a solution and followed a user's instruction:

sudo rm /usr/bin/java
sudo ln -s /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java /usr/bin

Afterwards I realized that I don't even have a directory /Library and therefore this link isn't pointing anywhere.

Now I can't even run java anymore:

java -jar server.jar
-bash: /usr/bin/java: No such file or directory

I already tried uninstalling JRE und reinstalling it:

apt-get remove default-jre
apt-get update
apt-get install default-jre

Which didn't change anything though.

Java seems to be installed:

    find /usr -name java

To restore your /usr/bin/java link, you should run

sudo update-java-alternatives -a

If you were using Debian 9 (as mentioned initially), you shouldn’t have run into these issues, since OpenJDK 8 is the default there and OpenJDK 7 isn’t even available. To fix things so that you can run version 52 classes (i.e. Java 8 classes), install OpenJDK 8:

sudo apt install openjdk-8-jre

On Debian 8 you can install OpenJDK 8 from backports:

echo deb http://archive.debian.org/debian jessie-backports main | sudo tee /etc/apt/sources.list.d/jessie-backports.list
echo 'Acquire::Check-Valid-Until "false";' | sudo tee -a /etc/apt/apt.conf
sudo apt update
sudo apt -t jessie-backports install openjdk-8-jre

(See Failed to fetch jessie backports repository for details.)

You’ll then need to specifically choose OpenJDK 8 as the default:

sudo update-java-alternatives -s java-1.8.0-openjdk-amd64

(To see the possible values, run /usr/sbin/update-java-alternatives -l.)


If you get error as below:

bash: /usr/bin/java: No such file or directory


apt-get install libc6-i386

Some 32bit libs are missing

  • No, /usr/bin/java is a symbolic link that is broken, according to the question. Installing some 32-bit libraries will not make the link into the non-existing directory /Library work. – Kusalananda Nov 25 '19 at 10:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.