更改浏览器中 Java 小程序使用的 Java 版本

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27413358/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-02 11:47:07  来源:igfitidea点击:

Change java version used by java applets in browser

javaapplet

提问by cbreezier

I am trying to do some automated testing with selenium on a site that has a java applet. Specifically, I want to test different java versions on different browsers.

我正在尝试在具有 Java 小程序的站点上使用 selenium 进行一些自动化测试。具体来说,我想在不同的浏览器上测试不同的java版本。

It is relatively easy to change the jre that is being used by local applications/commandline - usually just a modification of the PATH and perhaps a registry tweak (HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Runtime Environment/CurrentVersion seems to need to be changed sometimes).

更改本地应用程序/命令行正在使用的 jre 相对容易 - 通常只是修改 PATH 并且可能是注册表调整(HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Runtime Environment/CurrentVersion 有时似乎需要更改) .

But I can't seem to manage to change what a browser applet uses. It is my understanding that this version is determined by the plugin for that browser. I've tried to get around this by actually uninstalling all the jre on the machine, then installing the specific version I want to test. However, I need java to be available at all times so I am preserving a jdk (1.8.0_25).

但我似乎无法更改浏览器小程序使用的内容。我的理解是这个版本是由那个浏览器的插件决定的。我试图通过实际卸载机器上的所有 jre,然后安装我想要测试的特定版本来解决这个问题。但是,我需要 Java 始终可用,因此我保留了 jdk (1.8.0_25)。

This works, sometimes. Recently I've been trying to install jre7 (update 71 and update 72) but neither installation seems to affect the version of java used in the applet. In firefox, the add-ons page shows Java (TM) Platform SE 7 U72 10.72.2.14under plugins, and yet it is running 1.8.0_25in applets (from http://javatester.org/version.html)

这有时有效。最近我一直在尝试安装 jre7(更新 71 和更新 72),但是这两种安装似乎都不会影响小程序中使用的 java 版本。在 firefox 中,附加组件页面显示Java (TM) Platform SE 7 U72 10.72.2.14在插件下,但它1.8.0_25在小程序中运行(来自http://javatester.org/version.html

My question is: how can I ensure that a specific version of java is running in browser applets? Sorry if my situation is a bit confusing - I've tried cutting it down to the bare minimum.

我的问题是:如何确保特定版本的 java 在浏览器小程序中运行?对不起,如果我的情况有点混乱 - 我已经尝试将其减少到最低限度。

OS: Windows 7 Enterprise

操作系统:Windows 7 企业版

Browsers: Chrome 39.0.2171.71 m, FF35.0, 33.0, 27.0, IE8

浏览器:Chrome 39.0.2171.71 m、FF35.0、33.0、27.0、IE8

回答by DavidPostill

Reference Java Control Panel

参考Java 控制面板

Java

The Java panel looks like this:

enter image description here

Click the View... button to access the Java Runtime Environment Settings dialog. Java Runtime Environment Settings

These settings will be used when a Java application is launched. The Java Runtime Environment Settings dialog looks like the following on Microsoft Windows:

enter image description here

Each row in the Java Runtime Versions panel represents a Java Runtime Environment that is installed in your computer. You may modify the value in each cell by double-clicking it:

  • Platform: The version of the Java Runtime Environment
  • Product: The full version number of the Java Runtime Environment (which includes the update number)
  • Location: The URL that Java Update Scheduler uses to launch automatic updates
  • Path: The full path name of the Java Runtime Environment
  • Runtime Parameters: Optional custom options used to override the Java Plug-in default startup parameters
  • Enabled: This option is for selecting which of the (older) JRE versions to consider when running an app using Java Plug-in or Java Web Start. If this check box is not selected, then Java Plug-in and Java Web Start will not use this JRE to launch Java apps. However, the current JRE might be used regardless of this checkbox. This checkbox does not affect stand alone applications, it is only for Java in the browser. Note that if all Java apps are disabled from running in the browser, by de-selecting Enable the Java content in the browser in the Security panel, enabling the JRE here has no effect.

爪哇

Java 面板如下所示:

在此处输入图片说明

单击“查看...”按钮以访问“Java 运行时环境设置”对话框。Java 运行时环境设置

这些设置将在 Java 应用程序启动时使用。Java 运行时环境设置对话框在 Microsoft Windows 上如下所示:

在此处输入图片说明

Java Runtime Versions 面板中的每一行代表一个安装在您计算机中的 Java Runtime Environment。您可以通过双击来修改每个单元格中的值:

  • 平台:Java 运行时环境的版本
  • 产品:Java 运行时环境的完整版本号(包括更新号)
  • 位置:Java Update Scheduler 用于启动自动更新的 URL
  • Path:Java 运行时环境的完整路径名
  • 运行时参数:用于覆盖 Java 插件默认启动参数的可选自定义选项
  • 已启用:此选项用于选择在使用 Java Plug-in 或 Java Web Start 运行应用程序时要考虑的(旧)JRE 版本。如果未选中此复选框,则 Java Plug-in 和 Java Web Start 将不会使用此 JRE 来启动 Java 应用程序。但是,无论此复选框如何,都可能使用当前的 JRE。此复选框不影响独立应用程序,它仅适用于浏览器中的 Java。请注意,如果所有 Java 应用程序都被禁止在浏览器中运行,通过在安全面板中取消选择在浏览器中启用 Java 内容,在此处启用 JRE 将不起作用。

Use the Enabledcheckbox to select which JRE to use when running an app using Java Plug-in or Java Web Start.

使用Enabled复选框选择在使用 Java Plug-in 或 Java Web Start 运行应用程序时要使用的 JRE。