Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Defining a classpath for a Jython virtual environment

I have installed Jython, a virtualenv named "jython-env" and have installed "bottle" for doing some web application development. I have to use some JAR files in this application for consumption by some Python code. I know I have to set the classpath which should include these JAR files. I tried setting the classpath using

export classpath=/home/myname/jclasses/foo.jar

but when I try to import the class, it says module not found. I am very new at Java and am doing this for the first time.

Can't the configuration be done such that I can just put the JAR files in the sitepackages directory of my virtualenv and use it from there?

like image 719
rubicondude Avatar asked Feb 24 '23 09:02

rubicondude


1 Answers

jython -Dpython.path=/path/to/myjar.jar

Here's another idea: you could use a .pth file.

Create a file - /path/to/jythonenv/Lib/site-packages/myjars.pth:

path/to/jar1.jar
path/to/jar2.jar

Would also do the trick.

like image 52
jsw Avatar answered Mar 08 '23 06:03

jsw