Ant Build Jar without META-INF?

Use zip instead of jar. Why do you want to avoid a META-INF folder?

I am building a jar using method discussed in stackoverflow. Com/questions/2706222/…. I gave the ant script in my original post.It is creating to META-INF jar.

One inside Number. Jar and another inside Number. Jar/client.jar.

I think there is no need to have a META-INF folder inside client.jar. – Tapas Bose Aug 21 at 12:46 1 My point was: even if the META-INF folder is not necessary, why do you care about it? Having one won't make your application crash.

It won't make the jar twice as big. You just shouldn't care about it. – JB Nizet Aug 21 at 12:56 +1 and thank you but unfortunately I cannot accept the answer.

The answer given by @Stephen C is equally helpful. But Stackoverflow has rule to accept only one answer, (don't know why I cannot accept two or more same or different equally acceptable answer). I had a little chat with camickr in this thread and it was not so good.

I am not complaining about anything but it will be better in my opinion to change the rule of acceptance of the answers. – Tapas Bose Aug 22 at 15:47 @Tapas: The rules are not mine (and not camickr's). I'm just a simple user as yourself.

If you want to complain or ask a question abount StackOverflow, just post it in meta.stackoverflow.com. If you think Stephen's answer is the best one, then accept it. You don't have to give excuse.

We all know the rules of the game, and are here to help, more than to get points. – JB Nizet Aug 22 at 16:08 Thank you for response, I will post in meta. I am not giving any excuse but some people are here to get points more than to help.

– Tapas Bose Aug 22 at 16:28.

A Jar always contains a META-INF-folder, otherwise it is no valid jar. But as a jar is actually a ZIP-file with additional metainformations (included in the META-INF-folder) you can simply use the ZIP-task (also giving the resulting file the suffix . Jar).

Note, that only with META-INF you can have executable-jars (with a main-class) or other JAR-features like sealed packages. But you can add ZIPs to the classpath the same way as JARs.

1 A jar witout META-INF IS a valid jar file. See download.oracle. Com/javase/1.3/docs/guide/jar/jar.

Html#Intro: "A JAR file is essentially a zip file that contains an optional META-INF directory" – JB Nizet Aug 21 at 16:17.

A JAR file without a META-INF folder is really just a ZIP file, so the simple solution is to use the Ant task. If you run the jar command from the command line, it looks like you can suppress the creation of a MANIFEST. MF file and (presumably) the folder using the M command option; see the Jar command manual.

But I don't know if this actually does what I think it does, and there doesn't seem to be a way to get the Ant task to do the same thing. But like @JB Nizet ... I don't see why you would care if there is one redundant folder in your JAR file.It seems too trivial an issue to spend time on.

1 and thank you. – Tapas Bose Aug 22 at 15:48 @Tapas Bose - You are welcome. (And I'm not in the slightest bit offended that you didn't accept my answer.

What matters is that you did accept someone's answer. ) – Stephen C Aug 23 at 3:57.

But the jar file containing META-INF folder. Is there any way to exclude this folder's creation? The complete build.

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