🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #250

Re: changing class path at run time

#250
From: Paul Furbacher [TeamB]
Date: Tue, 28 Mar 2006 16:23
42 lines
2335 bytes
George wrote:
> "George" <me@here.com> wrote:
>> I want to load JDBC drivers on demand.  The user tells me the
>> driver class name and where the jar files are located and my app
>> loads the driver.  Or so I would like.  The following code does
>> not work:
>> 
>> try { System.setProperty("java.class.path", path + ";"    +
>> "C:\\MyDrivers\\ojdbc14.jar" ); 
>> Class.forName("oracle.jdbc.OracleDriver"); } catch (Exception ex)
>> { ex.printStackTrace(); }
>> 
>> 
>> The code works if I include the jar file on the java command line
>> invocation.  What am I doing wrong?
>> 
>> TIA George
>> 
>> Never mind.  I just found out about URLClassLoader.

Yes.  There are several open source projects (e.g., OR mappers)
which have tools that provide you with this capability.  One
which comes to mind is objectstyle.org's Cayenne Modeler.
You might want to study their code to see if you can enhance
what you already have accomplished.  (It's always good to see
how other folks approach a problem.)


-- 


Paul Furbacher (TeamB)

   Save time, search the archives:
        http://info.borland.com/newsgroups/ngsearch.html

   Is it in Joi Ellis's Faq-O-Matic?
        http://www.visi.com/~gyles19/fom-serve/cache/1.html

   Finally, please send responses to the newsgroup only.
   That means, do not send email directly to me.
   Thank you.
Technical Details
Message-ID: <4429630f@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <442953d2$1@newsgroups.borland.com> <44296071$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: f74b3,93e0a6dd5feccd47
X-Google-Attributes: gidf74b3,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Tue, 28 Mar 2006 11:23:40 -0500
From: "Paul Furbacher [TeamB]" <pfurbacher@mac.com>
Organization: Reverse Alchemy, Inc.
User-Agent: Thunderbird 1.5 (Macintosh/20051201)
MIME-Version: 1.0
Newsgroups: borland.public.jbuilder.java.language
Subject: Re: changing class path  at run time
References: <442953d2$1@newsgroups.borland.com> <44296071$1@newsgroups.borland.com>
In-Reply-To: <44296071$1@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 69.142.194.228
Message-ID: <4429630f@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1143563023 69.142.194.228 (28 Mar 2006 08:23:43 -0700)
Lines: 42
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail