Problem solve Get help with specific problems with your technologies, process and projects.

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:

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").

Dig Deeper on SAP Java and J2EE

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.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.