本文介绍了如何在netbeans中增加java堆大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在netbeans中用java构建一个近110000个单词的词典。我的代码运行正常,但它给出了一个异常,如下所示:
I am trying to build a lexicon trie of almost 110000 words in java in netbeans. My code is running fine but it gives an Exception as follows:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOfRange(Arrays.java:3209)
at java.lang.String.<init>(String.java:215)
at java.nio.HeapCharBuffer.toString(HeapCharBuffer.java:542)
at java.nio.CharBuffer.toString(CharBuffer.java:1157)
at java.util.regex.Matcher.toMatchResult(Matcher.java:232)
at java.util.Scanner.match(Scanner.java:1270)
at java.util.Scanner.nextLine(Scanner.java:1517)
at lexiconbuild.model.Lexicon.<init>(Lexicon.java:29)
at lexiconbuild.model.LexiconBuild.main(LexiconBuild.java:17)
Java Result: 1
我想知道是否有人可以帮助我增加netbeans中的java堆空间。
I was wondering if someone could help me with increasing the java heap space in netbeans.
推荐答案
您可以在项目属性中的NetBeans中设置它 - >运行 - > VM选项
You can set it in NetBeans in the project properties -> Run -> VM options
- 右键点击您的项目属性
- 选择运行 类别。
- 在 VM选项文本框中输入您的参数( -Xmx512m )。
- Right click on your project "Properties"
- Select "Run" category.
- Enter your arguments(-Xmx512m) in the "VM Options" text box.
示例:在VM Options文本框中放置-Xmx512m可为Java程序提供512Mb的最大堆大小。
Example: Putting -Xmx512m in the "VM Options" text box gives 512Mb maximum heap size to your Java program.
这篇关于如何在netbeans中增加java堆大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!