From: <bc...@wo...> - 2001-07-19 19:48:48
|
[Russo, Tom] >I'm having some trouble using jython from within a jsp page. >... Take a look at how PyServlet.java attempts so solve the problem > http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jython/jython/org/python/util/PyServlet.java?rev=1.11&content-type=text/vnd.viewcvs-markup The lines of special interest is: sys.add_classdir(rootPath + "WEB-INF" + File.separator + "classes"); sys.add_extdir(rootPath + "WEB-INF" + File.separator + "lib"); It allows *package* import from the WEB-INF/lib and WEB-INF/classes directories. Note that the problem you are seeing have nothing to do with class loading. The problem occurs because jython needs to know if the package "org.python" is (part of) a valid java package. >I'm running >Tomcat 3.2.2, jython 2.0, ... Unfortunately the add_classdir and add_extdir was added in jython-2.1a1. >I guess the ultimate question is: is it possible to use jython.jar when it's >not on the classpath? You can always tell jython about the java packages that is available manually: sys.add_package("org.python.core") sys.add_package("java.lang") sys.add_package("java.io") ... regards, finn |