How can I specify dependencies in the manifest file and then to include it into my .jar file?

后端 未结 2 709
深忆病人
深忆病人 2021-01-14 07:45

I generated .class files by the following command:

javac -cp \\directoryName\\external.jar myPackageDirectory\\First.java myPackageDirectory\\Second.java
         


        
2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-14 08:24

    First of all: you don't seem to compile a class called MainClass and all your .java files seem to be in a package, so I assume that MainClass is just a placeholder and you actually use the correct class name here.

    You need to specify a Class-Path header that mentions your external .jar to your manifest.txt and deliver the .jar file together with your jar. You need to do this in addition to specifying the -cp at compile time.

提交回复
热议问题