<p>Like gringer already commented, the cause of your error is nicely given by the <code>java</code> program. Your default <code>max heap</code> settings are probably too low for the program. If you have more memory on your machine you can give <code>max heap</code> a higher value. See this <a href="https://stackoverflow.com/questions/37335/how-to-deal-with-java-lang-outofmemoryerror-java-heap-space-error-64mb-heap">post</a> and answers on Stack overflow.</p>

<p>You'll probably need to use the <code>-Xmxn</code> argument in <code>java</code>.</p>

CC BY-SA 3.0
2017-11-17T08:12:13.840Z
2017-11-17T08:12:13.840Z
benn
<p>"If pilon was installed by condo, edit the file "/Users/user/anaconda/bin/pilon" by changing the maximum memory limit from 1G to higher numbers like "14G". It works. " 
check the thread: <a href="https://github.com/broadinstitute/pilon/issues/26" rel="nofollow noreferrer">https://github.com/broadinstitute/pilon/issues/26</a></p>

CC BY-SA 4.0
2020-04-18T10:19:54.737Z
2020-04-18T10:19:54.737Z
LucasY
<p>I am trying to use Pilon to improve a reference based on some Illumina data I have got. So, I aligned the Illumina reads to the reference using bwa. Then, I want to use Pilon to improve the reference using the alignment file in BAM format.</p>

<p>Information about Pilon is found <a href="https://github.com/broadinstitute/pilon/wiki/Requirements-&amp;-Usage" rel="nofollow noreferrer" title="Requirements of Pilon">here</a>. I installed Pilon using conda.</p>

<p>The output of 'pilon' is:</p>

<pre><code>Pilon version 1.22 Wed Mar 15 16:38:30 2017 -0400

    Usage: pilon --genome genome.fasta [--frags frags.bam] [--jumps jumps.bam] [--unpaired unpaired.bam]
                 [...other options...]
           pilon --help for option details
</code></pre>

<p>The output of:</p>

<pre><code>pilon --genome ref.fa --frags readsSorted.bam --output pilo --outdir output/scaffold
</code></pre>

<p>is:</p>

<pre><code> Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.simontuffs.onejar.Boot.run(Boot.java:340)
    at com.simontuffs.onejar.Boot.main(Boot.java:166)
Caused by: java.lang.OutOfMemoryError: Java heap space
    at org.broadinstitute.pilon.GenomeRegion.&lt;init&gt;(GenomeRegion.scala:55)
    at org.broadinstitute.pilon.GenomeFile$$anonfun$contigRegions$1.apply(GenomeFile.scala:72)
 at org.broadinstitute.pilon.GenomeFile$$anonfun$contigRegions$1.apply(GenomeFile.scala:72)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
 at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
    at scala.collection.immutable.Range.foreach(Range.scala:160)
    at scala.collection.TraversableLike$class.map(TraversableLike.scala:234)
 at scala.collection.AbstractTraversable.map(Traversable.scala:104)
 at org.broadinstitute.pilon.GenomeFile.contigRegions(GenomeFile.scala:72)
 at org.broadinstitute.pilon.GenomeFile$$anonfun$2.apply(GenomeFile.scala:52)
    at org.broadinstitute.pilon.GenomeFile$$anonfun$2.apply(GenomeFile.scala:52)
    at scala.collection.immutable.List.map(List.scala:277)
    at org.broadinstitute.pilon.GenomeFile.&lt;init&gt;(GenomeFile.scala:52)
    at org.broadinstitute.pilon.Pilon$.main(Pilon.scala:98)
    at org.broadinstitute.pilon.Pilon.main(Pilon.scala)
    ... 6 more
</code></pre>

CC BY-SA 3.0
2017-11-16T22:12:21.557Z
Note that the error is a memory issue:

`java.lang.OutOfMemoryError: Java heap space`
gringer
<assembly><reference-genome>
Java error when launching Pilon
# Java error when launching Pilon

(Asked by: username_0 on 2017-11-16)

I am trying to use Pilon to improve a reference based on some Illumina data I have got. So, I aligned the Illumina reads to the reference using bwa. Then, I want to use Pilon to improve the reference using the alignment file in BAM format.
Information about Pilon is found here. I installed Pilon using conda.
The output of 'pilon' is:
Pilon version 1.22 Wed Mar 15 16:38:30 2017 -0400

    Usage: pilon --genome genome.fasta [--frags frags.bam] [--jumps jumps.bam] [--unpaired unpaired.bam]
                 [...other options...]
           pilon --help for option details

The output of:
pilon --genome ref.fa --frags readsSorted.bam --output pilo --outdir output/scaffold

is:
 Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.simontuffs.onejar.Boot.run(Boot.java:340)
    at com.simontuffs.onejar.Boot.main(Boot.java:166)
Caused by: java.lang.OutOfMemoryError: Java heap space
    at org.broadinstitute.pilon.GenomeRegion.(GenomeRegion.scala:55)
    at org.broadinstitute.pilon.GenomeFile$$anonfun$contigRegions$1.apply(GenomeFile.scala:72)
 at org.broadinstitute.pilon.GenomeFile$$anonfun$contigRegions$1.apply(GenomeFile.scala:72)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
 at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
    at scala.collection.immutable.Range.foreach(Range.scala:160)
    at scala.collection.TraversableLike$class.map(TraversableLike.scala:234)
 at scala.collection.AbstractTraversable.map(Traversable.scala:104)
 at org.broadinstitute.pilon.GenomeFile.contigRegions(GenomeFile.scala:72)
 at org.broadinstitute.pilon.GenomeFile$$anonfun$2.apply(GenomeFile.scala:52)
    at org.broadinstitute.pilon.GenomeFile$$anonfun$2.apply(GenomeFile.scala:52)
    at scala.collection.immutable.List.map(List.scala:277)
    at org.broadinstitute.pilon.GenomeFile.(GenomeFile.scala:52)
    at org.broadinstitute.pilon.Pilon$.main(Pilon.scala:98)
    at org.broadinstitute.pilon.Pilon.main(Pilon.scala)
    ... 6 more

**Tags:** assembly, reference-genome
> **Comments:**
> **username_1**: Note that the error is a memory issue:  `java.lang.OutOfMemoryError: Java heap space`  

---

## 2 answers

### Answer by username_2 on 2017-11-17. Score: 2 | Accepted answer

Like gringer already commented, the cause of your error is nicely given by the `java` program. Your default `max heap` settings are probably too low for the program. If you have more memory on your machine you can give `max heap` a higher value. See this [post](https://stackoverflow.com/questions/37335/how-to-deal-with-java-lang-outofmemoryerror-java-heap-space-error-64mb-heap) and answers on Stack overflow.

You'll probably need to use the `-Xmxn` argument in `java`.


---

### Answer by username_3 on 2020-04-18. Score: 0

"If pilon was installed by condo, edit the file "/Users/user/anaconda/bin/pilon" by changing the maximum memory limit from 1G to higher numbers like "14G". It works. "
check the thread: <https://github.com/broadinstitute/pilon/issues/26>


---

