A number of friends on the Internet often asked how Java files makes it as an EXE file. It is very convenient to make the exe file because the exe file is double-click. But this will destroy Java's cross-platform, not recommended. In addition, there are some ways to make a double click, such as writing a .bat (windows) or .sh (under Linux) file, you can double click this file. Now I will introduce the production method of the JAR file. So much nonsense, start now.
1. Make a manifest file, the suffix of the file is .mf, file content is: main-class: YourMainClass. Put this file with your class file below the same directory below YourMainClass is your primary Class file, be careful not to add .class suffix; ":" and your main Class name at least one space, behind at least one wrap. Assume that the Manifest file is now: manifest.mf, the content is: main-class: yourmainclass
2, run JAR CVFM Yourjar.jar Manifest.mf YourClassList under the console to build your .jar file. Description: Yourjar.jar's name can be arbitrary, manifest.mf is the Manifest file you have just created, YourClasslist is the .class file list for YourMainClass.class, such as two files: YourMainClass.class and Other.class You want to save as your Yourjar.jar command as follows: JAR CVFM Yourjar.jar Manifest.mf YourMainClass.class Other.class. Where CVFM's FM location can be interchangeable, but to note that f, m's order and Yourjar.jar The order of manifest.mf corresponds.
3, if you have a package, turn the manifest file: main-class: Yourpackage.YourmainClass, YourPackage is your package, then run Jar CVFM yourpar.jar manifest.mf YourPackage outside, where youPackage is for you. Package package name.
If you do according to the above steps, you must get a Double-click Java program, good luck !!