无效的最大堆大小:-Xmx512m

时间:2016-09-22 12:56:13

标签: java maven jvm

我已经尝试了JVM的所有可能的堆大小,但我一直得到以下异常。

Admin pc@Admin-PC MINGW64 /c/controller/opendaylight (master)
$  /c/apache-maven-3.3.9/bin/mvn clean install
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Invalid maximum heap size: -Xmx512m

注意 - 请勿将此标记为重复,因为我已尝试使用此处的所有解决方案但无法找到最终解决方案。

编辑注释 - 添加调试信息

$ bash -x /c/apache-maven-3.3.9/bin/mvn clean install
+ '[' -z '' ']'
+ '[' -f /etc/mavenrc ']'
+ '[' -f '/c/Users/Admin pc/.mavenrc' ']'
+ cygwin=false
+ darwin=false
+ mingw=false
+ case "`uname`" in
++ uname
+ mingw=true
+ '[' -z 'C:\Program Files\Java\jdk1.7.0_80' ']'
+ '[' -z 'C:\apache-maven-3.3.9' ']'
+ false
+ true
+ '[' -n 'C:\apache-maven-3.3.9' ']'
++ cd 'C:\apache-maven-3.3.9'
++ pwd
+ M2_HOME=/c/apache-maven-3.3.9
+ '[' -n 'C:\Program Files\Java\jdk1.7.0_80' ']'
++ cd 'C:\Program Files\Java\jdk1.7.0_80'
++ pwd
+ JAVA_HOME='/c/Program Files/Java/jdk1.7.0_80'
+ '[' -z '/c/Program Files/Java/jdk1.7.0_80' ']'
+ '[' -z '' ']'
+ '[' -n '/c/Program Files/Java/jdk1.7.0_80' ']'
+ '[' -x '/c/Program Files/Java/jdk1.7.0_80/jre/sh/java' ']'
+ JAVACMD='/c/Program Files/Java/jdk1.7.0_80/bin/java'
+ '[' '!' -x '/c/Program Files/Java/jdk1.7.0_80/bin/java' ']'
+ '[' -z '/c/Program Files/Java/jdk1.7.0_80' ']'
+ CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
+ false
++ find_maven_basedir
++ local basedir
++ local wdir
+++ pwd
++ basedir=/c/controller/opendaylight
+++ pwd
++ wdir=/c/controller/opendaylight
++ '[' /c/controller/opendaylight '!=' / ']'
++ '[' -d /c/controller/opendaylight/.mvn ']'
+++ cd /c/controller/opendaylight/..
+++ pwd
++ wdir=/c/controller
++ '[' /c/controller '!=' / ']'
++ '[' -d /c/controller/.mvn ']'
++ basedir=/c/controller
++ break
++ echo /c/controller
+ MAVEN_PROJECTBASEDIR=/c/controller
++ concat_lines /c/controller/.mvn/jvm.config
++ '[' -f /c/controller/.mvn/jvm.config ']'
+++ tr -s '\n' ' '
 ' echo '-Xmx512m
  -Xmx512M -XX:MaxPermSize=256M'
+ false
+ export MAVEN_PROJECTBASEDIR
+ MAVEN_CMD_LINE_ARGS=' clean install'
+ export MAVEN_CMD_LINE_ARGS
+ exec '/c/Program Files/Java/jdk1.7.0_80/bin/java' $'-Xmx512m\r' $'\r' -Xmx512M -XX:MaxPermSize=256M -classpath /c/apache-maven-3.3.9/boot/plexus-classworlds-2.5.2.jar -Dclassworlds.conf=/c/apache-maven-3.3.9/bin/m2.conf -Dmaven.home=/c/apache-maven-3.3.9 -Dmaven.multiModuleProjectDirectory=/c/controller org.codehaus.plexus.classworlds.launcher.Launcher clean install
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Invalid maximum heap size: -Xmx512m

1 个答案:

答案 0 :(得分:1)

碰到同样的问题。

请确保您安装的是64位版本(而不是默认情况下网站提供的32位版本),而不是花哨的设置。