Message6049

Author ddaniels
Recipients ddaniels
Date 2010-09-08.16:22:47
SpamBayes Score 5.7176486e-15
Marked as misclassified No
Message-id <1283962968.85.0.338177450164.issue1652@psf.upfronthosting.co.za>
In-reply-to
Content
I'm having trouble loading classes from a JAR file using the java.ext.dir or java.class.path properties passed to jython as -D arguments.

I'm using the PostgreSQL 8.4 JDBC JAR to test this, which is attached along with a test script.

When I run:
  jython -Djava.class.path=jar/postgresql-8.4-701.jdbc4.jar postgres_jar_loader.py

The postgres Driver class is not found:

Property java.ext.dirs:  [/Library/Java/Extensions:/System/Library/Java/Extensions:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/lib/ext]
Property java.class.path:  [jar/postgresql-8.4-701.jdbc4.jar]
Unable to import Driver class
Traceback (most recent call last):
  File "postgres_jar_loader.py", line 11, in <module>
    import org.postgresql.Driver
ImportError: No module named Driver

When I run:

  jython -Djava.ext.dirs=jar postgres_jar_loader.py

The same thing happens.

However, if I set the CLASSPATH env var, everything works:

export CLASSPATH="jar/postgresql-8.4-701.jdbc4.jar"
jython postgres_jar_loader.py

Property java.ext.dirs:  [/Library/Java/Extensions:/System/Library/Java/Extensions:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/lib/ext]
Property java.class.path:  [/opt/local/share/java/jython/jython.jar:jar/postgresql-8.4-701.jdbc4.jar]
Successfully imported Driver class

Is there an issue with passing these arguments to jython with the -D option?

This is on a 32-bit Mac running OS 10.6 with jython 2.5.1 installed via port.
History
Date User Action Args
2010-09-08 16:22:49ddanielssetrecipients: + ddaniels
2010-09-08 16:22:48ddanielssetmessageid: <1283962968.85.0.338177450164.issue1652@psf.upfronthosting.co.za>
2010-09-08 16:22:48ddanielslinkissue1652 messages
2010-09-08 16:22:47ddanielscreate