From: Jason F. <jaf...@en...> - 2001-05-12 01:14:41
|
Hello, I'm currently trying to graft Jython into the Cocoon2 web publishing framework using IBM's Bean Scripting Framework. So far it has been a straightforward process, so kudos to the Jython team. If you're interested, check out xml.apache.org/cocoon and take a look at ScriptGenerator. Everything works great so long as all of the python code is within a single script. As previous posts have mentioned, as soon as I try to import from another file jython complains about not being able to find the resource in question. The solution presented earlier (in the context of the JythonServlet?), namely to use sys.add_package(), sounds like a good solution if you have control of the servlet. Unfortunately given the number of toolkits and classloaders I'm working with I don't have this option. I was wondering whether or not it would be possible to do something similar to sys.add_package() from within a python script? I tried this (naively) and was told that "sys" wasn't a known name. My idea is that I know, as developer, that a class with a certain name is available somehow. I'm not sure that this solution would work, given that Tomcat and Cocoon2 for sure have their own classloaders and the BSF might as well, but it's the only one I can think of. I *really* don't want to add things to my system classpath if I don't have to. As an aside, since I've been out of Java programming for so long, can I set that various jython parameters programmatically as opposed to having to use "-D" on the command line? Thanks for any help! Jason Foster |