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"
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.
Related Q&A from Austin Sincock
How to provide an SAP R/3 4.5B application server with a Web service interfacecontinue reading
A reader wants to know how to consume a Web service from an SAP 4.6c R/3 application server.continue reading
Are you a Java/J2EE developer interested in SAP? This expert tip lists the most relevant SAP modules and technologies for you.continue reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.