Thứ Năm, 15 tháng 10, 2015

How to run a jar file in command line?

Some ways to run a Jar file:
 
If you build a jar file as runnable, then the manifest will be created automatically. Otherwise you need to add manifest into  META-INF/MANIFEST.MF:
Main-Class: com.mypackage.MyClass (with a new line)
  
Now run a jar file:
1. java -cp path/to/file.jar my.classpath.ClassContainsMainMethod
2. java -jar <jar-file-name>.jar (with a runnable jar)
 
 

Không có nhận xét nào:

Đăng nhận xét