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

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.

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.

Right, I do not compile MainClass (it is just a place holder, I modified that in my post). About the second part, how do I include my manifest file into my . Jar file?

– Roman Apr 7 '10 at 12:01 You already include a manifest file (your input is called manifest. Txt). You just need to modify its input.

The rest should be explained in the tutorial I link to. – Joachim Sauer Apr 7 '10 at 12:03 I mean, the way I did it automatically include my manifest file into my jar, right? – Roman Apr 7 '10 at 12:03 Yes, the m argument together with manifest.

Txt tells jar to use the content of manifest. Txt an write it to the new . Jar files META-INF/MANIFEST.MF.

– Joachim Sauer Apr 7 '10 at 12:11.

Further to what Joachim Sauer (very correctly) says, there is a way to pack your dependency jars into the same jar as your own code. The programs that accomplish this create a super-main class and manipulate the classpath to find the dependent jars in your resulting jar. Several programs can do this; one of them is called OneJar.

I needed to use -cp during compilation and name of . Jar file of an "external" library (external. Jar) to be able to use this library from my code.

Class files I have generated my . My problem is that I am not sure that I will be able to run my . Jar file on other computers.

I think so because during the compilation I specified the location of the . Jar file of the external library. Class files (included into the .

Jar file will try to find the . Jar file of the external library in a specific directory and there is no guaranty that that the . Jar file of the external library will be in the same directory as on the my computer.

But I do not understand how it works. I do need to specify location of the "external. Jar" at the compilation stage (otherwise the compiler complains).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions