• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 22. Using Java with JavaScript > Using Java Classes Directly

22.3. Using Java Classes Directly

As described in the previous two sections, both Netscape and Internet Explorer allow JavaScript code to interact with Java applets and Java applets to interact with JavaScript. Netscape's LiveConnect technology also allows JavaScript programs to instantiate their own Java objects and use them, even in the absence of any applets. Internet Explorer does not have any analogous capability.

In Netscape, the Packages object provides access to all the Java packages that Netscape knows about. The expression Packages.java.lang refers to the java.lang package, and the expression Packages.java.lang.System refers to the java.lang.System class. For convenience, java is a shortcut for Packages.java. In Netscape, JavaScript code might invoke a static method of this java.lang.System class as follows:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint