如何配置 Chrome 的 Java 插件,使其使用计算机中现有的 JDK
在我的计算机 (Windows 7) 中安装 JDK 时,我执行以下操作。
- 使用 Oracle 安装程序安装最新的 1.7 JDK(仅 JDK,无 JRE)
- 复制安装文件夹,到我真正想要的地方,删除示例等。
- 卸载Java
- 集%JAVA_HOME%,将%JAVA_HOME%\ bin添加到%Path%
然后我在所有计算机中同步该文件夹,以便我保持更新(使用无限的加密内容) , jssecacerts,java .policy
、认可的库等)。
但是这有一个很大的警告,当 Chrome 需要使用加载一个使用 Java 的页面时,它会认为 Java 没有安装并想要安装它。我不想安装它,因为它会扰乱我的“手动安装”JDK。
那么有没有办法配置 Chrome,使其使用我磁盘中的 JDK? 我有 JDK 32 位和 JDK 64 位,所以这不是问题(我想我需要在 Chrome 中使用 32 位)。
我在 Chrome 项目中发现了一个问题,如何让Chrome Java插件引用现有的JDK而不重新安装Java?,但到目前为止没有回复...
更新:对于Ubuntu,请参阅Kalyan的答案
更新:我仍然继续使用这个成功接近,上次在win7上使用1.7.0_21
更新1.7.45:Windows注册表中的路径现在是[HKEY_LOCAL_MACHINE\SOFTWARE\MozillaPlugins]
When installing JDK in my machines (Windows 7), I do the following.
- install latest 1.7 JDK with the Oracle installer (just the JDK, no JRE)
- copy the install folder, to the place I really want, remove samples, etc.
- uninstall Java
- set %JAVA_HOME%, add %JAVA_HOME%\bin to %Path%
Then I synchronise that folder in all my machines so I keep it updated (with unlimited cryptography stuff, jssecacerts, java.policy
, endorsed libraries, etc).
BUT this has one big caveat, when Chrome needs to use load a page that uses Java, it thinks Java is not installed and wants to install it. I don't want to install it as it would mess with my 'hand-installed' JDK.
So is there a way to configure Chrome so it uses the JDK in my disk?
I have both JDK 32-bit and JDK 64-bit, so that is not a problem (I guess I would need to use the 32-bit one with Chrome).
I found a question in the Chrome project, How do I have the Chrome Java plugin reference an existing JDK without reinstalling Java?, but no replies so far...
UPDATE: for Ubuntu, see Kalyan's answer
UPDATE: I still continue to use this approach successfully, last time with 1.7.0_21 on win7
UPDATE for 1.7.45: the path in the windows registry now is [HKEY_LOCAL_MACHINE\SOFTWARE\MozillaPlugins]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
我花了一段时间四处寻找解决方案。
JDK 的安装中似乎没有 Mozilla 插件(Chrome 使用的插件)。它仅在 JRE 安装中。该插件由几个 DLL 组成,它们都以 np* 开头
I looked around for a solution to this for a while.
It appears that the JDK doesn't have the Mozilla plugins (which is what Chrome uses) in it's installation. It is only in the JRE installation. There are a couple of DLLs that make up the plugin and they all start with np*
在 Windows 7 64 位上,我使用以下脚本添加了注册表项:
请注意,您必须更改
Path
。On Windows 7 64-bit, I added the registry entry using the following script:
Note that you will have to change the
Path
.从 2015 年 4 月 14 日发布的版本 42 开始,Chrome 会阻止所有 NPAPI 插件,包括 Java。到 2015 年 9 月为止,将有一种方法可以解决此问题,方法是转到
chrome://flags/#enable-npapi
并单击Enable
。之后,您必须使用 IE tab extension 运行 Direct-X 版本的 Java 插件。Starting with Version 42, released April 14, 2015, Chrome blocks all NPAPI plugins, including Java. Until September 2015 there will be a way around this, by going to
chrome://flags/#enable-npapi
and clicking onEnable
. After that, you will have to use the IE tab extension to run the Direct-X version of the Java plugin.我使用的是 Windows 7 64 位,不知道是否可以为 Chrome 手动启用 JRE8 64 位。结果我的问题是 Java 插件 DLL 是 64 位的,在 32 位 Chrome 中无法工作。因此您需要安装x86版本的JRE。以下是您需要创建的 Windows 注册表设置
I'm on Windows 7 64 bit and couldn't understand if I can manually enable JRE8 64 bit for Chrome. Turned out that my problem was that Java plugin DLL is 64 bit which wouldn't work in 32 bit Chrome. Therefore you need to install x86 version of JRE. Below are Windows registry settings you need to create
显然,Chrome 在查找 Java 环境时会寻址 Windows 注册表中的一个键。由于插件安装了 JRE,因此该键被设置为 JRE 路径,因此如果您希望 Chrome 使用 JDK,则需要对其进行编辑。
regedit
编辑注册表。编辑“Path”,使其与 JDK 安装中相应的 dll 匹配:
<前><代码>注册表编辑4
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\MozillaPlugins\@java.com/JavaPlugin]
“描述”=“Oracle® 下一代 Java™ 插件”
“壁虎版本”=“1.9”
“路径”=“C:\ Program Files(x86)\ Java \ jdk1.6.0_29 \ jre \ bin \ new_plugin \ npjp2.dll”
“ProductName”=“Oracle® Java™ 插件”
“供应商”=“甲骨文公司”
“版本”=“160_29”
保存文件。
文件顶部的
REGEDIT 4
前缀可能仅适用于 Windows 7 64 位。Apparently, Chrome addresses a key in Windows registry when it looks for a Java Environment. Since the plugin installs the JRE, this key is set to a JRE path and therefore needs to be edited if you want Chrome to work with the JDK.
regedit
to edit the registry.Edit "Path" so that it matches the corresponding dll inside your JDK installation:
Save file.
The
REGEDIT 4
prefix at the top of the file might only be required for Windows 7 64-bit.在 Ubuntu 上,您可以按照以下步骤解决该问题:
$HOME/.mozilla
内创建一个名为 plugins 的目录(如果该目录尚不存在)创建使用以下命令创建到此目录中的 libnpjp2.so 的符号链接:
-或-
取决于您使用的是 32 位还是 64 位 JVM 安装。此外,$JAVA_HOME 是 JVM 安装的位置。
可以在此处找到更详细的说明。
On Ubuntu, You can follow these steps to resolve the issue:
$HOME/.mozilla
, if it doesn't exist alreadyCreate a symlink to libnpjp2.so inside this directory using this command:
-or-
depending on whether you're using a 32 or 64 bit JVM installation. Moreover, $JAVA_HOME is the location of your JVM installation.
More detailed instructions can be found here.
我使用 Windows 7 Professional 64 位,并安装了 32 位和 64 位 Java 7u9 jre。 Chrome 拒绝工作,直到我删除以下注册表项。
然后我刷新了 Chrome,小程序加载了一条警告,提示该插件已过期。我选择了“这次运行”,一切都按预期进行。
有两个与此相关的错误: 7118859 和7133818
I use Windows 7 Professional 64-bit and have both the 32-bit and 64-bit Java 7u9 jre's installed. Chrome refused to work until I deleted the following registry key.
Then I refreshed Chrome and the Applet loaded with a Warning that the plugin was out of date. I seleted "Run this time" and everything worked as expected.
There are two bugs related to this: 7118859 & 7133818
我遇到了类似的问题,但我决定更改 Chrome 设置,而不是更改 regedit
尝试以下步骤
chrome://plugins/
+ 详细信息< /code>(右上角)展开所有插件详细信息。
Java
并针对您不想使用的路径单击禁用
。您可能需要重新启动浏览器才能看到更改。这还假设您启用的 Java 是最新的 Java。
希望这有帮助
I came across a similar issue but instead of changing the regedit I decided to change the Chrome settings
Try the following steps
chrome://plugins/
+ Details
(top right corner) to expand all the plugin details.Java
and click onDisable
for the path(s) that you don't want to be used.You might have to restart the browser to see the changes. This also assumes that the Java that you have enabled is the latest Java.
Hope this helps