0
votes

I am running a java program that loads very large (almost 2Gb) files. It runs fine within Eclipse as long as I set the max heap space -mx3700m or higher. Eclipse executes with javaw, and when I watch the memory usage in Task Manager I can see the Private Working Set memory hitting around 3.7Gb.

The problem comes when I create a runnable jar and try to run from the command line. I've tried using both java and javaw, with max heap space all the way up to -mx7000m (my computer has 8Gb RAM). But I always run out of memory. When I monitor in Task Manager, the memory hits a ceiling at 2.08Gb and never goes beyond.

I'm using the same 64bit jre in both cases - 1.8.0_144.

I need to be able to run the jar file from the command line, but I'm not sure what I'm doing wrong. Any help would be very much appreciated. Thanks.

1
it is -Xmx3700m, subtle difference to what you seem to have set.Thomas Jungblut
I thought I read that you can use either one. I have actually tried it both ways, in both Eclipse and the console. Same results no matter whatMichael

1 Answers

0
votes

I would try running it with Xmx argument, e.g.:

java -jar -Xmx4096M file.jar