How to use regex in java manifest classpath?

I need to use additional banks during the execution of the program. I manually add jars to the folder. / lib, and then run the program. How to determine class path in manifest file?

+7
source share
2 answers

You cannot use regular expressions or other wildcards in the Class-Path attribute of your manifest.

In Java, only one supported template is supported and only works if it is specified on the command line when calling "manual" java (that is, -jar is not used): using directoryname/* .

+11
source

I'm not too sure what you want for sure, but you can add banks at runtime:

  • (jar) files using File.list () in a directory containing banks
  • Make regex by the names of the files you extract
  • use URLClassLoader to load jar

I do not know exactly how to register (if necessary) URLClassLoaders for the main classloader. But the way I think I would go.

+2
source

All Articles