Java with maven wouldn't build: Cannot run pro

2020-02-10 13:10发布

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.

9条回答
爷的心禁止访问
2楼-- · 2020-02-10 13:45

At the time that I'm writing, I had only JDK13 installed only on my machine. After unzipped my netbeans I've got the same problem with the internal maven of my netbeans 11.1.

Apparently netbeans 11.1 does not work properly with the JDK13. I just installed the JDK 8 and the problem now is solved, without any additional configuration or parameter change.

Nontheless, since I need the JDK13, I have both installed but my netbeans.conf file is pointing to JDK8. Later, you can define the new Java platform in netbeans project configuration.

I hope this might help.

Cheers!

查看更多
三岁会撩人
3楼-- · 2020-02-10 13:46

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.

查看更多
成全新的幸福
4楼-- · 2020-02-10 13:46

Apache NetBeans 11.1 does indeed not support JDK 13, that's what the upcoming Apache NetBeans 11.2 is for -- latest beta: bit.ly/apache-netbeans-11-2-beta-3

查看更多
够拽才男人
5楼-- · 2020-02-10 13:47

It seems to happen with all recently released jdk version (11.0.5 and 13.0.1 at least), even with the latest Netbeans 11.2vc1 (and witnessed on NB 11.1 too). Downgrade your jdk to 11.0.4 or 13.0.0. It fixed the issue for me

查看更多
太酷不给撩
6楼-- · 2020-02-10 13:49

Did you by any chance install the latest critical update for java? jdk 1.7_241? I installed that today and was having the exact same problem. I downgraded my jdk version and it solved it completely.

EDIT: Apologies, I noticed you're using netbeans 11.1 so you probably have a later java version, in any case, you could try downgrading your java version to a previous release if you happened to update it today as the other version might have the same problem.

查看更多
迷人小祖宗
7楼-- · 2020-02-10 13:49

The problem also occurs in version jdk-8u231. Fixing installing jdk-8u221 version

查看更多
登录 后发表回答