This was a fresh linux Mint xfce machine
I have been battling this for a about a week. I'm trying to learn Java on Netbeans IDE and so naturally I get the combo file straight from Oracle. Which is a package of the JDK and the Netbeans IDE together in a tar file located here.
located
http://www.oracle.com/technetwork/java/javase/downloads/index.html
file name
JDK 8u25 with NetBeans 8.0.1
after installing them (or so I thought) I would make/compile a simple program like "hello world" and that would spit out a jar file that you would be able to run in a terminal. Keep in mind that the program ran in the Netbeans IDE.
I would end up with this error: java.lang.UnsupportedClassVersionError:
Even though I ran the file from oracle website I still had the old version of the Java runtime which was not compatible to run my jar file which was compiled with the new java runtime.
After messing with stuff that was mostly over my head from setting Paths to editing .bashrc with no remedy.
I came across a solution that was easy enough for even me. I have come across something that auto installs java and configures it on your system and it works with the latest 1.8.*
One of the steps is adding a PPA wasn't sure about this at first but seems ok as it has worked for me
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
domenic@domenic-AO532h ~ $ java -version
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) Server VM (build 25.25-b02, mixed mode)
I think it also configures the browser java as well.
I hope this helps others.