记录Idea运行程序时报错Error:Abnormal build process termination的解决方式
问题描述
今天用idea运行程序时报了如下错误。
Error:Abnormal build process termination:
D:\Java\jdk1.8.0_66\bin\java -Xmx700m -Djava.awt.headless=true -Djava.endorsed.dirs="" -Djdt.compiler.useSingleThread=true -Dpreload.project.path=F:/project/learning -Dpreload.config.path=C:/Users/Administrator/.IntelliJIdea2017.2/config/options -Dcompile.parallel=false -Drebuild.on.dependency.change=true -Djava.net.preferIPv4Stack=true -Dio.netty.initialSeedUniquifier=649812447404672058 -Dfile.encoding=GBK -Djps.file.types.component.name=FileTypeManager -Duser.language=zh -Duser.country=CN -Didea.paths.selector=IntelliJIdea2017.2 “-Didea.home.path=D:\JetBrains\IntelliJ IDEA 2017.2.5” -Didea.config.path=C:\Users\Administrator.IntelliJIdea2017.2\config -Didea.plugins.path=C:\Users\Administrator.IntelliJIdea2017.2\config\plugins -Djps.log.dir=C:/Users/Administrator/.IntelliJIdea2017.2/system/log/build-log “-Djps.fallback.jdk.home=D:/JetBrains/IntelliJ IDEA 2017.2.5/jre64” -Djps.fallback.jdk.version=1.8.0_152-release -Dio.netty.noUnsafe=true -Djava.io.tmpdir=C:/Users/Administrator/.IntelliJIdea2017.2/system/compile-server/learning_24102532/temp -Djps.backward.ref.index.builder=true -Dkotlin.incremental.compilation.experimental=true -Dkotlin.daemon.enabled -Dkotlin.daemon.client.alive.path=“C:\Users\ADMINI~1\AppData\Local\Temp\kotlin-idea-6132973499988721312-is-running” -classpath “D:/JetBrains/IntelliJ IDEA 2017.2.5/lib/jps-launcher.jar;D:/Java/jdk1.8.0_66/lib/tools.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/lib/optimizedFileManager.jar” org.jetbrains.jps.cmdline.Launcher “D:/JetBrains/IntelliJ IDEA 2017.2.5/lib/log4j.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/lib/slf4j-api-1.7.10.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/lib/httpclient-4.5.2.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/lib/idea_rt.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/lib/openapi.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/lib/maven-aether-provider-3.3.9-all.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/lib/jps-builders-6.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/lib/protobuf-2.5.0.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/lib/jps-model.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/lib/jna.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/lib/jgoodies-forms.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/lib/commons-logging-1.2.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/lib/jps-builders.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/lib/forms_rt.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/lib/aether-dependency-resolver.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/lib/oromatcher.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/lib/nanoxml-2.2.3.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/lib/snappy-in-java-0.5.1.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/lib/resources_en.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/lib/javac2.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/lib/aether-1.1.0-all.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/lib/jna-platform.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/lib/commons-codec-1.9.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/lib/netty-all-4.1.10.Final.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/lib/asm-all.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/lib/util.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/lib/trove4j.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/lib/annotations.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/lib/httpcore-4.4.5.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/lib/jdom.jar;;D:/JetBrains/IntelliJ IDEA 2017.2.5/lib/gson-2.5.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/android/lib/jarutils.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/lib/guava-21.0.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/android/lib/android-common.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/gradle/lib/gradle-tooling-api-3.5.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/lib/gson-2.5.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/android/lib/jarutils.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/lib/guava-21.0.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/android/lib/android-common.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/gradle/lib/gradle-tooling-api-3.5.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/ant/lib/ant-jps-plugin.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/devkit/lib/devkit-jps-plugin.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/uiDesigner/lib/jps/ui-designer-jps-plugin.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/IntelliLang/lib/intellilang-jps-plugin.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/Groovy/lib/groovy-jps-plugin.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/Groovy/lib/groovy-rt-constants.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/eclipse/lib/eclipse-jps-plugin.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/eclipse/lib/common-eclipse-util.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/maven/lib/maven-jps-plugin.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/maven/lib/plexus-utils-2.0.6.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/osmorc/lib/osmorc-jps-plugin.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/osmorc/lib/bndlib-3.3.0.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/osmorc/lib/bnd-repository-3.3.0.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/osmorc/lib/bnd-resolve-3.3.0.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/osmorc/lib/plexus-utils-3.0.10.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/osmorc/lib/bundlor-all.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/aspectj/lib/aspectj-jps-plugin.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/flex/lib/flex-jps-plugin.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/flex/lib/flex-shared.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/gradle/lib/gradle-jps-plugin.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/JavaEE/lib/javaee-jps-plugin.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/JavaEE/lib/jps/jpa-jps-plugin.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/webSphereIntegration/lib/jps/webSphere-jps-plugin.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/weblogicIntegration/lib/jps/weblogic-jps-plugin.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/dmServer/lib/dmServer-jps-plugin.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/GwtStudio/lib/gwt-jps-plugin.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/GoogleAppEngine/lib/google-app-engine-jps-plugin.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/GoogleAppEngine/lib/appEngine-runtime.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/Grails/lib/grails-jps-plugin.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/Grails/lib/grails-compiler-patch.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/android/lib/jps/android-jps-plugin.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/android/lib/jps/android-gradle-jps.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/android/lib/android-common.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/android/lib/android-rt.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/android/lib/sdk-common.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/android/lib/repository.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/android/lib/sdklib.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/android/lib/jarutils.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/android/lib/layoutlib-api.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/android/lib/manifest-merger.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/Kotlin/lib/jps/kotlin-jps-plugin.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/Kotlin/lib/kotlin-runtime.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/Kotlin/lib/kotlin-reflect.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/Kotlin/lib/kotlin-plugin.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/Kotlin/lib/android-extensions-ide.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/Kotlin/lib/android-extensions-compiler.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/javaFX/lib/javaFX-jps-plugin.jar;D:/JetBrains/IntelliJ IDEA 2017.2.5/plugins/javaFX/lib/common-javaFX-plugin.jar” org.jetbrains.jps.cmdline.BuildMain 127.0.0.1 55947 c22eb83b-c192-45d9-adc0-cc19116e6c25 C:/Users/Administrator/.IntelliJIdea2017.2/system/compile-server
Error occurred during initialization of VM
Could not reserve enough space for object heap
可以看出该错误是在VM初始化过程中发生的由于无法为对象堆预留足够的空间导致。可见是因为电脑的剩余可用内存不够jvm使用的。
解决方式
1、关掉无用应用
这种方法比较简单粗暴,可以关掉一些无用应用,释放一些内存,以提高可用内存供JVM使用。
2、修改项目运行时配置
若不想关闭其他应用,也可通过修改idea运行时的配置解决。默认情况下,JVM启动时给堆分配的初始内存大小为物理内存的1/64但小于1G,JVM运行时可申请的最大堆内存的大小为物理内存的1/4但小于1G。若程序运行时所需内存不大,可以通过修改程序启动时的配置,减小堆内存的初始大小及最大可申请大小,以解决该问题。具体操作如下:
1、选择要运行的项目,点击Edit Configuration。
2、修改VM参数
可在VM options处通过参数-Xms和-Xmx配置初始堆内存大小及最大堆内存大小。其中,-Xms为设置 初始分配大小;-Xmx为设置最大分配内存。具体这两个参数设置多大,根据项目及电脑的可用内存情况而定。操作如下图:
点击Apply,然后点击OK即可。再次运行程序不会再出现该报错了。
本文地址:https://blog.csdn.net/m0_47503416/article/details/110681113