However, some scripting languages like PHP or Ruby are popular for web applications and the JDK 6 scripting API makes it easier to run such scripts from your Java program on the server.
You wouldn't code an entire web app or desktop app in a scripting language. You might use them if doing so provides an advantage over using Java. No language is perfect for everything, and Java is no exception.
Jesper�s example of AppleScript is perfect for this. In case you�re not familiar with it, it�s the system scripting language on Mac OS X, in some aspects similar to Windows Scripting Host on Windows. It can do many things that would be decidedly difficult to do in Java, maybe impossible to do without resorting to native code and JNI. Having a formal API to access it makes it easier and more stable to work with than executing commands using Runtime.exec or ProcessBuilder.
(Disclaimer: The next paragraph is about a project I implemented, but I think what I write as pretty objective). Another example is an API for Prolog. Prolog is not really a scripting language, but a regular programming language which is very useful for certain classes of problems (but would be hard to use for some others that in turn are simple in Java). By adapting it to the BSF API -which is kind of similar to the javax.scripting API, but runs on older JVMs as well- it became possible to drive Prolog programs from within Java code, and thus use the best of both worlds wherever appropriate. (By "both worlds" I mean that Prolog is logic-oriented, not object-oriented like Java, or procedural like C, and programming in it is rather different from either of those.)
So, in short, none of the languages usable through BSF or javax.scripting replaces Java - they augment it.
It's a pleasure to see superheros taking such an interest in science. And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop