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 me.
Thanks.
Advertisement
Answer
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.