This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
When using "Run file" on Linux, the Maven's exec plugin uses wrong JDK. In NetBeans options, I have Sun JDK 1.6 as the only platform. When I run `bash` or `sh`, both use JDK 1.6 when I run `java`, because my PATH has this JDK's `bin` as the first. But the exec plugin somehow gets to an environment which's `java` is resolved as `/usr/bin/java`, which points to the Sun JDK 1.5.0. So I guess there is something missing in the call to the exec plugin. I don't know the exec plugin internals, but perhaps it somehow skips my bashrc where the PATH is prepended with the JDK 1.6 path. Here is the structure of the process calls: ----------------------------------------------------------------------------- ondra 19401 1 0 20:53 ? S 0:00 /bin/bash /home/ondra/sw/prog/netbeans-6.8/bin/../platform11/lib/nbexec --userdir /home/ondra/.netbeans/6.8 --jdkhome /usr/lib/jvm/java-6-sun --branding nb --clusters /home/ondra/sw/prog/netbeans-6.8/nb6.8:...:/home/ondra/sw/prog/netbeans-6.8/bin/../javacard1: -J-Dnetbeans.importclass=org.netbeans.upgrade.AutoUpgrade -J-Dnetbeans.accept_license_class=org.netbeans.license.AcceptLicense -J-Xmx512m -J-Dorg.netbeans.modules.tomcat.autoregister.token=1260833757653 -J-Dorg.netbeans.modules.tomcat.autoregister.catalinaHome=/home/ondra/sw/web/apache-tomcat-6.0.16 -J-client -J-Xverify:none -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-XX:MaxPermSize=200m -J-Dapple.laf.useScreenMenuBar=true -J-Dsun.java2d.noddraw=true ondra 19587 19401 22 20:53 ? Sl 0:24 \_ /usr/lib/jvm/java-6-sun/bin/java -Djdk.home=/usr/lib/jvm/java-6-sun -classpath /home/ondra/sw/prog/netbeans-6.8/platform11/lib/boot.jar:...:/usr/lib/jvm/java-6-sun/lib/tools.jar -Dnetbeans.system_http_proxy=DIRECT -Dnetbeans.system_http_non_proxy_hosts= -Dnetbeans.dirs=/home/ondra/sw/prog/netbeans-6.8/nb6.8:...:/home/ondra/sw/prog/netbeans-6.8/bin/../javacard1: -Dnetbeans.home=/home/ondra/sw/prog/netbeans-6.8/platform11 -Dnetbeans.importclass=org.netbeans.upgrade.AutoUpgrade -Dnetbeans.accept_license_class=org.netbeans.license.AcceptLicense -Xmx512m -Dorg.netbeans.modules.tomcat.autoregister.token=1260833757653 -Dorg.netbeans.modules.tomcat.autoregister.catalinaHome=/home/ondra/sw/web/apache-tomcat-6.0.16 -client -Xverify:none -Xss2m -Xms32m -XX:PermSize=32m -XX:MaxPermSize=200m -Dapple.laf.useScreenMenuBar=true -Dsun.java2d.noddraw=true -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/home/ondra/.netbeans/6.8/var/log/heapdump.hprof org.netbeans.Main --userdir /home/ondra/.netbeans/6.8 --branding nb ondra 19779 19587 8 20:54 ? Sl 0:03 \_ /usr/lib/jvm/java-6-sun/bin/java -classpath /home/ondra/sw/java/maven/2.0.10/boot/classworlds-1.1.jar -Dclassworlds.conf=/home/ondra/sw/java/maven/2.0.10/bin/m2.conf -Dmaven.home=/home/ondra/sw/java/maven/2.0.10 org.codehaus.classworlds.Launcher "-Dexec.classpathScope=runtime" "-Dexec.args=-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=49973 -classpath %classpath cz.dw.test.jettyembedded.RunInJetty" "-Djpda.listen=true" "-Djpda.stopclass=cz.dw.test.jettyembedded.RunInJetty" "-Djpda.address=49973" "-Dexec.executable=java" "-Dnetbeans.execution=true" "process-classes" "org.codehaus.mojo:exec-maven-plugin:1.1.1:exec" ondra 19820 19779 0 20:54 ? S 0:00 \_ /bin/sh -c cd /home/ondra/work-unrelated/WicketTry/wicket-quickstart && java -Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=49973 -classpath ... cz.dw.test.jettyembedded.RunInJetty ondra 19821 19820 0 20:54 ? Sl 0:00 \_ java -Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=49973 -classpath ... cz.dw.test.jettyembedded.RunInJetty -----------------------------------------------------------------------------
And, I forgot to add - there's no JAVA_HOME set in settings.xml.
When I run the same command (which the exec plugin calls) from a shell, it works.
Does this still happen when you ask to use exec-maven-plugin 1.2 in your POM? If so, duplicate of bug #188864.
Cannot reproduce even in NB 6.9. I set an alternate Java Platform in the project's Compile properties panel, and when I Run Project or Run File, that JDK is used. System.err.println("running main in " + System.getProperty("java.version")); => NetBeans: Executing 'mvn -Dexec.classpathScope=runtime -Dexec.args=-classpath %classpath whatever.Main -Dexec.executable=/space/jdk7/bin/java -Dnetbeans.execution=true process-classes org.codehaus.mojo:exec-maven-plugin:1.1.1:exec' NetBeans: JAVA_HOME=/space/jdk7 ... [exec:exec] running main in 1.7.0-ea