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
I was wondering if someone could help me with increasing the java heap space in netbeans.
You can set it in NetBeans in the project properties -> Run -> VM options
Example: Putting -Xmx512m in the "VM Options" text box gives 512Mb maximum heap size to your Java program.