Home / Support / Swiff Chart Generator / Setting Classpaths in WebSphere Application Server
Knowledge Base

HOW TO: Setting Classpaths in WebSphere Application Server

The information in this article applies to:

  • Swiff Chart Generator 2

Introduction

When JSP files or Servlets import external java packages, the CLASSPATH must be set correctly in order for the WebSphere compiler to access the required classes.

 

How to set the CLASSPATH correctly

There are several methods to set the CLASSPATH:

  • You can set the CLASSPATH in one of the batch files that WebSphere Application Server uses to initialize the environment variables. It is called setupCmdLine (.bat for Windows, .sh for Unix) and it is located in <WebSphere installation root>/AppServer/bin. Open this file and add the path to your jar files at the end of WAS_CLASSPATH line:
  • You can also copy the required classes and JAR files into one of the directories listed in the table below. By default, these directories are included in the CLASSPATH of the WebSphere Java compiler.
Classpath Directory Content
1. Runtime Classpath <WebSphere installation root>/AppServer/lib The core WebSphere Application Server runtime
2. Runtime Extensions <WebSphere installation root>/AppServer/lib/ext Extensions to the core WebSphere Application Server runtime
3. Application Extensions <WebSphere installation root>/AppServer/lib/app Class libraries that need to be shared by all J2EE Web Applications installed on the server.
4. Application Classloaders WAR and JAR modules specified classpaths.
WAR and JAR classpaths are defined in by the Class-path parameter in the MANIFEST file located in <WAR Root>/META-INF/MANIFEST.MF
These classpaths are set using the Application Assembly Tool (AAT) and are specific to each Web Application
5. WAR Modules (only) <WAR Root>/WEB-INF/lib JAR files located in this directory are specific to the associated WAR module. They are not accessible by other WAR modules.

 

JSP files and Servlets using Swiff Chart Generator

JSP files and Servlets manipulating charts generated with Swiff Chart Generator must import the class:

com.globfx.swiffchart.SwiffChart

This class is located in the SwiffChart.jar file which is installed in Swiff Chart Generator installation directory. Consequently, when running JSP files or Servlets using Swiff Chart Generator, the SwiffChart.jar file must be located in one of the directories listed in the CLASSPATH used by WebSphere.

According to the methods described in the previous paragraph, a simple solution could be to copy the SwiffChart.jar file into the directory <WebSphere installation root>/AppServer/lib/app.

 


Keywords:WebSphere JSP Servlet Java Classpath

Swiff Chart Generator