I have many small java programs running in crons in my server. I have an openvz VPS, and java is very poblematic with memory and openvz.
The best solution i have come up so far is running my programs with:
java -Xmx16m class
This works ok, but I have many programs running, and i want to set the default maximum heap for all the system, so that i don't change all the start up scripts, and not have to remember to do that every time i write a new one.
I tried finding a way to set/change a global default value for my CentOS system, but i had no luck with that!
I would appreciate if someone could help m开发者_如何转开发e.
Thanks.
You could try adding this to your shell profile export _JAVA_OPTIONS=-Xmx16m
This may or may not work depending on what JVM you are running.
Create an environment variable _JAVA_OPTIONS
and set the new value there. That should work
精彩评论