Java Reference
In-Depth Information
Scripting Java Classes with JavaScript
Scripting languages have two features that makes them easier to use than
full-fledged programming languages such as Java. First, they are interpreted.
The interpreter program reads each line of program code and executes it
immediately without compiling it first. That makes experimenting much more
funȌyou get immediate feedback. Also, scripting languages are usually loosely
typed, meaning you don't have to declare the types of variables. Every variable
can hold values of any type. For example, the Scripting Java Classes with
JavaScript figure shows a scripting session with Rhino, a JavaScript
implementation that allows you to manipulate Java objects. The script stores
frame and label objects in variables that are declared without types. It then calls
methods that are executed immediately, without compilation. The frame pops up
as soon as the line with the setVisible command is entered. (If you use an
earlier version of Java, you can achieve the same effect with the Rhino scripting
engine. You can download Rhino from the Mozilla web site [ 2 ]). In recent years,
authors of computer viruses have discovered how scripting languages simplify
their lives. The famous Ȓlove bugȓ is a Visual Basic Script program that is sent
as an attachment to an e-mail. The e-mail has an enticing subject line ȒI love
Search WWH ::




Custom Search