I've installed the latest release of JDK with NetBeans on Ubuntu. When I attempt to execute a .jar file from the terminal with java -jar Minecraft.jar, this is outputted:

The program 'java' cannot be found in the following packages: * default-jre * gcj-5-jre-headless * openjdk-8-jre-headless * gcj-4.8-jre-headless * gcj-4.9-jre-headless * openjdk-9-jre-headless Try: sudo apt install <selected package> 

What are possible fixes to this issue?

2

1 Answer

When you install JDK manually you must check the setting of the following variables in your environment:

JAVA_HOME=~/jdk1.8.0_151 PATH=$JAVA_HOME/bin:$PATH 

And you have to change the values if you move the JDK folder.