how to change jvm memory heap using command line

Hi All,

I am quite new to java. I am having trouble with java memory heap. The default value seems too small for my application. But i am not sure how to modify the default setting correctly. I have tried the following command:

java -Xms512m -Xmx1024m

but it did not work. I executed this line at my home directory on a linux machine. Is there anything wrong with this? Do I need to execute the command in java's directory?

Millions of thanks,

Jerry

[489 byte] By [mickeysharea] at [2007-11-27 8:02:46]
# 1
just add this in your code where u need itSystem.gc();it will help a lot if u add it where u need it
ByronTheOmnipotenta at 2007-7-12 19:44:58 > top of Java-index,Java Essentials,New To Java...
# 2
oh u gotta run ur java program with that like this@echo offCOLOR c9TITLE whateverjava -Xmx256m *main class file*pauseMessage was edited by: ByronTheOmnipotent
ByronTheOmnipotenta at 2007-7-12 19:44:58 > top of Java-index,Java Essentials,New To Java...
# 3

You need to put those runtime parameters every time you run your Java application.

Calling System.gc() won't make a lot of difference. That is a call to the VM to do a garbage collection run, but it only advises the VM that you'd like to do a garbage collection run, the VM still decides when it will actually do it. Calling System.gc() doesn't guarantee anything will happen.

With good coding, you should never need to use a call to System.gc().

bryanoa at 2007-7-12 19:44:58 > top of Java-index,Java Essentials,New To Java...