the export-to-runnable-jar option for a Java project allows you to generate an equivalent ant script, so that you can automatically export the same jar using ant.
Why there is no such an option when exporting a regular jar????
The .jardesc is useful but it requires manual steps to actually export the jar.
I would like to have an ant script also for the non-runnable jars, so that I can export everything, say, from the command line
Because I do not know ant and thus I would have preferred to have Eclipse generate the script for me.. Also because then I would be sure the script is correct, ie it includes whatever has to be included in the jar.
I asked just because the generation of the ant script is available when you export a runnable jar, but not for a plain jar, which does not make so much sense to me.
Anyway, if this feature is not available I guess I will have to develop the ant script myself
I think an executable jar is a jar that contain a class with the main() definition, and you can invoke it with java -jar <your jar>. For this reason I think the executable jar contains additional stuff, like a manifest file that specifies the class path, or amenities like that.
A jar file does not need to be executable nor need to contain a class with main. It is just a library, ie a collection of classes.
If they were the same thing, Eclipse probably would not have two different export options, right?
All jars have a manifest in them. They don't necessarily have a main class defined. Having the main class doesn't prevent you from using the jar as a "library". If you really don't want the main class or classpath entries added to the jar, edit the ant script and remove these attribute entries after you generate the script.
Well, I've come across a reason to want the "export as ant script" option for the regular jar export feature: the regular jar export has a lot more features, such as including arbitrary folders, etc. I don't know ant and would like to avoid having to learn it as much as possible (we all want to focus on what the software is actually for, of course...). The reason I want to use ant is because there are some things I want to do that the jar export won't do, such as incrementing a build number. This looks easy enough to add to an existing ant script, I just don't want to spend the time writing an ant script (almost) from scratch.
Just tossing my $0.02 in .... I agree completely with this request. Eclipse will create ant scripts for most things ... why not for creating a non-executable jar? It would really help me out.