Re: stupid question about loading driver

From: Anders Hermansen <anders(at)yoyo(dot)no>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: stupid question about loading driver
Date: 2003-01-19 17:29:13
Message-ID: 20030119172913.GA12347@online.no
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

* Richard Welty (rwelty(at)averillpark(dot)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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Richard Welty 2003-01-19 18:04:37 Re: stupid question about loading driver
Previous Message Richard Welty 2003-01-19 16:20:05 Re: stupid question about loading driver