Mvn clean install错误,错误:无法创建Java虚拟机。错误:发生致命异常。程序将会退出

时间:2018-09-11 15:25:41

标签: java maven configuration

我的设备是Windows 10 我已经安装了Java并配置了变量,还配置了MVN

Enviornment Variables 
JAVA_HOME -> C:\Program Files\Java\jdk1.8.0_181
M2_HOME -> C:\Program Files\Apache\Maven
MAVEN_HOME -> C:\Program Files\Apache\Maven

Path Variables are configured 
%M2_HOME%\bin
%JAVA_HOME%\bin

C:\Users>java -version
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)

C:\Users>javac -version
javac 1.8.0_181

C:\Users>mvn -version
Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-18T00:03:14+05:30)
Maven home: C:\Program Files\Apache\Maven\bin\..
Java version: 1.8.0_181, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk1.8.0_181\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

仍然,当我尝试通过mvn构建客户端时,会引发以下错误

> [INFO] --- clojure-maven-plugin:1.3.23:test (test-clojure) @
> clientname-rules --- Error: Could not create the Java Virtual Machine.
> Error: A fatal exception has occurred. Program will exit. Unrecognized
> option: 

-

有人可以告诉我可能是什么问题

2 个答案:

答案 0 :(得分:0)

如果您使用的是Windows,则需要在环境变量中添加_JAVA_OPTIONS。 参见此处http://www.tomshardware.co.uk/faq/id-1761312/fix-create-java-virtual-machine-issue.html

答案 1 :(得分:0)

此问题是因为我已将git文件夹克隆到一个没有执行权限的文件夹中。 一旦将文件夹克隆到该父文件夹之外,该问题就解决了。