Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.7k views
in Technique[技术] by (71.8m points)

windows - Java with maven wouldn't build: Cannot run program "cmd" "Malformed argument has embedded quote"

I've a fresh install of netbean 11.1. Now I'm trying to build a project but I get the following error output:

Cannot run program "cmd" (in directory "C:projectsopen"): Malformed argument has embedded quote: "C:Program FilesNetBeans-11.1 etbeansjavamaveninmvn.cmd"

cd C:projectsopen; "JAVA_HOME=C:\Program Files\Java\jdk-11.0.5" cmd /c """C:\Program Files\NetBeans-11.1\netbeans\java\maven\bin\mvn.cmd" -DskipTests=true -Dmaven.ext.class.path="C:\Program Files\NetBeans-11.1\netbeans\java\maven-nblib\netbeans-eventspy.jar" -Dfile.encoding=UTF-8 clean install"" Cannot run program "cmd" (in directory "C:projectsopen"): Malformed argument has embedded quote: "C:Program FilesNetBeans-11.1
etbeansjavamaveninmvn.cmd" -DskipTests=true -Dmaven.ext.class.path="C:Program FilesNetBeans-11.1
etbeansjavamaven-nblib
etbeans-eventspy.jar" -Dfile.encoding=UTF-8 clean install

I've build this project with netbeans 11.1 before but have a new pc. and a fresh install, tho I'm sure there was no problem last time I tried to install everything.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Although this problem can be fixed by installing jdk1.8.0_221, but actually you don't need to downgrade your JDK. Just try these:

  1. First exit netbeans IDE if it's open, then open netbeans configuration file from here: netbeans-Install-Dir/etc/netbeans.conf (Note: for me netbeans-Install-Dir is C:Program FilesNetBeans 8.2etc)
  2. Add the below arguments
-J-Djdk.lang.Process.allowAmbiguousCommands=true
  1. to the beginning of the string that you find at this line:
netbeans_default_options="-J-client -J-Xss2m -J-Xms32m ......."

Sample screenshot as shown below: enter image description here
4. Save the change and start your netbeans IDE.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...