Results 1 to 7 of 7
  1. #1
    nenadm is offline Member
    Join Date
    Nov 2008
    Posts
    19
    Rep Power
    0

    Default Dynamically_load_library

    Hello,

    I am interested is it possible to replace library jar dynamically in java application.

    I have following situation, i use old lucene jar (version lucene-2-2-0) and now i want to replace it with newer library (lucene-2-2-9), but i need to replace it and use new library dynamically so users can use new lucene API immediatelly (without need to restart application).

    Best regards.

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Not unless you manually create a ClassLoader to read the jar, in which case you can ditch that ClassLoader and recreate to read the new jar. But, if it is included in the app simply by the fact that it is contained on the classpath, then it is loaded by the application classloader and you can't simply "restart" that classloader.

  3. #3
    nenadm is offline Member
    Join Date
    Nov 2008
    Posts
    19
    Rep Power
    0

    Default Dynamically load library

    Thank you Masijade,

    Could you refer me how to create such ClassLoader manually.
    Every suggestion is welcome, or if you have some example (i quess somebody other already have this problem).

    Best regards.

  4. #4
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Google for ClassLoader tutorials. They do exist. At this point, however, it is probably something that follows the rule "If you have to ask, then you shouldn't be attempting it."

  5. #5
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,524
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by masijade View Post
    Google for ClassLoader tutorials. They do exist. At this point, however, it is probably something that follows the rule "If you have to ask, then you shouldn't be attempting it."
    The OP wrote 'dynamically' in his post; three times.

    kind regards,

    Jos ;-)

  6. #6
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Quote Originally Posted by JosAH View Post
    The OP wrote 'dynamically' in his post; three times.

    kind regards,

    Jos ;-)
    And I still hate that word! ;-)

  7. #7
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,524
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by masijade View Post
    And I still hate that word! ;-)
    Nowadays 'dynamically' means: 'I know zilch about the subject but I want it nevertheless' ;-)

    kind regards,

    Jos

Posting Permissions

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