Article View: borland.public.jbuilder.java.language
Article #249Re: changing class path at run time
From: George
Date: Tue, 28 Mar 2006 15:12
Date: Tue, 28 Mar 2006 15:12
19 lines
1383 bytes
1383 bytes
"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.
Technical Details
Message-ID:
<44296071$1@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-mailReferences:
<442953d2$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 From: "George" <me@here.com> Sender: "George" <me@here.com> Reply-To: "George" <me@here.com> Subject: Re: changing class path at run time Newsgroups: borland.public.jbuilder.java.language X-User-Info: 63.72.235.4 References: <442953d2$1@newsgroups.borland.com> NNTP-Posting-Host: 207.105.83.66 Message-ID: <44296071$1@newsgroups.borland.com> Date: 28 Mar 2006 08:12:33 -0700 X-Trace: newsgroups.borland.com 1143562353 207.105.83.66 (28 Mar 2006 08:12:33 -0700) Lines: 20 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