Results 1 to 2 of 2
  1. #1
    johann_p is offline Member
    Join Date
    Jun 2007
    Posts
    19
    Rep Power
    0

    Question Adding JARs to the classpath at runtime?

    I have an JAVA application with a plugin-architecture. Each plugin is described in a config file that tells the application in which JAR the plugin is found etc.

    My problem is this: some plugins need additional JARs on the classpath. E.g. the plugin might need the mysql jdbc JAR on the classpath.

    What do I have to do to dynamically add a couple of JAR URLs to the classpath so that the system class loader can automatically load from these additional JARs?

    I experimented with using my own URL classloader, but the problem I face is this: I add a JAR with addURL and later want to e.g. use the JDBC jar or the javax.script.* libraries to do stuff. Internally, the objects from these libraries want to load classes from the CLASSPATH, but it seems my previous addURL call did not accomplish this.

    Either I am still missing some important points here or this has to be done differently.

    :confused:

  2. #2
    JavaBean's Avatar
    JavaBean is offline Moderator
    Join Date
    May 2007
    Posts
    1,270
    Rep Power
    10

Similar Threads

  1. Set classPath?
    By rgbosque in forum New To Java
    Replies: 3
    Last Post: 02-07-2008, 02:14 PM
  2. Manifest file in executable jars
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-15-2007, 08:16 PM
  3. GNU Classpath 0.96.1
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 11-01-2007, 04:14 PM
  4. GNU Classpath 0.96
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 10-16-2007, 06:35 PM
  5. how to find unused jars??
    By orchid in forum Eclipse
    Replies: 4
    Last Post: 06-08-2007, 10:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •