简体   繁体   中英

Script file can't create a java Jar file

I have the following script in a bat file.

path=C:\Program Files\Java\jdk1.8.0_181\bin

prompt $$

cls

javac GUI.java

echo Main-Class: GUI>manifest.mf

jar cmf manifest.mf GUI.jar GUI.class

java -jar GUI.jar

pause

The Java file is compiled and the manifest file is created. However, when it comes to creating the Jar file, the command prompt gets stuck (hangs). It behaves as if it were on a loop.

! [Command Prompt Output]: https://i.stack.imgur.com/uO7gc.jpg

Any help would be appreciated.

根据命令(在jar命令选项> m下),您应该切换清单和jar文件名,因此jar cmf GUI.jar manifest.mf GUI.class

The script was named 'jar' which caused problems. I renamed the file and it worked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM