Scripting for the Java™ Platform |
Many implementations of scripting and dynamically typedlanguages generate Java bytecodes so that programs can be run onthe Java Platform, just as are actual Java programs. Implementing alanguage in this way (or as a Java interpreter class for thescripting language) provides all the advantages of the Javaplatform - scripting implementations can take advantage of the Javaplatform's binary portability, security, and high performancebytecode execution.
Java SE 6 includesJSR 223: Scripting for theJava™ Platform API. This is a framework by which JavaApplications can "host" script engines. Sun's implementation ofJava SE 6 includes an example script engine based onMozilla Rhino:JavaScript forJava. The scripting framework supports third-party scriptengines through jar "service discovery" mechanism. It is possibleto "drop" any JSR-223 compliant script engine in the CLASSPATH andaccess the same from your Java applications (much like JDBCdrivers, JNDI implementations are accessed).
![]() |