Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Netbeans Maven Error: javac: invalid target release: 1.7

I am trying to build an existing maven project on a fresh install of the latest netbeans but am getting the following error, any help is much appreciated:

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project com.rory.ngp.test: Compilation failure
Failure executing javac, but could not parse the error:
javac: invalid target release: 1.7

I think it has something to do with paths but am not sure exactly. Here is the contents of my /usr/lib/jvm directory;

bash-4.1$ pwd
/usr/lib/jvm
bash-4.1$ ls   
java                               java-openjdk   jre-1.6.0-openjdk.x86_64
java-1.5.0-gcj-1.5.0.0             jre            jre-gcj
java-1.6.0                         jre-1.5.0      jre-openjdk
java-1.6.0-openjdk-1.6.0.0.x86_64  jre-1.5.0-gcj
java-1.6.0-openjdk.x86_64          jre-1.6.0
like image 926
Rory Avatar asked Jan 25 '12 12:01

Rory


People also ask

How do I fix an invalid target release?

1. Fix invalid target release error by changing project's Java version. Then run mvn package again, the invalid target release error will be gone.

What is fatal error compiling?

The problem is that there is mismatch in the Java/JDK versions. The project is trying to use a particular Java version to build the project. However, the system doesn't support the Java version the project is intended to build upon. First things first, decide on which Java/JDK version you want to use.


1 Answers

Thanks oers, you were right.

I needed to install JDK 1.7/Java 7, and then edit the netbeans config file in the netbeans install directory /etc/netbeans.conf to point to where I installed the new version of Java:

    # Default location of JDK, can be overridden by using --jdkhome <dir>:
    netbeans_jdkhome="/users/rory/Documents/jdk1.7.0_02"
like image 182
Rory Avatar answered Sep 19 '22 16:09

Rory