java manifest internal jar link

别来无恙 提交于 2019-12-25 00:34:48

问题


I'm trying to package some external libraries into my java project, but failing miserably. I've got a .jar-file, with external libraries packaged into ./lib/jars. If I have the manifest pointing the Class-Path: at lib/jars/theJar.jar, I get a NoClassDefFoundError. If I have the Class-Path pointing at C:\Users\Owner\workspace\theProject\lib\jars\theJar.jar, the jar file is found - but I suppose that will only work on my computer.

How do I make the program go looking for the jars inside of the jar?


回答1:


You don't, unless you use a custom classloader like JarClassLoader.

Alternatives include things like jarjar and One-JAR.

Edit It appears I misunderstood your problem, based on your question title--they're not really "internal", they're external, as your question correctly states. The last sentence is again misleading: are you trying to reference external jars, or jars inside of the jar?



来源:https://stackoverflow.com/questions/9573868/java-manifest-internal-jar-link

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!