File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Applets and the fly likes Applets and scripting constraints? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Applets and scripting constraints?" Watch "Applets and scripting constraints?" New topic

Applets and scripting constraints?

Siegfried Heintze
Ranch Hand

Joined: Aug 11, 2000
Posts: 397
I know groovy is incompatible with applets and I know jython works well for implementing applets (or at least the hello world applet works with jython). What are the other constraints with regard to scripting languages and applets?

For example: with java 1.6 javascript is now official. Does that mean I can write applets using javascript just like I can with jython? What other JVM scripting languages can I use for creating applets?

Now what about creating an applet that has a command prompt so the user can type in javascript code and have the applet execute it dynamically. Is that allowed? What other scripting language interpreter/compilers can be called from an applet?

Ananth Chellathurai
Ranch Hand

Joined: Nov 21, 2007
Posts: 349


with java 1.6 javascript is now official.
Can I get some URL stating this.

Ananth Chellathurai

Ananth Chellathurai [Walk on software]
Siegfried Heintze
Ranch Hand

Joined: Aug 11, 2000
Posts: 397

"Java SE 6 includes the javax.script API (JSR 223) and a Rhino (Rhino) based JavaScript engine reference implementation."

So what does this mean in terms of applets?
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
It means that Java can now execute JavaScript code, and that it's possible to pass data back and forth between Java and JavaScript. So, yes, entering JavaScript expressions and having them evaluated would be a possibility.

But that's been possible using the native Rhino API for years, and the Apache BSF library has put a universal API on top of quite a few scripting languages for almost that long. So I don't see much new stuff happening that wasn't possible before.
Matthew Taylor

Joined: Jun 13, 2004
Posts: 110
Originally posted by Siegfried Heintze:
I know groovy is incompatible with applets ...

Maybe, maybe not.

Andres Almiray has done a lot of work with Groovy and applets. You might want to check out his posts on the topic.

Grails Consultant
I agree. Here's the link:
subject: Applets and scripting constraints?
It's not a secret anymore!