Q

JCo/JAR compilation issues

When 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 not produce the jar file.

I have a problem with JCo and JAR:
When 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

Dig deeper on SAP Java and J2EE

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchManufacturingERP

SearchOracle

SearchDataManagement

SearchAWS

SearchBusinessAnalytics

SearchCRM

SearchContentManagement

SearchFinancialApplications

Close