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
Maybe you can try modifying a System Deployment Properties file? Short version of usage below:
- You need to create a file named
deployment.configand put it in either%SystemRoot%\Sun\Java\Deploymentor your JRE's\lib\directory. The
deployment.configcontains a pointer to adeployment.propertiesfile, as below:deployment.system.config=file\:C\:/Windows/Sun/Java/Deployment/deployment.propertiesThe
deployment.propertiesfile 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 withdeployment.cache.enabled=falseand prevent users from changing the value withdeployment.cache.enabled.locked=If you're not sure about the syntax, make the changes for yourself and look at thedeployment.propertiesfile normally located inC:\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 inAppData\LocalLow\Sun\Java\Deployment.
I don't know if you can set the JRE options like this, but it's worth a shot.
- That's perfect, thanks. I had been changing the
deployment.propertiesfile inC:\Documents and Settings\<username>\Local Settings\Application Data\Sun\Java\Deployment. But this is a simple solution for all userssteviey– steviey2011-05-18 16:19:18 +00:00Commented May 18, 2011 at 16:19 - For anyone implementing this, it's worth noting that setting this seems to override any user-specific settingssteviey– steviey2011-05-18 16:21:43 +00:00Commented May 18, 2011 at 16:21
- Also, since
deployment.configuses an URL to point at the.propertiesfile, 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.configthough.afrazier– afrazier2011-05-18 18:18:16 +00:00Commented May 18, 2011 at 18:18 - 1Thanks again. For anyone else trying to do this, copy the
deployment.propertiesfile from yourApplication Data\Sun\Java\Deploymentfolder into your%SystemRoot%\Sun\Java\Deploymentfolder. 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– steviey2011-05-18 20:58:51 +00:00Commented 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– inimene2017-09-26 12:42:22 +00:00Commented Sep 26, 2017 at 12:42
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.
- Thanks for your response. I've tried setting windows environment variables
JAVA_OPTIONS,_JAVA_OPTIONSandJAVA_OPTS. None of them seem to be getting picked up by the JVM (I'm checking this by looking at thejavaplugin.vm.optionsvalue when I hit 's' in the java console). I should mention that the Java application is actually an applet. Oracle Forms 10g.steviey– steviey2011-05-18 14:46:21 +00:00Commented May 18, 2011 at 14:46 - Ah ok, applets work differently; I've edited the answer now.Vineet Reynolds– Vineet Reynolds2011-05-18 15:54:08 +00:00Commented 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 helpsteviey– steviey2011-05-18 16:17:24 +00:00Commented 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– Synetech2015-11-29 22:11:01 +00:00Commented Nov 29, 2015 at 22:11
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.