admin管理员组

文章数量:1665208

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).

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.

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/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/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.

The REGEDIT 4 prefix at the top of the file might only be required for Windows 7 64-bit.

本文标签: 插件机器JavachromeJDK