Hi, i want to run a jar from the command line and i want to specify that it needs 2 GB of memory
i think -Dkey=value would help me, but i don't know what should be the key in this case
i believe value would be -Xmx2048m
To specify the memory settings you can use -Xmx and -Xms. -Xms specifies the minimum heapsize and -Xmx specifies the maximum size.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
That way you're giving the parameters as application parameters and not as jvm parameters. The correct syntax is:
java -jar -Xmx2048m foo.jar
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
A 32-bit JVM cannot use more than 1.5GB of memory, at least on Windows. If you need more you will need to switch to a 64-bit JVM on a 64-bit Windows machine. This is not a limitation of the JVM but of Windows. I'm not sure if Linux has the same limitation.
Rob Prime wrote:. . . I'm not sure if Linux has the same limitation.
It hasn't on my laptop; Fedora will happily use -Xmx2048M, but not -Xmx3072M. Maybe if I had paid a bit more and got more than 2GB RAM it would accept 3072!
He got surgery to replace his foot with a pig. He said it was because of this tiny ad:
a bit of art, as a gift, that will fit in a stocking