Ask the Expert

How to call a JCo through a Java 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?

    Requires Free Membership to View

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

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

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: