Using JAR File distributions in Jython

VLP vlprasad at yahoo.com
Thu Jan 9 19:00:15 EST 2003


I have an API distributed in JAR form, that is currently being used by
some Java programs. I would like to use this API from Jython. I read
in an earlier post, that I must set CLASSPATH to include the JAR file
itself, not just the directory it is in, so I did accordingly. This
seems to have some effect, as the next time Jython started up, it
recognized the JAR file, and did some processing (notably adding it to
the cachedir package cache, and changing package.idx)

However, I still cannot "import" any classes from the JAR file. I
tried following forms:

import com.company.product.api.class
and
from com.company.product.api import class
and
from com.company.product.api import *

I get the error:  No module named company

The JAR file is called productapi.jar and was created using JDK
1.3.1_06. I am using the same version of JDK to run Jython. I am using
Jython 2.1

Can someone point out what I am doing wrong here, and how I can get
this to work? This is extremely important, as without this, I will be
unable to replace Java with Jython in this project...which is a
tragedy, because Java is so much more painful to work with!

Thanks,
VLP




More information about the Python-list mailing list