[英]How to use regular expression in java manifest classpath?
I need to make use of additional jars during the execution of the program.我需要在程序执行期间使用额外的 jars。 I manually add the jars to the relative ./lib folder and then execute the program.我手动将 jars 添加到相对的 ./lib 文件夹,然后执行程序。 How should I define the classpath in the manifest file?我应该如何在清单文件中定义类路径?
You can't use regular expressions or other wildcards in the Class-Path
attribute of your manifest.您不能在清单的Class-Path
属性中使用正则表达式或其他通配符。
There is only one supported wildcard in Java, and that only works on if specified on the commandline on a "manual" java
invocation (ie not using -jar
): using directoryname/*
. Java 中只有一个受支持的通配符,并且只有在“手动” java
调用(即不使用-jar
)的命令行上指定时才有效: using directoryname/*
。
I'm not all too sure about what you want exactly, but you can add jars during runtime:我不太确定你到底想要什么,但你可以在运行时添加 jars:
I don't know exactly how to register (if necessary) the URLClassLoaders to the main classloader.我不知道如何将 URLClassLoaders 注册(如果需要)到主类加载器。 But that's the way I think I would go.但这就是我想我会去的方式。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.