Netbeans 9/10/11无法运行程序"cmd". [英] Netbeans 9/10/11 cannot run program "cmd"
问题描述
我将NetBeans 11解压缩到C:\netbeans
,将JDK的多个版本安装到C:\java
,并在NetBeans中创建了一个包含主方法和一行代码System.out.print("hello world");
的测试类.当我单击运行项目按钮时,输出窗口将显示命令:
I unzipped NetBeans 11 to C:\netbeans
, installed several versions of the JDK to C:\java
and created a test class within NetBeans containing a main method and one line of code System.out.print("hello world");
. When I click the Run Project button, the output window shows the command:
cd C:\Users\MyUsername\Documents\NetBeansProjects\asdf;
JAVA_HOME=C:\\Java\\jdk1.8.0_231 cmd /c "\"\"C:\\netbeans-9\\java\\maven\\bin\\mvn.cmd\"
-Dexec.args=\"-classpath %classpath com.mycompany.asdf.Test\"
-Dexec.executable=C:\\Java\\jdk1.8.0_231\\bin\\java.exe
-Dmaven.ext.class.path=C:\\netbeans-9\\java\\maven-nblib\\netbeans-eventspy.jar
-Dfile.encoding=UTF-8 process-classes org.codehaus.mojo:exec-maven-plugin:1.5.0:exec\""
后面是错误:
无法运行程序"cmd"(在目录"C:\ Users \ MyUsername \ Documents \ NetBeansProjects \ asdf"中):格式错误的参数已嵌入引号:"C:\ netbeans-9 \ java \ maven \ bin \ mvn. cmd"-Dexec.args ="-classpath%classpath com.mycompany.asdf.Test"-Dexec.executable = C:\ Java \ jdk1.8.0_231 \ bin \ java.exe -Dmaven.ext.class.path = C :\ netbeans-9 \ java \ maven-nblib \ netbeans-eventspy.jar -Dfile.encoding = UTF-8进程类org.codehaus.mojo:exec-maven-plugin:1.5.0:exec
Cannot run program "cmd" (in directory "C:\Users\MyUsername\Documents\NetBeansProjects\asdf"): Malformed argument has embedded quote: "C:\netbeans-9\java\maven\bin\mvn.cmd" -Dexec.args="-classpath %classpath com.mycompany.asdf.Test" -Dexec.executable=C:\Java\jdk1.8.0_231\bin\java.exe -Dmaven.ext.class.path=C:\netbeans-9\java\maven-nblib\netbeans-eventspy.jar -Dfile.encoding=UTF-8 process-classes org.codehaus.mojo:exec-maven-plugin:1.5.0:exec
该类是否创建GUI,都会给出相同的错误.我已经尝试过将NetBeans 9、10和11与JDK 7、8和11一起使用.我在安装过程中丢失了某些东西吗?还是在错误的目录中找到了某些东西?我迷路了.
Whether the class creates a GUI or not, it gives the same error. I've tried NetBeans 9, 10, and 11 with JDK 7, 8, and 11. Am I missing something during setup, or do I have something in a wrong directory somewhere? I'm lost.
推荐答案
无需降级JDK,只需将其添加到您的netbeans.conf中即可.
No need to downgrade the JDK just add this in your netbeans.conf
找到您的netbeans.conf文件netbeansIstallDir/etc/netbeans.conf
Find your netbeans.conf file netbeansIstallDir/etc/netbeans.conf
找到键netbeans_default_options
,并在字符串的开头添加以下内容:-J-Djdk.lang.Process.allowAmbiguousCommands=true
Find the key netbeans_default_options
and at the start of the string add the following: -J-Djdk.lang.Process.allowAmbiguousCommands=true
它应该看起来像这样:
netbeans_default_options="-J-Djdk.lang.Process.allowAmbiguousCommands=true..."
这篇关于Netbeans 9/10/11无法运行程序"cmd".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!