First, the class files that will be required to compile the compiled file into a jar package, you can use the export function of eclipse. Example: Loginadd.jar
Second, executable jar package MANIFEST.MF. The file format must be as follows: manifest-version:1.0 Created-by:1.6.0_10-beta (Sun Microsystems Inc.) Main-class:com.zuzhili.bussness.utils.parseurl Class-path:lib/commons-lang-2.5.jar Lib/filterbuilder.jar lib/ Htmllexer.jar Lib/htmlparser.jar Lib/mysql-connector-java-5.1.7-bin.jar Lib/poi-3.9-20121203.jar lib/sitecapturer. Jar Lib/thumbelina.jar Note: 1, if it is necessary to execute the main method, we need to main-class, that is,The class that contains the main method. Format:Package name + class Name 2, Class-path is a dependent jar package. 3, above three items begin with a colon, and a space after the colon. 4, Class-path If there are many items, write a line to pack the time will be error line too long, then need to class-path divided into more lines. Note: Starting on the second line, you must
Two spacesThe first three, the need to organize the jar package into the folder Lib four: The three MANIFEST.MF files are organized and moved into the Loginadd.jar inside. Five, now there are only two valid documents: Loginadd.jar Lib These two files must be stored on a lateral. is related to the path in Class-path. Six: Put the above two files on a Linux server, execute. Java-jar Loginadd.jar >>loginadd & nohup java-jar loginadd.jar >>loginadd & Note: 1, in the application of unix/linux, we generally want to let a program run in the background, so we will often use & at the end of the program to let the program run automatically. If it is not added to the console, the close window or CTRL + C will stop executing. 2, Nohup: The standard output of the program is automatically redirected to the current directory under the Loginadd file, played the role of log. Some common programs, commands & endings, terminal shutdown, then the program is also closed, using nohup, even if the terminal exits, the program will not shut down.
Running the jar package under Linux