Q

How to call a JCo through a Java applet

Executing a Java applet throws an exception when run through Internet Explorer. Our expert provides methods to make the sapjco.jar file visible to the applet.

Executing a Java applet throws an exception when run through Internet Explorer. In the Eclipse environment, the applet works perfectly; logs on to R/3 with my user I.D. and password and executes a simple function module. It then returns back some parameter text and logs off. In Internet Explorer, when executing the HTML file, I get the following error message:

java.lang.NoClassDefFoundError.

How do I call JCo through a Java applet?

The problem lies with the fact that your applet class cannot 'see' the sapjco.jar file. Because the applet runs in its own container, it does not have access to the local CLASSPATH variable set by your operating system. There are two mechanisms to make the sapjco.jar file visible to the applet.

The easiest way to do this is to copy the sapjco.jar file into the "lib/ext" directory underneath your Java JRE home directory. Find the JRE/lib/ext directory in the directory where you installed the Java JDK. Copy sapjco.jar here, then restart your applet.

The second mechanism would be used for deploying your applet to a wider audience across your network. In that case, you would need to physically store the sapjco.jar file on the Web server that will be hosting your applet. This should be contained in the same directory in which your applet is being deployed (for more information perform a Google search for "deploying applet as war"). You will also need to specify where the applet can find this jar using the CACHE_ARCHIVE attribute in the applet tag of the HTML document used to deploy the applet. Set the CACHE_ARCHIVE attribute equal to the local path on the server where sapjco.jar can be found (ex. PARAM NAME="CACHE_ARCHIVE" VALUE="/webserver/jcodirectory/sapjco.jar").

This was first published in July 2006

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