maven - Java - Load a class outside of classpath. What are the options -
i got java product used many clients. product gets added jar client's (say illustration xyz company wants utilize product needs) code base of operations , works independently. stand lone product , client projects depends (maven dependency) on 1 product (which 1 time again couple of java projects bundled jar rolled out license)
now in situation create engine utilize class outside of it's class path. it's client class , don't want move class products code base of operations , maintain outside still want utilize it.
just confirm tested , saying class not found expected. 1 alternative can think of jar specific classes , add together product's classpath
is other improve ideas?
i think have 3 options (edit -- more details):
load class file on filesystem, using urlclassloader:
see answer;
create class using reflection:
you still need class in classpath, or need load through filesystem (option 1), see this.
middle way solution: can add together interface standalone product, , create implementing class reflection; never did in production, tested code , works: see question
java maven dependencies classpath classloader
No comments:
Post a Comment