0

I have a .bat file, which contains the following contents

... jar cfm myjar.jar manifest.txt *.class ...

Which executes well under windows command prompt, but when executed under cygwin, I get the following C:\cygwin\home\user\path\to\folder>jar cfm myjar.jar manifest.txt *.class Access is denied.

I tried starting cygwin as administrator, but it does not help

Would appreciate any suggestions

Thanks

2 Answers2

1

ok, do a ls -la on the dir youre trying to write the jar into, as well as the class files and manifest. see what cygwin thinks the premissions are for everything in question.

you may have to open up the perms from the windows side to 'Everybody' using cacls.

also make sure that cygwins path to jar is the same as windows.

Dr. McKay
  • 46
  • 1
  • thanks for suggestions, but I've tried all that, and also changing ownership of all the class files and jar destination directory, but nothing seems to work –  Nov 07 '10 at 22:52
  • If you run the jar command from a bash script instead of the bat file does it work? Is there some envvar that's cygwin is missing? – Dr. McKay Nov 07 '10 at 23:50
  • yes, if i run the command from a bash it does work; it only fails when it's run within a bat file –  Nov 08 '10 at 08:45
  • Is it possible that the CLASSPATH or some other environment variable is not being set when starting the bat file from bash? I assume when you do that bash launches cmd which launches bat which launches jar? – Dr. McKay Nov 10 '10 at 18:26
-3

I had the same problem. It worked when I wrote "bash" "filename".bat. You also have to write bash inside a .bat script if it calls for other .bat files.

Diego
  • 1