Bug 15109 - Liveconnect: no window.java object available in the DOM
Summary: Liveconnect: no window.java object available in the DOM
Alias: None
Product: WebKit
Classification: Unclassified
Component: Java (show other bugs)
Version: 523.x (Safari 3)
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Nobody
URL: http://jsx.webvm.net/liveconnectenv.html
: 17607 (view as bug list)
Depends on:
Reported: 2007-08-29 08:43 PDT by Kai Hendry
Modified: 2010-02-25 23:37 PST (History)
4 users (show)

See Also:

Liveconnect enabled test (274 bytes, text/html)
2007-08-29 08:44 PDT, Kai Hendry
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kai Hendry 2007-08-29 08:43:12 PDT
Via http://bugs.webkit.org/show_bug.cgi?id=9761 David Kilzer asked me to file a new bug about Liveconnect not working from the DOM.

I think this is the most pleasant way of accessing a Java VM, so could the bug priority be higher? Esp. since Liveconnect support is announced on http://www.apple.com/safari/download/

Btw this works in Firefox.

Thanks everyone,
Comment 1 Kai Hendry 2007-08-29 08:44:35 PDT
Created attachment 16156 [details]
Liveconnect enabled test

This is the same as the URL: field on the bug report
Comment 2 David Kilzer (:ddkilzer) 2007-08-29 14:57:51 PDT
Confirmed with a local debug build of WebKit r25284 with Safari 3 Public Beta v. 3.0.3 (522.12.1) on Mac OS X 10.4.10 (8R218).

Comment 3 David Kilzer (:ddkilzer) 2007-08-29 14:59:27 PDT
See also comments in Bug 9761.

Comment 5 Alexey Proskuryakov 2010-02-20 00:44:16 PST
window.java is a synonym for Packages.java, see <https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Packages>. I'm not sure if that's formally part of LiveConnect, FWIW.
Comment 6 Alexey Proskuryakov 2010-02-23 16:03:41 PST
*** Bug 17607 has been marked as a duplicate of this bug. ***
Comment 7 Alexey Proskuryakov 2010-02-25 22:18:12 PST
Per <http://java.sun.com/javase/6/webnotes/6u10/plugin2/liveconnect/index.html>, the global window.java and window.Packages properties are now deprecated, and for a good reason:

The Mozilla family of browsers has historically provided support for access to the Java language from JavaScript even on web pages that don't contain Java applets. In this browser family, there are global java, netscape and Packages keywords available to JavaScript code which allow calling static methods, accessing static fields, and creating new instances of Java classes in similar fashion to the per-applet Packages keyword above.

The semantics of these keywords becomes problematic when more than one applet is available on the web page. If you want to access one particular applet's user-defined classes (for example, in a com.mycompany package), how would the global Packages keyword know which applet to refer to? The new Java Plug-In also supports attaching more than one Java virtual machine instance to the web browser for executing applets. The semantics of these global keywords becomes even more complicated in this situation.

For this reason, the global java, netscape and Packages JavaScript keywords are deprecated. They continue to function in the Firefox browser, but it is strongly recommended to transition existing code using them to use the new per-applet Packages keyword. It is not possible to access user-defined classes using these global keywords; attempts to do so will yield undefined results.

We will probably need to support per-applet Packages property at some point, but I think that the global one is a clear WONTFIX.
Comment 8 Michael A. Puls II 2010-02-25 23:37:38 PST
(In reply to comment #7)
> Per
> <http://java.sun.com/javase/6/webnotes/6u10/plugin2/liveconnect/index.html>,
> the global window.java and window.Packages properties are now deprecated, and
> for a good reason:

Yeh, since Opera 10.5 now uses the NPAPI plug-in for Java, it no longer supports window.java stuff. And, they're not going to support it either because it's deprecated. (Opera never supported all the window.java stuff FF did anyway).