Tuesday, July 24, 2012

Illegal source level jdk 7 - Linux Mint 13

You try to compile a Java program and Netbeans gives you the error:

Illegal source level jdk 7

You get this because you have the OpenJDK version installed while the program you're trying to compile requires Oracle Java. Mint/Ubuntu cannot ship Oracle's Java due to some laws and licences.

However, if you do need the original Oracle Java to develop your Java apps, you can have it in 2 ways:
- by installing Oracle Java on your system yourself - see how here: http://www.wikihow.com/Install-Oracle-Java-on-Ubuntu-Linux (24 steps).

- or by using a PPA which will kindly and easily get Oracle Java into your system.


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


This should get you the Oracle's version. To check, type:
java -version

You're supposed to see something like:
java version "1.7.0_05"

Java(TM) SE Runtime Environment (build 1.7.0_05-b05)


Java HotSpot(TM) 64-Bit Server VM (build 23.1-b03, mixed mode)


Happy Java coding.

No comments:

Post a Comment