Re: stupid question about loading driver - Mailing list pgsql-jdbc

From Anders Hermansen
Subject Re: stupid question about loading driver
Date
Msg-id 20030119172913.GA12347@online.no
Whole thread Raw
In response to stupid question about loading driver  (Richard Welty <rwelty@averillpark.net>)
Responses Re: stupid question about loading driver
List pgsql-jdbc
* Richard Welty (rwelty@averillpark.net) wrote:
> $ /usr/java/j2sdk1.4.1_01/jre/bin/java -jar mosa.jar com.example.foo.ExampleFooApp
> Using config file path: /home/rwelty/foo.cfg
> ClassNotFoundException: org.postgresql.Driver
> DBInstance: connecting to jdbc:postgresql://localhost:5432/foo-db
> SQLException: No suitable driver
> Exception in thread "main" java.lang.NullPointerException
>         at com.example.foo.InstanceInfo.LoadSiteInfo(InstanceInfo.java:126)
>         at com.example.foo.ExampleFooApp.main(MOSAScaleApp.java:8673)
> $
>
> the classpath looks fine to me, it includes the location of the correct
> driver (the one that was working inside the IDE):
>
> $ echo $CLASSPATH
> /usr/java/j2sdk1.4.1_01/jre/lib/rt.jar:/usr/local/java/lib/pgjdbc2.jar
> $
>
> so what am i missing here?

When using the -jar command to start an application the CLASSPATH is
ignored.

I bet this will work:
/usr/java/j2sdk1.4.1_01/jre/bin/java -cp $CLASSPATH:mosa.jar com.example.foo.ExampleFooApp


Hope this helps,
Anders

--
Anders Hermansen
YoYo Mobile as

pgsql-jdbc by date:

Previous
From: Richard Welty
Date:
Subject: Re: stupid question about loading driver
Next
From: Richard Welty
Date:
Subject: Re: stupid question about loading driver