0 Replies Latest reply: Jan 18, 2013 1:37 PM by 985814 RSS

    command to modify Java Control Panel selections?

      How to modify Java Control Panel selections (corresponding to deployment.properties file) from windows command prompt?
      Specifically, I am looking for command(s) which can effect change in "Action for local applets" selection, in "Custom Security Level Settings" window (click the "Settings..." button next to "Custom" setting for the "Security Level" slider in the Security tab in Java Control Panel), from "Prompt user" to "Run without prompt"`. This setting's default value changed with update 11 of Java 7 and it interferes with operation of an automated-test program, which I am fixing now, by having a Security Warning dialog window pop-up when IE starts java.exe, unless this Java Control Panel setting is adjusted a priori. This test program launches IE to run a local Java applet, which is written using AWT, and which doesn't access any websites.

      Note, this problem has been discussed recently -- see https://service.parachat.com/knowledgebase/273/I-see-a-Do-you-want-to-run-this-application-security-warning.html

      For my task, modifying this Java Control Panel setting manually is the least desirable way to solve the problem because the program, which I am fixing, is a part of an automated test suite, which is deployed on many machines, and requiring manual intervention makes the deployment process error-prone. I need these commands to run from a windows command prompt batch file.

      I found that these security level selections are recorded in Java deployment.properties file and in 2 Windows registry under keys with names ending in `"Software\JavaSoft\DeploymentProperties".`
      deployment.properties file is discussed comprehensively in http://docs.oracle.com/javase/7/docs/technotes/guides/deployment/deployment-guide/properties.html but nothing obvious is mentioned about "Action for local applets", maybe because this property is a recent addition (?)
      When I adjust Java Security Level and "Action for local applets" in the Java Control Panel, I see the changes reflected in the deployment.properties file as well as in the DeploymentProperties registry keys.

      So I can do the following:

      1. adjust the deployment.properties file via script (saving the original)
      2. start Java Control Panel via script -- I observed that this copies the updates from the deployment.properties file to the registry keys DeploymentProperties
      3. terminate the javaw process which runs the Java Control Panel

      - then run the program which uses my local Java applet within IE
      - then revert the deployment.properties file to the original, start Java Control Panel via script, and terminate the javaw process which runs the Java Control Panel.

      I also tried it vice versa -- update the registry key -- but the file does not change and Java Control Panel reverts the registry keys' value set back to agree with the unmodified deployment.properties file! So updating the registry keys is a wrong way to do it.

      Is there a better way to do this? My 3-step solution above (to modify the properties) is a kluge for what it is meant to accomplish. Is there a Java command-line utility which can modify a given deployment property? Is there a way to pass these deployment properties to JVM via applet tag's attributes, to be effective only within the given Java applet?

      I used Windows XP (both 32-bit and 64-bit) and Windows 7 (64-bit) and Internet Explorer 7, 8 and 9. It would be good to have a (simple) solution which works on Windows XP, Windows Vista, Windows 7 and Windows 8.

      Edited by: 982811 on Jan 18, 2013 11:35 AM