Issues including jar files outside jar file containing manifest

Basically let me first explain what I intend to do. I have a dynamic ETL transformer application written in JAVA. Due to the dynamic nature of this application, I should be able to add application plugins to the application in a place inaccessible to the application jar file. Basically, I would like to have the following directory structure:

Appfolder
| - Communication | - Communication | - Hunting and fishing

If possible, I would like to be able to use wildcards in my manifest to dynamically add cans located in the plugins folder. Unfortunately, everything I've tried so far has failed. I tried to use both relative paths and absolute paths and did not work (with or without wildcards). If, however, I included the plugins folder in the main jar file of the application, it works fine, given that I do not use wildcards.

So my question is: is it really possible to have dependencies outside the banks or should they always be kept inside. Another issue is the use of wildcards. I looked over [java documentation] ( http://java.sun.com/javase/6/docs/technotes/tools/windows/classpath.html ), unfortunately not.

Some examples of what I have tried so far:

  • ../ plugins/*
  • ../ plugins/plugin.jar
  • / abolute / path / to / plugins / *
  • /abolute/path/to/plugins/plugin.jar

and unfortunately none of them did the trick, so any help would be greatly appreciated ...

+4
source share
2 answers

Yes, you may have addictions outside the bank. But wildcards are not supported for specifying dependent jars.

The boxes should be explicitly specified in your manifest, and the location should be relative to where the application starts from

Your best bet might be to use Extension Mechanism

java -Djava.ext.dirs=/abolute/path/to/plugins/ ...... 
+3
source

If you have control over the code, you can always add a JarClassLoader and dynamically load banks.
http://java.sun.com/docs/books/tutorial/deployment/jar/jarclassloader.html

0
source

Source: https://habr.com/ru/post/1311895/


All Articles