咱们平时的开发过程中一定会进行本地调试,今天我也是安装了新的idea之后拉了一个比较大的项目进行本地调试的时候报错。报错信息如下:
java: java.lang.OutOfMemoryError: Java heap space
java.lang.RuntimeException: java.lang.OutOfMemoryError: Java heap space
at com.sun.tools.javac.main.Main.compile(Main.java:559)
at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:129)
at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:138)
at org.jetbrains.jps.javac.JavacMain.compile(JavacMain.java:239)
at org.jetbrains.jps.javac.ExternalJavacProcess.compile(ExternalJavacProcess.java:189)
at org.jetbrains.jps.javac.ExternalJavacProcess.access$400(ExternalJavacProcess.java:28)
at org.jetbrains.jps.javac.ExternalJavacProcess$CompilationRequestsHandler$1.run(ExternalJavacProcess.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:750)
Caused by: java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:3332)
at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:124)
at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:448)
at java.lang.StringBuffer.append(StringBuffer.java:276)
at java.net.URI.appendSchemeSpecificPart(URI.java:1911)
at java.net.URI.toString(URI.java:1941)
at java.net.URI.<init>(URI.java:669)
at java.net.URI.<init>(URI.java:774)
at org.jetbrains.jps.javac.ZipFileObject.createUri(ZipFileObject.java:39)
at org.jetbrains.jps.javac.ZipFileObject.<init>(ZipFileObject.java:21)
at org.jetbrains.jps.javac.DefaultFileOperations$ZipArchive$2.fun(DefaultFileOperations.java:231)
at org.jetbrains.jps.javac.DefaultFileOperations$ZipArchive$2.fun(DefaultFileOperations.java:228)
at org.jetbrains.jps.javac.Iterators$11.next(Iterators.java:221)
at org.jetbrains.jps.javac.Iterators$7.next(Iterators.java:167)
at org.jetbrains.jps.javac.Iterators$6.next(Iterators.java:140)
at com.sun.tools.javac.api.ClientCodeWrapper.wrapJavaFileObjects(ClientCodeWrapper.java:140)
at com.sun.tools.javac.api.ClientCodeWrapper$WrappedJavaFileManager.list(ClientCodeWrapper.java:231)
at javax.tools.ForwardingJavaFileManager.list(ForwardingJavaFileManager.java:76)
at com.sun.tools.javac.jvm.ClassReader.fillIn(ClassReader.java:2750)
at com.sun.tools.javac.jvm.ClassReader.complete(ClassReader.java:2446)
at com.sun.tools.javac.jvm.ClassReader.access$000(ClassReader.java:76)
at com.sun.tools.javac.jvm.ClassReader$1.complete(ClassReader.java:240)
at com.sun.tools.javac.code.Symbol.complete(Symbol.java:574)
at com.sun.tools.javac.jvm.ClassReader.completeOwners(ClassReader.java:2458)
at com.sun.tools.javac.jvm.ClassReader.complete(ClassReader.java:2435)
at com.sun.tools.javac.jvm.ClassReader.access$000(ClassReader.java:76)
at com.sun.tools.javac.jvm.ClassReader$1.complete(ClassReader.java:240)
at com.sun.tools.javac.code.Symbol.complete(Symbol.java:574)
at com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:1037)
at com.sun.tools.javac.code.Symbol$ClassSymbol.members(Symbol.java:978)
at com.sun.tools.javac.jvm.ClassReader$AnnotationDeproxy.findAccessMethod(ClassReader.java:1769)
at com.sun.tools.javac.jvm.ClassReader$AnnotationDeproxy.deproxyCompound(ClassReader.java:1759)
我们都知道这个错误“java: java.lang.OutOfMemoryError: Java heap space”通常是因为Java虚拟机(JVM)中的堆内存不足导致的。堆内存是JVM用来存储对象实例的区域,当你的应用创建的对象实例占用的空间超过了JVM配置的堆内存大小时,就会抛出这个错误。 其实可以通过修改Idea的一些配置,修改配置有两个地方:
项目配置:
idea配置:
修改完毕项目就可以正常启动了,希望可以帮助到大家!