n5ver
n5ver

Reputation: 5

Create jar file from batch script

I need to create .jar using .bat. When I run this command from cmd it is ok:

jar -cMf ../sp.jar META-INF/MANIFEST.MF *class

but when I run batch file (.bat) with this command inside i says:

'jar' is not recognized as an internal or external command, operable program or batch file.

What should I do? When I try in cmd run javac or jar it is ok.

Upvotes: 0

Views: 1966

Answers (1)

MWB
MWB

Reputation: 31

The command you give is a little confusing; by giving "M" as parameter you specify that you want to create a jar without a Manifest. By using "m" it means that you want to create a jar and then specify the manifest.

Please see http://www.dummies.com/programming/java/how-to-use-the-jar-command/

Also, I would use "jar cmf" instead of "jar -cMf" (whithout the "-").

In the end, try using the full path to where you have your jdk, something like: "c:\Program Files\Java\jdk1.your.version\bin"

Upvotes: 1

Related Questions