5

We have a problem with a java application running out of memory. Our (Windows XP) client PCs have JRE 1.6 version 18 installed. I want to increase the -Xmx runtime parameter for the JRE to 512M but I can't seem to set this for all users. When I log in to the PC as Administrator and set the Runtime parameters in the Java Console, these settings only appear for my login.

3 Answers 3

8

Maybe you can try modifying a System Deployment Properties file? Short version of usage below:

  1. You need to create a file named deployment.config and put it in either %SystemRoot%\Sun\Java\Deployment or your JRE's \lib\ directory.
  2. The deployment.config contains a pointer to a deployment.properties file, as below:

    deployment.system.config=file\:C\:/Windows/Sun/Java/Deployment/deployment.properties

  3. The deployment.properties file contains the properties that you want to set system-wide, one per line. For my organization, we occasionally have problems with the JRE's caching causing problems, so I disable it with deployment.cache.enabled=false and prevent users from changing the value with deployment.cache.enabled.locked= If you're not sure about the syntax, make the changes for yourself and look at the deployment.properties file normally located in C:\Documents and Settings\<username>\Local Settings\Application Data\Sun\Java\Deployment. At least, I think that's the path in XP. On my Win 7 system it's in AppData\LocalLow\Sun\Java\Deployment.

I don't know if you can set the JRE options like this, but it's worth a shot.

5
  • That's perfect, thanks. I had been changing the deployment.properties file in C:\Documents and Settings\<username>\Local Settings\Application Data\Sun\Java\Deployment. But this is a simple solution for all users
    – steviey
    May 18, 2011 at 16:19
  • For anyone implementing this, it's worth noting that setting this seems to override any user-specific settings
    – steviey
    May 18, 2011 at 16:21
  • Also, since deployment.config uses an URL to point at the .properties file, it's possible to host the file on an intranet server and have clients retrieve the file via HTTP. You still have to deploy the .config though.
    – afrazier
    May 18, 2011 at 18:18
  • 1
    Thanks again. For anyone else trying to do this, copy the deployment.properties file from your Application Data\Sun\Java\Deployment folder into your %SystemRoot%\Sun\Java\Deployment folder. Then add the following line: deployment.javaws.jre.0.args=-Xms64m -Xmx512m. The '0' corresponds to the JRE you want to set these parameters for. It may be different, i.e. 1,2 etc., it depends how many JREs you have installed. It will be clear from the other lines in the file which number JRE you want.
    – steviey
    May 18, 2011 at 20:58
  • I think it's wrong to accept an answer that only provides solution for one platform. Even if the question it self asked for Windows, people from other systems might still read this in future. For them it's almost useless information.
    – inimene
    Sep 26, 2017 at 12:42
2

Use the JAVA_OPTIONS environment variable to store the runtime options that will be used by the JVM during startup.

As far as setting this across users is concerned, you could do this via a logon script or via the Windows registry.

Edit:

Given the presence of a Java applet, it would be worthwhile to investigate whether Java 6 Update 10 or higher versions of the Java runtime could be installed on desktop PCs. Additionally, one would also have to specify the desired Xmx value using the java_arguments parameter to the applet; this parameter was introduced in 6u10. This might not be so trivial in the case of Oracle Forms 10g, as it requires editing of the web page where the applet is loaded from, but is worth a try.

See the related StackOverflow question for more details.

4
  • Thanks for your response. I've tried setting windows environment variables JAVA_OPTIONS, _JAVA_OPTIONS and JAVA_OPTS. None of them seem to be getting picked up by the JVM (I'm checking this by looking at the javaplugin.vm.options value when I hit 's' in the java console). I should mention that the Java application is actually an applet. Oracle Forms 10g.
    – steviey
    May 18, 2011 at 14:46
  • Ah ok, applets work differently; I've edited the answer now. May 18, 2011 at 15:54
  • Thanks Vineet, the jre is 6u18. The easiest solution seems to be the one offered by afrazier below. Thanks for your help
    – steviey
    May 18, 2011 at 16:17
  • Thanks for the tip about JAVA_TOOL_OPTIONS. I completely wasted the weekend trying to get Processing to use Unicode characters (despite its claims that it already does) and none of the 30+ things I tried worked… until this. Thank you!
    – Synetech
    Nov 29, 2015 at 22:11
2

The Windows environmental variable is called JAVA_TOOL_OPTIONS.

The deployment.properties file is the same as starting System Properties -> Java -> (Tab) Java -> (Button) View and modifying the runtime parameter table entry.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .