From: Marty S. <ms...@qu...> - 2002-04-02 18:13:29
|
I embed the jython engine within a servlet application. Within the jython distribution tree, I found a subdirectory by the name of "Lib", which is full of .py files representing the standard library. I arrange for this tree to be installed within "/foo/jythonLib", and then use code like this to init the jython engine: Properties p = new Properties(); p.setProperty("python.path", "/foo/jythonLib"); PythonInterpreter.initialize(System.getProperties(), p, null); So, the files I ship with my application are the jython.jar file, plus that tree. As far as making this tree of files available to an applet, sorry, I haven't been there. I know that when this tree of files has been installed, and I start executing jython script against the engine, for each .py file that is referenced, an associated .class file is generated. Therefore, I think you'd have to use the applet trick of causing a .jar file's contents to be expanded into a local spot on the user's hard drive. This, I believe, requires a digitally signed .jar file. On Tue, 2 Apr 2002, Mark Elston wrote: > I sent this message last week but got no responses so I am > trying it again. > > We are in the process of writing a Java application to control a > piece of test equipment. Our architecture allows us to extend > this application via a scripting language. Jython seems the > perfect choice for this. > > However, we will not be able to require all our customers to > install Jython on their systems. We were planning to distribute > the jython.jar file (plus any other jar files necessary). > > This has apparently caused a problem. > > When testing on a platform without installing Jython or CPython > if we have a script that imports string, re or most any other > module, we get an import error. This does not happen on my > machine (which has both ActivePython and Jython installed). > > I tried to fix this by running jythonc on all the standard lib > files in the jython\lib directory and creating a jar file out > of the resulting class files and putting this jar file in the > classpath of the command running our app. We still get import > errors in importing these modules. > > So, how do we provide the standard library modules to an embedded > interpreter running on a machine where Jython has not been installed? > > A similar question would be how do we provide these modules to an > applet running remotely on a web browser? > > Mark > > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users > -- Martin Stitt 230-7215 QUIQ, Inc Powering The Customer-To-Customer Service Revolution |