Netbeans 9/10/11 无法运行程序“cmd";

Netbeans 9/10/11 cannot run program quot;cmdquot;(Netbeans 9/10/11 无法运行程序“cmd;)

本文介绍了Netbeans 9/10/11 无法运行程序“cmd";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将 NetBeans 11 解压缩到 C: etbeans,将多个版本的 JDK 安装到 C:java,并在 NetBeans 中创建了一个包含 main 方法和一行代码System.out.print("hello world");.当我单击 Run Project 按钮时,输出窗口会显示命令:

I unzipped NetBeans 11 to C: etbeans, 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:UsersMyUsernameDocumentsNetBeansProjectsasdf; 
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:UsersMyUsernameDocumentsNetBeansProjectsasdf"中):格式错误的参数已嵌入引号:C: etbeans-9javamaveninmvn.cmd" -Dexec.args="-classpath %classpath com.mycompany.asdf.Test" -Dexec.executable=C:Javajdk1.8.0_231injava.exe -Dmaven.ext.class.path=C: etbeans-9javamaven-nblib etbeans-eventspy.jar -Dfile.encoding=UTF-8 进程类 org.codehaus.mojo:exec-maven-plugin:1.5.0:exec

Cannot run program "cmd" (in directory "C:UsersMyUsernameDocumentsNetBeansProjectsasdf"): Malformed argument has embedded quote: "C: etbeans-9javamaveninmvn.cmd" -Dexec.args="-classpath %classpath com.mycompany.asdf.Test" -Dexec.executable=C:Javajdk1.8.0_231injava.exe -Dmaven.ext.class.path=C: etbeans-9javamaven-nblib etbeans-eventspy.jar -Dfile.encoding=UTF-8 process-classes org.codehaus.mojo:exec-maven-plugin:1.5.0:exec

无论该类是否创建 GUI,它都会给出相同的错误.我已经使用 JDK 7、8 和 11 尝试了 NetBeans 9、10 和 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添加这个/strong>

No need to downgrade the JDK, just add this in your netbeans.conf

  1. 找到您的 netbeans.conf 文件.例如: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";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:Netbeans 9/10/11 无法运行程序“cmd";

基础教程推荐