Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:\projects\open"): Malformed argument has embedded quote: "C:\Program Files\NetBeans-11.1\netbeans\java\maven\bin\mvn.cmd"

cd C:\projects\open; "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:\projects\open"): Malformed argument has embedded quote: "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 

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.

like image 680
busyBee Avatar asked Oct 16 '19 10:10

busyBee


2 Answers

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 Files\NetBeans 8.2\etc)
  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.

like image 125
Ali Safari Avatar answered Sep 19 '22 20:09

Ali Safari


I have checked the release notes for JDK 13.0.1 at https://www.oracle.com/technetwork/java/javase/13-0-1-relnotes-5592797.html#JDK-8221858

This behavior is a regression from a security fix for JDK-8221858 (not public). Follow the link for a full description. The fix is part of JDK 8u231, JDk 11.0.5, 13.0.1 etc.

To resolve this problem, append -J-Djdk.lang.Process.allowAmbiguousCommands=true to netbeans_default_options in <netbeans-dir>\etc\netbeans.conf.

like image 32
Sephiroth Avatar answered Sep 17 '22 20:09

Sephiroth