CLASSPATH problems...

B

balgach

Hello all, i am trying to compile a java application that uses a
specific jdbc driver (postgresql) however im running into a weird
problem im not sure how to fix. When i log into the system, i have my
..profile defining my CLASSPATH, and here is what it says:

[asb7@grid00 asb7]$ echo $CLASSPATH
/opt/j2sdk1.4.2_06/lib/pg73jdbc.jar:.

[asb7@grid00 asb7]$ javac testSQL.java
[asb7@grid00 asb7]$ java testSQL
***Exception:
java.lang.ClassNotFoundException: org.postgresql.Driver
java.lang.ClassNotFoundException: org.postgresql.Driver
at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at testSQL.<init>(testSQL.java:13)
at testSQL.main(testSQL.java:41)


but if i manually reexport the CLASSPATH it works fine:

[asb7@grid00 asb7]$ CLASSPATH=/opt/j2sdk1.4.2_06/lib/pg73jdbc3.jar:.
[asb7@grid00 asb7]$ export CLASSPATH
[asb7@grid00 asb7]$ javac testSQL.java
[asb7@grid00 asb7]$ java testSQL
Connection to PostgreSQL 7.3.7 successful.

Executing this command: select * from test_relation;

test____

Test Successful!
[asb7@grid00 asb7]$




anyone know why i have to manually reexport my classpath each time to
make it work? it seems to be set up the exact same as in my
..profile...???

Thanks,
Adam.
 
P

Peter MacMillan

Hello all, i am trying to compile a java application that uses a
specific jdbc driver (postgresql) however im running into a weird
problem im not sure how to fix. When i log into the system, i have my
.profile defining my CLASSPATH, and here is what it says:


anyone know why i have to manually reexport my classpath each time to
make it work? it seems to be set up the exact same as in my
.profile...???

look closer at your own data:

1. /opt/j2sdk1.4.2_06/lib/pg73jdbc.jar
2. /opt/j2sdk1.4.2_06/lib/pg73jdbc3.jar

notice that the 1., which is the original classpath, is missing the "3".
The second one is the one you've manually exported.
Thanks,
Adam.

:)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,740
Latest member
AdolphBig6

Latest Threads

Top