JCo/JAR compilation issues
I have a problem with JCo and JAR:
When

    Requires Free Membership to View

    When you register, you will start receiving targeted emails from my award-winning team of editorial writers. Our goal is to keep you informed on the hottest topics and biggest challenges faced by SAP professionals today.

    Hannah Smalltree, Editorial Director

    By submitting your registration information to SearchSAP.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchSAP.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

I compile my code and execute the main batchscan.class by typing "java batchscan" the program works perfectly.

But when I try to create a sap.jar file, by including my manifest file, all class files and my sapjco.jar file, it does produce the jar file. However, I cannot execute the jar file. It executes the program up to a point and then I get the run-time error: "Exception in thread "main"
java.lang.NoClassDefFoundError: com/sap/mw/jco/JCO
at batchscan.<init>(batchscan.java:38)
at batchscan.main(batchscan.java:362)"

My classpath is already set corrcetly.
Depending on the type of Java archive you are creating, you will need to organize the directory structure in a specific manner. One of the most common Java archive type is the WAR file, or Web Application Archive. The WAR file contains a specific directory structure that allows you to easily access other stored archives (i.e. sapjco.jar). In order to access any Java jar, the WAR structure must have this path: /WEB-INF/lib with the lib directory containing sapjco.jar. Any jar files in this directory can be automatically used by another class in the Web application without having to worry about the CLASSPATH setting.

This was first published in November 2003