• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Loading/Unloading Libraries at Runtime

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a question about loading different versions of a library dynamically at runtime.

I have two version of an external C library:

/programs/app_v1
/programs/app_v2

Currently, in my java app startup script I either:

export LD_LIBRARY_PATH=/programs/app_v1
or
export LD_LIBRARY_PATH=/programs/app_v2

depending on what version of the library I wish to load.

My question is: can I dynamically load app_v1 or app_v2 at runtime based on a user's request?
Essentially I would like to be able to switch versions without having to restart my java application.

Any help would be appreciated.

Thanks
 
Ranch Hand
Posts: 1970
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you use the java.library.path System property, rather than LD_LIBARARY_PATH, to tell the JVM where your native libraries are? If so, does changing its value during the program's execution change where it looks for native libraries?

(I don't know and checking would take longer than I have available. I am just guessing, in case it helps you.)
 
Peter Chase
Ranch Hand
Posts: 1970
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh, and I don't think there's any way to unload a native library explicitly, once loaded. Not from Java anyway.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic