Java, Eclipse, gij, icedtea, ahh memory error no more


Eclipse and gnu’s crappy java, otherwise known as gij, don’t seem to get along. Even when you give gij tons of memory using vargs -Xmx1024m when launching eclipse, it still just seems flaky. So I tried java’s Icedtea 1.7.0 and my memory crisis went away.

To see which jvm you’re currently using:

$ java -version
java version “1.7.0″
IcedTea Runtime Environment (build 1.7.0-b21)
IcedTea 64-Bit Server VM (build 1.7.0-b21, mixed mode)

You can also do this:

$ /usr/sbin/alternatives –display java
java – status is auto.
link currently points to /usr/lib/jvm/jre-1.7.0-icedtea.x86_64/bin/java
/usr/lib/jvm/jre-1.5.0-gcj/bin/java – priority 1500
slave keytool: /usr/lib/jvm/jre-1.5.0-gcj/bin/keytool
slave orbd: (null)
slave pack200: (null)
slave policytool: (null)
slave rmid: (null)
slave rmiregistry: /usr/lib/jvm/jre-1.5.0-gcj/bin/rmiregistry

To switch to another java virtual machine:

$ /usr/sbin/alternatives –config java
There are 2 programs which provide ‘java’.
Selection Command
———————————————–
1 /usr/lib/jvm/jre-1.5.0-gcj/bin/java
*+ 2 /usr/lib/jvm/jre-1.7.0-icedtea.x86_64/bin/java
Enter to keep the current selection[+], or type selection number:

Easy…  And no more JVM terminated. Exit code=1 or OutOfMemoryError crap.  Don’t forget to give it more memory using -Xmx1024m or at least -Xmx512m, or else you might see something like this:

Error: A fatal exception has occurred. Program will exit.

yeah, real informative… :/


Posted on January 13th, by admica in Linux, programming.
Comments Off

Comments are closed.