Due I tried to test a java program on linux, which was compiled and created with only Java 8. I tried to upgrade the debian OS to java 8 from java 7. The jar-file won't run with Java7, but runs on windows with java 8 updated.

It seems there are different methods to do it and somehow it's advised to uninstall the old java. uninstall But I couldn't at all.

As on the linux repository(also adding a new) I couldn't find java 8, I tried to follow some examples java-install , it seems that only extract the tar should work. Then I tried to follow this thread multiple java environment on linux. Using another folder, which I extracted the tar in, instead of /usr/lib/jvm .

I used some commands and using java -version shows me the right version. But I tried to run a jar-file and it throws an exception and error.

No protocol specified Exception in thread "main" java.awt.AWTError: Can't connect to X11 window >server using ':0' as the value of the DISPLAY variable.


ln -s /usr/java/jdk1.8.0_121/bin/java /usr/bin/java

export PATH=/usr/java/jdk1.8.0_121/bin:$PATH

export JAVA_HOME=/usr/java/jdk1.8.0_121

Maybe I miss something, some commands or folder ?

  • sudo apt-get install default-jre ? – Davidenko Apr 4 '17 at 17:53
  • Thank you, it seems the default-jre from the repository is still Java7. – Tech-IO Apr 4 '17 at 18:54

I'm sorry it seems to work. It was due the root user, it must run under the default user! Or using the second or third command from the default user account.

The installation sequence was good in this case, I think.

However by searching the cause I changed something through the root user bash. Which should define the Display under your own account.

export DISPLAY=":0.0"

To allow other accounts then the account that owns the program, to show the own X-Display to other accounts locally.

xhost +local:all

If the user account is on another machine, to show the own X-Display.

xhost +inet:

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.