如何配置Chrome的Java插件,以便它使用机器中现有的JDK [英] How to configure Chrome's Java plugin so it uses an existing JDK in the machine
问题描述
- 使用Oracle安装程序安装最新的1.7 JDK。
在我的机器(Windows 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项目中发现了一个问题, 如何在不重新安装Java的情况下使Chrome浏览器插件引用现有的JDK? ,但目前为止还没有回复...
更新:对于Ubuntu,请参阅Kalyan的回答
更新:我仍然继续成功使用这种方法,上次在1.7版本上使用win7
更新为1.7.45:现在Windows注册表中的路径是[HKEY_LOCAL_MACHINE \ SOFTWARE \MozillaPlugins]
解决方案显然,当Chrome寻找Java环境时,Chrome会在Windows注册表中寻找一个关键字。由于该插件安装了JRE,因此该键被设置为JRE路径,因此如果您希望Chrome能够与JDK一起使用,则需要对其进行编辑。
$ b- 运行插件安装程序。
- 开始 - >运行( Winkey + R ),然后输入
regedit
编辑注册表。 - 找到 HKEY_LOCAL_MACHINE \SOFTWARE\Wow6432Node\MozillaPlugins\@java.com/JavaPlugin 。 >
- 将其导出为注册文件以说出您的桌面(右键单击并选择导出)。 卸载JRE控制面板 - >添加或删除程序)。这应该删除上面的密钥,解释首先需要导出它。
- 使用文本编辑器(例如Notepad ++)打开导出到桌面的reg文件。 >
-
编辑Path,以便它与JDK安装中相应的dll匹配:
REGEDIT 4
[HKEY_LOCAL_MACHINE \SOFTWARE\Wow6432Node\MozillaPlugins\@java.com/JavaPlugin]
Description=Oracle®Next Generation Java™Plug-In
GeckoVersion=1.9
Path=C:\程序文件(x86)\Java\jdk1.6.0_29\jre\bin\ new_plugin\\\
pjp2.dll
ProductName=Oracle®Java™插件
供应商=Oracle Corp.
Version=160_29
-
保存文件。
- 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%
- Run the plugin installer anyways.
- Start -> Run (Winkey+R) and then type in
regedit
to edit the registry. - Find HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\MozillaPlugins\@java.com/JavaPlugin.
- Export it as a reg file to say, your desktop (right-click and select Export).
- Uninstall the JRE (Control Panel -> Add or Remove Programs). This should delete the key above, explaining the need to export it in the first place.
- Open the reg file exported to your desktop with a text editor (such as Notepad++).
Edit "Path" so that it matches the corresponding dll inside your JDK installation:
REGEDIT 4 [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\MozillaPlugins\@java.com/JavaPlugin] "Description"="Oracle® Next Generation Java™ Plug-In" "GeckoVersion"="1.9" "Path"="C:\Program Files (x86)\Java\jdk1.6.0_29\jre\bin\new_plugin\npjp2.dll" "ProductName"="Oracle® Java™ Plug-In" "Vendor"="Oracle Corp." "Version"="160_29"
Save file.
- Double click modified reg file to add keys to your registry.
$ b
REGEDIT 4
文件顶部的前缀可能仅适用于Windows 7 64位。
When installing JDK in my machines (Windows 7), I do the following.
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]
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.
The REGEDIT 4
prefix at the top of the file might only be required for Windows 7 64-bit.
这篇关于如何配置Chrome的Java插件,以便它使用机器中现有的JDK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!