From: <da...@cr...> - 2001-11-23 11:42:24
|
Hi Terry, I used to do vanilla java applets, haven't realy tried much with the python variety, but here's a quick explanation of applet loading in general. Anyone who _does_ use jython for applets please correct anything I've inferred wrongly! Compiled java class files are situated on the web server under a specific URL directory (often the same as the one serving the HTML, sometimes different). The location of the top-level java code directory is given in HTML as an attribute to the applet tag e.g. <applet codebase="http://mysite/codebase">. The web client will pass this info to it's java VM, which then invokes the VM classloader to pull the classes down over the network. Java package names are used to define an absolute path, so if the applet class is dave.funky.Animator then I put it on the web server to be accessed as http://mysite/codebase/dave/funky/Animator.class Any classes used by the client that won't be on the client's own classpath (typically anything outside of the java.something packages) has to be downloaded in this way, so if I'm using jython classes, I need to put the jython classes at http://mysite/codebase/org/python/ and so on for various packages in the jython set. (Some browser clients will allow jar files to be spec'd in the codebase too, this varies fromimplementation to implementation: some allow zip files, cab files, etc.. It's one part of browser compatibility hell, I'm afraid - no easy answers here.) As I see it, you could introduce jython via two routes: 1] precompile the jython applets with jythonc and place them on server as above - making suire all jython classes are available too. 2] Write an applet (in java or jython) that embeds a PythonInterpreter which can pull python code down off the network and execute it on the fly. How you deploy the python code is then up to you! From a quick look at the demos on the site, it looks like this is what the JythonLoader applet does. HTH Dave >Hi, > >I'm fairly experienced with Python (the C variety :)), >but Java is completely new territory, and -- all >technical merits aside -- I don't really want to learn >Java right now (at least not more than I have to). > >What interests me about Jython is the prospect of >developing client-side browser applets in Python. It >appears this does require a little Java knowledge, >so I'm wondering if anyone can tell me what the >"minimum-Java" path to that goal might be. > >I don't quite follow how the Jython example applets >at www.jython.org are loaded, for example. It says >it's loading the Jython library, but looking at the >"JythonLoader.java" source, I don't really see how/ >where it does this. I guess I'm looking for some >kind of blow-by-blow explanation for what happens >when a (Jython) applet is loaded, and the role of >the various files that have to be on the server for >it to work. > >I tried to find a simple explanation of this, but >most of the docs I found online seemed to assume >knowledge of Java applets. I realize that Java >enthusiasts might argue that I should just learn >Java, but then if I knew Java well, I'd probably be >less interested in Jython, right? > >Anyway, I'm hoping this exists somewhere and I just >haven't found it. Otherwise, you could explain it >to me and *I'll* write it up. :) Any help much >appreciated. > >Thanks! > >-- >------------------------------------------------------ >Terry Hancock >ha...@an... |