简体   繁体   English

如何在不使用第三方工具的情况下在应用程序jar中引用jar?

[英]How to refer jar inside my application jar without using third party tools?

I have a JavaFX application which is referring to few jars. 我有一个JavaFX应用程序,它引用了几个jar。 I need to create a runnable jar of the application. 我需要创建该应用程序的可运行jar。 However, MANIFEST file is referring to classpath lib/*.jar. 但是,MANIFEST文件引用的是类路径lib / *。jar。 So the runnable jar is expecting the *.jar to be present under /lib folder. 因此,可运行的jar期望* .jar位于/ lib文件夹下。 If the jar is moved elsewhere, it doesn't work. 如果罐子移到其他地方,它将无法工作。 I'm copying these *.jar inside my runnable jar. 我正在将这些* .jar复制到我的可运行jar中。 Still it is not referring to them. 仍然不是指他们。 Please help me to refer to the jars present inside the jar. 请帮我参考一下罐子里的罐子。

Actually in eclipse it will create a runnable jar where it will extract the classpath classes to its own jar file. 实际上,在eclipse中,它将创建一个可运行的jar,它将类路径类提取到其自己的jar文件中。 If you want to combine your application jar and reference jars together you can do the same. 如果要将应用程序jar和参考jar组合在一起,则可以执行相同操作。

If runnable jar's MANIFEST refers lib/*.jar means your application structure should be 如果可运行jar的清单引用lib / *。jar,则意味着您的应用程序结构应为

Main Directory
  runnable.jar
  lib
    a.jar
    b.jar

I don't know how it works, by copying reference jars inside runnable jar. 我不知道它是如何工作的,方法是在可运行的jar中复制参考jar。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM