🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

changing class path at run time

#248
From: George
Date: Tue, 28 Mar 2006 14:18
15 lines
1256 bytes
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
Technical Details
Message-ID: <442953d2$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: f74b3,93e0a6dd5feccd47,start
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: changing class path  at run time
Newsgroups: borland.public.jbuilder.java.language
X-User-Info: 63.72.235.4     
NNTP-Posting-Host: 207.105.83.66
Message-ID: <442953d2$1@newsgroups.borland.com>
Date: 28 Mar 2006 07:18:42 -0700
X-Trace: newsgroups.borland.com 1143559122 207.105.83.66 (28 Mar 2006 07:18:42 -0700)
Lines: 17
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail