1

I have a lib folder at installer location that i want to load at class path or refrenced at runtime for my java project, programmaticaly.

I have tried to set classpath by -cp and used ClassLoader, URLClassLoader but it did't work. found ClassNotFoundException. I also tried static block to load my jar.

How to resolve it, how can we referenced external jar folder dynamically or can load it at class path.

I am using Eclipse IDE which have option in build path to load external folder but i am not sure it will work when i export the project as it is building path for my current workspace only so it would't work when installer go in others machine. So i required to load that folder programatically.

RTA
  • 1,251
  • 2
  • 14
  • 33

2 Answers2

0

you can use environmental variable to load the class or jar.

XXX
  • 181
  • 7
0

Please have a look at these questions in stackoverflow it self. they may help you. I personally haven't tried and never came across this kind of requirement.

How should I load Jars dynamically at runtime?

Loading jars at runtime

Hope above links help you to solve your problem.

Community
  • 1
  • 1
Srikanth Ganji
  • 1,127
  • 1
  • 13
  • 29
  • not working, first i need to resolve compile time error that i resolved by build path->add external folder. Now i used classLoader and and reflection to load at runtime while application invokes. I have doubt both are creating conflict and the jar resolved at compile time certain to do some thing when loading by class loader at runtime. – RTA Jan 15 '14 at 08:23