简体   繁体   中英

Netbeans 7 , how to set JDK path to maven?

I am using Netbeans 7. When I create a new Maven EJB module, it gave me error

cd F:\NetBeansProjects; "JAVA_HOME=C:\\Program Files\\Java\\j2sdk1.4.2_19" "\"C:\\Program Files\\NetBeans 7.0\\java\\maven\\bin\\mvn.bat\"" -DarchetypeVersion=1.3 -Darchetype.interactive=false -DgroupId=com.mycompany -DarchetypeArtifactId=ejb-javaee6 -DarchetypeRepository=http://repo1.maven.org/maven2/ -Dversion=1.0-SNAPSHOT -DarchetypeGroupId=org.codehaus.mojo.archetypes -Dbasedir=F:\\NetBeansProjects -Dpackage=com.mycompany.mavenproject1 -DartifactId=mavenproject1 --batch-mode archetype:generate
java.lang.UnsupportedClassVersionError: org/apache/maven/cli/MavenCli (Unsupported major.minor version 49.0)
    at java.lang.ClassLoader.defineClass0(Native Method)

As you can see, it is using JAVA_HOME pointing to JDK1.4 and causing error. But the netbeans.conf, it is using JDK1.6

netbeans_jdkhome="C:\Program Files\Java\jdk1.6.0_06"

how to resolve it?

Thanks.

I think you're using Windows 7, right? If so, then your path-variable seems to be set wrong.

Try to check it by:
-push "windows+pause" -keys
-then on the left side "advanced configuration"
-last button, something like "environment variables" or similar

and change the JAVA_HOME entry to "C:\Program Files\Java\jdk1.6.0_06"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM