2

Possible Duplicate:
How to set a java system property so that it is effective whenever I start JVM without adding it to the command line arguments

jvm heap seize setting has two option for Runtime Parameter, users & System. If every application is uses memory from users what is the use of having system wide setting for runtime parameter?

Can we use memory from System Option that can be set only once and will be applicable for every user of the system?

Community
  • 1
  • 1
Rajesh Kumar
  • 89
  • 2
  • 12
  • Actually my application(swing) read jvm heap memory from Users runtime Parameter,that is to be set for every user one by one basis,Is there any way that my application use the System option for RunTime Parmeter? – Rajesh Kumar Oct 04 '12 at 05:59
  • Environment variable can be set to different values for different users. – Vadzim Oct 04 '12 at 06:02
  • It also can have global default to all users. – Vadzim Oct 04 '12 at 06:09
  • Thanks Vadzim.Could you Please help me with how i can set global default for all users?Actually if i am setting System's Runtime Parameter then it persists for all users but my problem is my swing application uses User's option for Runtime Parameter. – Rajesh Kumar Oct 04 '12 at 06:57
  • What exact settings and values did you try? Do you refer to Java Control Panel settings under Windows? User setting always overrides System default if specified. It has to be omitted for system default to become active. – Vadzim Oct 04 '12 at 08:44

1 Answers1

0

I guess "Runtime Parameter" and "System Option" terms refer to Java Control Panel settings, which was not clear at all from the question.

These settings may be used only for Java Applets and Java Web Start apps. Whether it would apply to your swing app depends on how it is actually started.

Take a look at Setting Java Runtime setting for all users on a client PC and How can I start an Java applet with more memory? for further hints.

While How to set a java system property so that it is effective whenever I start JVM without adding it to the command line arguments proposes solution with environment variable for usual java apps. See also How to change environment variables under Windows 7.

Community
  • 1
  • 1
Vadzim
  • 24,954
  • 11
  • 143
  • 151
  • Thanks Vadzim. Actually i am working on an Applet application which use web as a starter and after that jar's are downloaded through cimXML and applet runs on the client pc.But the problem is I did whatever i got like you suggested severfaul.com ques no:270924 but i couldnot find any way to set the jvm memory programmetically. Like i tried to put set JAVA_OPTS=-Xmx512m in a method of a source file and also put the but nothing worked.Please help – Rajesh Kumar Oct 04 '12 at 10:26
  • Try "-Xmx512m" not "-Xmx512M". I suppose you've ensured that java version is higher than Java 6 Update 10. – Vadzim Oct 04 '12 at 13:09
  • Thanks a lot Vadzim... I am able to set maxHeapMemoryby:: System.setProperty("javaplugin.vm.options","-Xmx512m"); It is working for Windows 7 but for Xp it is not. Is there any way to set minHeapMemory if i want to minimum also then can i do like:: System.setProperty("javaplugin.vm.options","-Xmx512m","-Xms256m"); Please suggest – Rajesh Kumar Oct 05 '12 at 07:09