title: "insufficient memory for Java Runtime Environment to continue" in Ubuntu terminal
body: <p>I am trying to run <code>java -Xmx5g -cp stanford-corenlp-3.8.0.jar:stanford-corenlp-models-3.8.0.jar:* edu.stanford.nlp.pipeline.StanfordCoreNLP -annotators tokenize,ssplit,pos,lemma,ner,parse,mention,coref -coref.algorithm neural -file example_file.txt</code> to find mentions of the same entity in a text. 
  But when I run that command in terminal, the process was killed and the error is written in a log, saying that insufficient memory for Java Runtime Environment to continue.</p>
  
  <p>I am using Ubuntu with:</p>
  
  <blockquote>
    <p>java version "1.8.0_151". </p>
    
    <p>Java(TM) SE Runtime Environment (build 1.8.0_151-b12) </p>
    
    <p>Java Hotspot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)</p>
  </blockquote>
  
  <p>As the log is quite long and the question body cannot fit all the log's details.</p>
  
  <p>Here is the log: <a href="https://www.dropbox.com/s/hr159haud1zacvb/hs_err_pid3330.log?dl=0" rel="nofollow noreferrer">error log</a></p>
  
  <p>[Update] I have increase the physical memory of my virtual machine. Now I'm getting this error:</p>
  
  <pre><code>Exception in thread "main" 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:649)
      at java.lang.StringBuilder.append(StringBuilder.java:202)
      at edu.stanford.nlp.ling.SentenceUtils.listToString(SentenceUtils.java:186)
      at edu.stanford.nlp.ling.SentenceUtils.listToString(SentenceUtils.java:169)
      at edu.stanford.nlp.ling.SentenceUtils.listToString(SentenceUtils.java:148)
      at edu.stanford.nlp.pipeline.ParserAnnotator.doOneSentence(ParserAnnotator.java:360)
      at edu.stanford.nlp.pipeline.ParserAnnotator.doOneSentence(ParserAnnotator.java:254)
      at edu.stanford.nlp.pipeline.SentenceAnnotator.annotate(SentenceAnnotator.java:102)
      at edu.stanford.nlp.pipeline.AnnotationPipeline.annotate(AnnotationPipeline.java:76)
      at edu.stanford.nlp.pipeline.StanfordCoreNLP.annotate(StanfordCoreNLP.java:599)
      at edu.stanford.nlp.pipeline.StanfordCoreNLP.annotate(StanfordCoreNLP.java:609)
      at edu.stanford.nlp.pipeline.StanfordCoreNLP$$Lambda$55/45416784.accept(Unknown Source)
      at edu.stanford.nlp.pipeline.StanfordCoreNLP.processFiles(StanfordCoreNLP.java:1172)
      at edu.stanford.nlp.pipeline.StanfordCoreNLP.processFiles(StanfordCoreNLP.java:945)
      at edu.stanford.nlp.pipeline.StanfordCoreNLP.run(StanfordCoreNLP.java:1274)
      at edu.stanford.nlp.pipeline.StanfordCoreNLP.main(StanfordCoreNLP.java:1345)
  </code></pre>
  
  <p>Is there a way to solve this problem?</p>