So, a beefy, fast VM that runs inside the browser, coupled with a nice web UI, and no manual installs for your users -- big win? Maybe! On considering this, one of my first thoughts was to put Jython into an applet and build something akin to JES -- a little Jython IDE in the browser! The kids would love it! So I set out to make this happen, or at least build a proof-of-concept.
I ran into a serious snag, though -- the Jython interpreter works by compiling to bytecode and bringing it up with the class loader, the latter of which applets aren't typically allowed to do. Special permission can be granted with a Java policy file, but that's a very high barrier to entry. It's certainly not the sort of thing a person might do on a public terminal. Signing the applets may also be an option -- but that's also a pain, and anecdotally, I think signed applets may not always get the same rights, cross-platform.
Once I understood the permissions issue, I did get a little Jython repl going -- it just hooks "eval" up to some javascript for output. Nothing fancy, but kind of satisfying. For now, though, it doesn't look like Jython IDEs are coming to the browser. Until we rewrite it to not use of the class loader. Or just use some more modern approach.
Some other people have had similar thoughts!
- Interactive Jython Console: this one, for the exact same reasons that mine does, requires a java policy file.
- the ruby-in-browser project. It does exactly pretty much what it sounds like it does, also by means of an applet and LiveConnect. Interestingly, JRuby doesn't seem to use the class loader, it just works! Check out the demo! [thanks for the heads-up, Lindsey Kuper!]
2 comments:
In Jython 2.1 and 2.2 you can use jythonc to create applets, though the current implementation of jythonc is deprecated (it can't handle generators and some other "new" Python features). We will be coming up with a replacement of jythonc for the next version of Jython (which will target Python 2.5 compatibility). The new jythonc should be able to deal with generators,etc -- and will be able to run unsigned applets. I can't give an exact timeframe for this unfortunately -- but I hope to have something going by the end of this summer.
I am trying to convert a python module (that contains the use of NLTK.Corpus) by jythonc. It is not able to include nltk dependencies within the java class it creates. So when i use this class in java, it fails to recognize nltk. Can anyone please let me know how should i use nltk in python/jython modules so i can use in Java.
Post a Comment