如何从 Windows 命令提示符修改 Java 控制面板选项(对应于 deployment.properties 文件)? [英] How to modify Java Control Panel selections (corresponding to deployment.properties file) from windows command prompt?

查看:23
本文介绍了如何从 Windows 命令提示符修改 Java 控制面板选项(对应于 deployment.properties 文件)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从 Windows 命令提示符修改 Java 控制面板选项(对应于 deployment.properties 文件)?具体来说,我正在寻找可以在 本地小程序的操作" 选择中影响更改的命令,自定义安全级别设置" 窗口 (单击Java 控制面板中安全"选项卡中安全级别"滑块的自定义"设置旁边的设置..."按钮),从 提示用户"无提示运行".此设置的默认值随 Java 7 的更新 11 更改,它会干扰自动化测试程序的运行,我现在正在修复该程序,通过在 IE 启动 java.exe 时弹出安全警告对话框窗口,除非此 Java 控件面板设置是预先调整的.本测试程序启动IE运行本地Java小程序,使用AWT编写,不访问任何网站.

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.

注意,这个问题最近已经讨论过 -- 见 https://service.parachat.com/knowledgebase/273/I-see-a-Do-you-want-to-run-this-application-security-warning.html

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

对于我的任务,手动修改此 Java 控制面板设置是解决问题的最不理想的方法,因为我正在修复的程序是自动化测试套件的一部分,该套件部署在许多机器上,并且需要人工干预使部署过程容易出错.我需要这些命令才能从 Windows 命令提示符批处理文件中运行.

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.

我发现这些安全级别选择记录在 Java deployment.properties 文件和 2 Windows 注册表中名称以 Software\JavaSoft\DeploymentProperties"结尾的键下.deployment.properties 文件在 Oracle 中有全面的讨论Java SE 文档部署配置文件和属性" 但没有明显提到 本地小程序的操作",可能是因为这个属性是最近添加的(?)当我在 Java 控制面板中调整 Java 安全级别和 本地小程序操作" 时,我看到了在 deployment.properties 文件以及 DeploymentProperties 注册表项中反映的更改.

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 Oracle Java SE Documentation "Deployment Configuration File and Properties" 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. 通过脚本调整deployment.properties文件(保存原文件)
  2. 通过脚本启动 Java 控制面板 -- 我观察到这将更新从 deployment.properties 文件复制到注册表项 DeploymentProperties
  3. 终止运行 Java 控制面板的 javaw 进程

  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

  • 然后在 IE 中运行使用我本地 Java 小程序的程序
  • 然后将 deployment.properties 文件还原为原始文件,通过脚本启动 Java 控制面板,并终止运行 Java 控制面板的 javaw 进程.

我也试过反之亦然——更新注册表项——但文件没有改变,Java控制面板将注册表项的值恢复为与未修改的deployment.properties文件一致!因此更新注册表项是一种错误的方式.

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.

有没有更好的方法来做到这一点?我上面的 3 步解决方案(修改属性)是它要完成的任务的一个kluge.是否有可以修改给定部署属性的 Java 命令行实用程序?有没有办法通过小程序标签的属性将这些部署属性传递给 JVM,使其仅在给定的 Java 小程序中有效?

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?

我使用了 Windows XP(32 位和 64 位)和 Windows 7(64 位)和 Internet Explorer 7、8 和 9.如果有一个适用于 Windows XP 的(简单)解决方案会很好、Windows Vista、Windows 7 和 Windows 8.

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.

推荐答案

只需制作自己的 deployment.properties 文件并将其放入 *{User Application Data Folder}\LocalLow\Sun\Java\部署* 位置.或编辑现有文件.需要重新启动互联网浏览器.

Just make your own deployment.properties file and put it in the *{User Application Data Folder}\LocalLow\Sun\Java\Deployment* location. Or edit the existing file. Need internet browser restart.

http://docs.oracle 中所述.com/javase/7/docs/technotes/guides/jweb/properties.html

这篇关于如何从 Windows 命令提示符修改 Java 控制面板选项(对应于 deployment.properties 文件)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆