How can I create a .jar file?

前端 未结 6 1106
谎友^
谎友^ 2021-01-15 15:33

In the tutorial I found out that jar files can be created in the following way:

jar cf jar-file input-file(s)

However, it was not clear wha

6条回答
  •  清酒与你
    2021-01-15 16:26

    You can use a wild card to add the classes in the current directory into the JAR-file.

    jar cf mynewjar.jar *.class
    

    When you compile your source file into byte code, all classes inside that source will be generated as separate .class files, so unless your game.java has more than the Game class, the game class would be sufficient.

提交回复
热议问题