From: Kent J. <ke...@td...> - 2006-10-19 23:33:12
|
Alec Lebedev wrote: > You are right, this is one of the approaches to solve the problem. I > could also add the jar to the JRE classpath in an IDE. > > What I would really like to do is to be able to install my Java > application in any directory and then pass the directory path to the > Jython script and have it load all the necessary JARs from that dir. I > want to minimize the amount of work that needs to be done to get my > Jython script to work. How do you launch your application? You have to get jython.jar into the classpath, can you put your jar in the same way? On windows I usually make simple .bat file launchers that set up the classpath. They can contain relative paths to jars in a lib directory. Kent > > Is there any way to add a JAR to the JRE classpath from a Jython script? You have to use Java mechanisms, there is nothing special to Jython for hacking the class path AFAIK. Kent > > Thanks. > > */Josh Juneau <j.j...@mc...>/* wrote: > > If you are using Windows environment, you should include the jar in > your CLASSPATH prior to invoking the script. > > For instance, perform a set CLASSPATH=<path to your jar>/yourjar.jar > and then invoke your script. > > That should do the trick. > > ----- Original Message ----- > *From:* Alec Lebedev <mailto:auk...@ya...> > *To:* jyt...@li... > <mailto:jyt...@li...> > *Sent:* Thursday, October 19, 2006 5:11 PM > *Subject:* [Jython-users] adding JARs to sys.path > > Hi, > > I have a jython script, which calls a Java class, which requires > a certain jar to be on the classpath. I want to add the > necessary jar to the classpath in jython before calling the java > class. I tried the following: > sys.path.append("C:/dev/lib/myjar.jar"); > > However, the java class still throws NoClassDefFoundError. I > also tried the following with no success: > import jreload > jreload.makeLoadSet( "myset", ["C:/dev/lib/myjar.jar"] ) > > How can I add a jar to java classpath before calling the java class? > > Thanks. > > Alec > ------------------------------------------------------------------------ > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, > security? > Get stuff done quickly with pre-integrated technology to make > your job easier > Download IBM WebSphere Application Server v.1.0.1 based on > Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > ------------------------------------------------------------------------ > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, > security? > Get stuff done quickly with pre-integrated technology to make your > job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642_______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users > > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > > ------------------------------------------------------------------------ > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users |