1

Basically I have the same problem as in this question. However the proposed solution doesn't work for me, not on a Win2003 server and not on a Win7 laptop used for testing.

I have a Java SE 6 program that is started by a .Net program via an ActiveX-bridge dll. To test I used my Win7 computer with 3 JREs installed; jdk1.7.0_55, jre1.6.0_45 and jre1.6.0_38-x64. The application always uses the jre1.6.0_45 and starts up with a maximum of 95040KB of memory but I need it to be slightly more.

What works to increase the memory is editing the file <userprofile>\AppData\LocalLow\Sun\Java\Deployment\deployment.properties and adding the following line:

deployment.javaws.jre.1.args=-Xmx100m

but the problem is that this only works for one user and I want it to work for all users on a server.

As discussed in this answer I created a file C:\Windows\Sun\Java\Deployment\deployment.config with contents

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

Then I copied the deployment.properties file from my user profile to the C:\Windows\Sun\Java\Deployment\ folder and again added the deployment.javaws.jre.1.args=-Xmx100m line to the copied file. But strangely enough this doesn't work.

Things I tried so far:

  • placing the deployment.config and deployment.properties files in the lib folder of the used JRE (D:\Java\jre1.6.0_45\lib) and of the most recent JRE (D:\Java\jdk1.7.0_55\jre\lib)

  • placing the files in the C:\Windows\Sun\Java\Deployment folder of a (virtual) Win2003 server with only one JRE installed (v1.6.0_11)

  • added the lines deployment.javaws.jre.0.args=-Xmx100 and deployment.javaws.jre.2.args=-Xmx100 so all installed JREs would use the same settings

  • added second line with deployment.system.config.mandatory=true to the deployment.config file and altered the path to the deployment.properties file to something that doesn't exist -> Nothing happened and the application would start fine, so it seems the deployment.config file is totally ignored by the JRE.

Does anyone have a clue where am I going wrong?

THelper
  • 71
  • 1
  • 1
  • 9

1 Answers1

3
  1. I'm not sure that file\:C\:/Windows/Sun/Java/Deployment/deployment.properties is a valid Windows file URI. ORACLE documentation lists slightly different and more plausible one: file:///C:/Windows/Sun/Java/Deployment/deployment.properties

  2. Try setting deployment.system.config.mandatory to True and see if your app fails to start. If it fails, it means that JAVA can't access deployment.config by your URI and it needs fixing:

    The deployment.system.config.mandatory property is a boolean. If set to true, the deployment.properties file that is pointed to by the deployment.system.config property must be found and successfully loaded, otherwise, nothing is allowed to run. If the property is set to false, an attempt is made to find and load the deployment. properties file that is pointed to by the deployment.system.config property. If successful, the file is used, otherwise, the file is ignored. The default for the deployment.system.config.mandatory property is false.

  3. This post suggests, that you can try to to delete:

    • File: %localappdata%\Sun\Java\Deployment\deployment.properties

    • Registry key: HKEY_CURRENT_USER\Software\AppDataLow\Software\JavaSoft\DeploymentProperties

  4. There is an issue with JAVA 7, described in this post: Java 1.7 Auto-Update Deployment with SCCM/MDT

More thoughts:

I'm starting to think this JRE system-wide configuration doesn't work for any Java version. That or I am completly missing something

Well, I've found that it definitely not worked in 1.6.0_03 and 1.6.0_07:

Q: Java Plug-in related deployment properties are disregarded in the system level deployment properties file. The problem is strictly reproducible on 1.6.0_03 and 1.6.0_07.

A: Tested with 6u14 b01. System level deployment configuration is working in the new java Plug-in. We are not going to fix it for the old plugin. Close the CR as not reproducible in new plugin.

The system level deployment configuration is a feature for java webstart. It has not been used in java plug-in.

Since 6u10, the same jre selection mechanism is used for both new java plugin and java webstart. This makes it possible for new plugin to adapt the system level configuration. Mark this CR as a RFE and lower priority to medium.

And there is a workaround of sorts:

The following could serve as a workaround to the problem: "How to configure a property (e.g. Xmx) globally on a Windows PC ?"

This however is not specific to certain components like Java Plugin or Java Web Start.

Open Windows Control Panel: Advanced → Environment Variables → System Variables → New Variable
Variable name: _JAVA_OPTIONS
Variable value: -Xmx256m #(for example)
Close all windows pressing OK

Upon restart of "Internet Explorer" the configuration will be active. The configuration will affect all Java programs: both the launcher "java.exe" and Java Web Start "javaws.exe" and the Java Plugin as it is launched by a browser.

beatcracker
  • 1,359
  • 8
  • 13
  • Thank you for your answer! I tried the URI in various formats including the one you suggested but unfortunately no effect. I already tried your second suggestion earlier (see last bullet in my question) and also no effect, so I concluded that the JRE totally ignores the deployment.config file. I appreciate you help though. – THelper Mar 02 '15 at 14:38
  • Sorry, I missed that last bullet in your question :/. I've updated my answer, could try to delete suggested file and registry key and see what happens? – beatcracker Mar 02 '15 at 14:58
  • There is no `Sun` folder in `%localappdata%`. The only deployment.properties file is in `%userprofile%\AppData\LocalLow\Sun\Java\Deployment` I've deleted that one as well as the registry key on a Win7 computer but no effect. On Win2003 with only JRE6 there is no such registry key and deleting the deployment.properties from the user profile also doesn't have any effect. I'm starting to think this JRE system-wide configuration doesn't work for any Java version. That or I am completly missing something. – THelper Mar 02 '15 at 15:50
  • I've updated my answer: there is workaround available, maybe it would help you... – beatcracker Mar 02 '15 at 16:17
  • The _JAVA_OPTIONS global environment variable works great! It works both on my Win7 test machine with JRE6 and 7 as well as on the Win2003 server with JRE6_10. As small drawback is that now all Java applications use this global setting (so not only Java Plugin or Web start) even if you explicitly specify a different -Xmx startup parameter, but in my case that's not a problem. Thank you for your support! – THelper Mar 03 '15 at 10:50