http://www.javaworld.com/javaworld/jw-03-2005/jw-0314-scripting-p4.html最重要的信息:“目前有so多的Java scripting language”, :-)
转一张评测图:
作者的final thoughts还是挺有意义的:
Final thoughts
If you need to integrate scripting support code into your Java application, my advice is to pick a single scripting interpreter and standardize on it. Costs are associated with each scripting language you support in your product, so don't make more work for yourself by trying to hook more than one scripting interpreter into your application. When adding scripting support, you can further simplify things by using an interpreter written in Java instead of a native interpreter such as Python or Tcl. That will make your solution more portable and simplify the integration task between your Java program and the interpreter.
If your developers or customers are already familiar with a particular scripting language like Tcl, Python, Ruby, or JavaScript, obviously you'll want to look seriously at the interpreter that supports that language (Jacl, Jython, JRuby, or Rhino, respectively). If you don't have that constraint, you will have a harder choice. In some ways, it's a bit like going to a new car lot. All of the choices will work, so you are left with balancing the differences between the alternatives, such as performance or options.
Some of these interpreters perform simple tasks faster than others. Some are updated and released more often, or have better documentation or debugging facilities than others. Some support compilation of scripts to bytecode. Some have language syntaxes that will either appeal to a developer or not, depending on preference, programming background, and the specific task at hand. As with most engineering tasks, you have to define your requirements and then investigate some to come up with the right answer.
If I had to distill what I learned from working with the different interpreters down to a bare minimum, here's what I'd say:
Jacl eases your entrance into scripting. Integration is simple, and if you need your scripts to be written in Tcl, it works well. If speed is your top priority, you may want to consider other choices.
Jython is one of the fastest scripting interpreters. From looking at the Website, it seems that Jython development is about to renew, which is good news. There are several good books on Jython. If you like the Python language, Jython is a solid choice.
BeanShell is not as fast as the quickest of the interpreters, but the 2.0 release supports loading of ordinary Java source, which is a strong selling point. I tried loading and running several Java source programs as scripts and found BeanShell to work fine, which is impressive. The libraries are well-organized and make integration simple. If performance is not the single most important criteria for your scripting interpreter and you want to write Java scripts, look at BeanShell.
Rhino is the winner of the performance benchmarking test and also supports Java-like syntax in its scripting. There are plenty of books on JavaScript available. Rhino appears to be well supported, and the distribution includes a useful debugger.
Pnuts is one of the fastest scripting interpreters. I am impressed with the completeness of the documentation, the simple usability of the debugger, and how straightforward it is to get things working with Pnuts. If the Pnuts syntax is a good fit for your needs, this interpreter deserves a good look.
JudoScript is in the middle of the pack for the performance benchmark, but supports a JavaScript-like syntax that is easy to learn. The documentation seems to be thorough and well organized, and the distribution includes lots of script examples. I ran version 0.9, which seemed to work well.
JRuby brings the feature set of Ruby to the table. It isn't the fastest of the interpreters, but if Ruby syntax and functionality is important to you, take a look at this interpreter. I ran version 0.8, which seemed to work just fine for my simple tests.
Groovy has attracted quite a bit of attention and development effort in the Java community. It is one of the fastest interpreters on the benchmarking tests, even without compiling the scripts down to classfiles. The syntax is Java-like and supports some powerful features that Java doesn't. This is an interesting addition to the programmer's toolkit that has a lot of potential.