Running the jar package under Linux

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.