简体   繁体   English

初始化VM时出错,无法为对象堆保留足够的空间 - Spring Tool Suite?

[英]Error occured during initialization of VM, Could not reserve enough space for object heap - Spring Tool Suite?

I'm getting the following error when I build a Gradle project, but SpringToolSuite runs fine 我在构建Gradle项目时遇到以下错误,但SpringToolSuite运行正常

Error occured during the initialization of VM
Could not reserve enough space for object heap
Error: Could not create Java Virtual Machine
Error: A fatal exception has occurred. Program will exit.

I have 4GB of RAM, My OS is 64-bit and I recently upgraded Java from 1.6 to 1.7 我有4GB的RAM,我的操作系统是64位,我最近将Java从1.6升级到1.7

And this is my sts.ini 这是我的sts.ini

 -startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20120522-1813
-product
org.springsource.sts.ide
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
1024M
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms512m
-Xmx768m
-XX:MaxPermSize=1024m

I've tried all sorts of variations of -Xms and -Xmx and still the same error. 我尝试了-Xms-Xmx各种变体,但仍然是同样的错误。

If your STS is running fine then the problem is with the JVM gradle runs to build your project. 如果您的STS运行正常,则问题在于JVM gradle运行以构建您的项目。

If you're using Gradle Wrapper you can configure direct its file, if you want eclipse to override it's params than you can try editing the Gradle preferences under Window > Preferences > Gradle > Arguments with your custom values for -Xmx and -Xms . 如果您正在使用Gradle Wrapper,您可以直接配置其文件,如果您希望eclipse覆盖它的参数,则可以尝试使用-Xmx-Xms自定义值在Window> Preferences> Gradle> Arguments下编辑Gradle首-Xms

在此输入图像描述

You have to go to your main gradle folder where you install Gradle so if you installed Gradle in home directory ex.: 您必须转到安装Gradle的主gradle文件夹,以便在主目录中安装Gradle:

C:\Users\YourUserName\.gradle\deamon\2.1

and create there file 并创建那里的文件

gradle.properties

Put into file this: 提交文件:

org.gradle.jvmargs=-Xmx512m -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

org.gradle.java.home=C:/Development/Tools/Java/Java7/bin [CHANGE IT TO YOUR PATH TO JAVA_HOME]

I was having same kind of problem. 我遇到了同样的问题。 The following solved the problem for me: 以下为我解决了这个问题:

Eclipse -> run -> run configuration -> arguments Eclipse - >运行 - >运行配置 - >参数

and add 并添加

-XX:MaxHeapSize=1024m -XX:MaxHeapSize =1024米

The size depends on your application's requirement. 大小取决于您的应用程序的要求。 Hope this will help you. 希望这会帮助你。 If you are using STS I think you can find the same option as of Eclipse. 如果您正在使用STS,我认为您可以找到与Eclipse相同的选项。

在android studio中我添加了这一行:

org.gradle.jvmargs=-Xmx512m -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 VM初始化期间发生错误:无法为对象堆保留足够的空间 - Error occured during initialization of VM: Could not reserve enough space for object heap VM初始化期间发生错误; 无法为对象堆保留足够的空间; 无法创建Java虚拟机 - Error occurred during initialization of VM; Could not reserve enough space for object heap; Could not create the Java virtual machine VM 初始化过程中发生错误 无法为对象堆保留足够的空间 无法创建 Java 虚拟机 - Error occurred during initialization of VM Could not reserve enough space for object heap Could not create the Java virtual machine “虚拟机初始化时出错; 无法为对象堆保留足够的空间”使用 -Xmx3G - “Error occurred during initialization of VM; Could not reserve enough space for object heap” using -Xmx3G VM 初始化时出错 无法为 object 堆 Android Studio 保留足够的空间 - Error occurred during initialization of VM Could not reserve enough space for object heap Android Studio 初始化 VM 时出错,无法为 object 堆预留足够的空间 - Error occurred during initialization of VM, Could not reserve enough space for object heap 解决方法:“ VM初始化期间发生错误; 无法为对象堆保留足够的空间” - How to resolve this : “Error occurred during initialization of VM; Could not reserve enough space for object heap” VM初始化期间发生错误,无法为对象堆保留足够的空间 - Error occurred during initialization of VM Could not reserve enough space for object heap “ VM初始化期间发生错误,无法为1048576KB对象堆保留足够的空间” - “Error occurred during initialization of VM Could not reserve enough space for 1048576KB object heap” VM初始化期间发生Java错误无法为对象堆保留足够的空间 - Java Error occurred during initialization of VM Could not reserve enough space for object heap
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM