In Windows, how does one run the jar package with a Java command?

Source: Internet
Author: User

Step 1: Use eclipse to export the jar package (or use the jar command) and specify main-class, such as main-class: COM. skymobi. CSJ. csjmain

Step 2: Write bat

Step2.1: Add classpath. To add all dependent jar and properties to the absolute path, note that the absolute path must be added, and then add the jar package you want to run.

Set classpath = % classpath %; C: \ test \ skyopi. properties; C: \ test \ skyopi-1.0.6.jar; C: \ test \ slf4j-api-1.5.3.jar; C: \ test \ slf4j-log4j12-1.5.3.jar; C: \ test \ commons-logging-1.1.1.jar;

C: \ test \ log4j-1.2.15.jar; C: \ test \ commons-httpclient-3.1.jar; C: \ test \ module-framwork-1.5.jar; C: \ test \ mina-core-2.0.0-RC1.jar; C: \ test \ log4j. properties; C: \ test \ csj_skyserver.jar

Step 2.2: add an execution script

Java com. skymobi. CSJ. csjmain moduleid = 0xa000 moduleinstid = 0xa001

Step 3: Put the prepared steps and all the dependent jar and configurations under C:/test (if this address is changed, change the classpath above)

Step 4: Double-click bat, Hava fun ^-^ With your mouse

Note: Java-classpath .... -Jar csj_skyserver.jar arg0 proves that other dependent packages cannot be called.

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.