DEV Community

Calin Baenen
Calin Baenen

Posted on

Why do I get "Invalid Switch *.class" when compiling Class to Jar files?

So I'm compiling, and I wrote compile.bat as I usually would:

@echo off
cls
cd .
javac resources/*.java
jar cmf program.jar manifest.txt resources/*.class
Enter fullscreen mode Exit fullscreen mode

but it says:

resources\*.class : no such file or directory
Invalid switch - "*.class".
Enter fullscreen mode Exit fullscreen mode

What am I doing wrong this time? I've never had this error.

Top comments (2)

Collapse
 
nagkumar profile image
Raja Nagendra Kumar

Can you check where jar.exec is located, the synatax of

jar cmf is wrong..

docs.oracle.com/en/java/javase/14/...

Collapse
 
baenencalin profile image
Calin Baenen

Thanks for the help.