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.
you can use environmental variable to load the class or jar.