Packages.java

JavaScript 1.1+ Nav3+, NES2+ Syntax

Packages.java.className.methodName
						

Description

The java sub-package of the Packages object refers to the JavaPackage containing the core Java class library. This sub-package is used for several things, but most notably for adding security to LiveConnect and accessing the Java Console.

Example

Listing 6.201 shows an example for the java package. It is used to write text to the Java Console.

Listing 6.201 Example Packages.java Sub-package
<html>
<body>
<script language="JavaScript1.1">
<!–– Hide

// Use the Java package to write text to the Java Console
Packages.java.lang.System.out.println("Hello World!");

// End Hide ––>
</script>

</body>
</html>
							
							
						

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.