Path Problem when running the program in the jar package using the Java-jar command

Source: Internet
Author: User
The Java-jar command is used to run a jar package recently, but the java. Lang. noclassdeffounderror exception is always thrown, but the relevant jar package has been put in the classpath, which cannot be understood. The command format is as follows: @ Echo off

Set project_home = E:/wingfeng/website/doimf
Set java_home = D:/Java/jdk1 . 5 . 0 _ 11
@ Set weblogic_home = G:/BEA/weblogic81/Server
Set ant_home = % Project_home %/webroot/WEB-INF/lib
Set thirdpart = % Project_home %/webroot/WEB-INF/lib
Set sqlt = E:/wingfeng/project/thridpath/sqlt

Set CP = . ; % Ant_home %/ant-launcher.jar; % ant_home %/ant-1.6.5.jar; % ant_home %/xalan. jar; % ant_home %/ant-junit.jar; % java_home %/lib/tools. jar; % thirdpart %/JUnit. jar; % ant_home %/ant-nodeps.jar; % ant_home %/ant-junit.jar; % thirdpart %/sqlprofiler. jar; % thirdpart %/p6spy. jar; % thirdpart %/irontracksql. jar

Java-classpath % CP %-jar % sqlt %/irontracksql. Jar

Later, after querying the information online, the following reasons were obtained:
First, jar is divided into executable jar and non-executable jar

An executable jar must be referenced by the menifest file header. If the-jar option is used, the environment variable classpath and all the class paths specified in the command line are ignored by JVM.(Http://www-128.ibm.com/developerworks/cn/java/j-jar/index.html) So the classpath I set is invalid.

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.