Many implementations of scripting and dynamically typed languages
generate Java bytecodes so that programs can be run on the Java
Platform, just as are actual Java programs. Implementing a language
in this way (or as a Java interpreter class for the scripting language)
provides all the advantages of the Java platform - scripting implementations
can take advantage of the Java platform's binary portability, security,
and high performance bytecode execution.
Java SE 6 includes JSR 223: Scripting for the Java™
Platform API. This is a framework by which Java Applications can "host" script engines. Sun's implementation
of Java SE 6 includes an example script engine based on Mozilla Rhino:JavaScript for
Java. The scripting framework supports third-party script engines through jar "service discovery" mechanism.
It is possible to "drop" any JSR-223 compliant script engine in the CLASSPATH and access the same from your Java applications
(much like JDBC drivers, JNDI implementations are accessed).