Have you tried allocating more heap-space to java? Use the -XmxAAAAm switch, where AAAA is a number in megabytes. For instance, I use -Xmx1500m, thusly:

java -Xmx1500m -ea -jar mkgmap.jar etc etc etc

Obviously AAAA can’t be bigger than the actual amount of memory you have on your computer.