ChartDirector 6.1 (Java Edition)
Installation
ChartDirector for JSP/Java contains the ChartDirector Java library, complete documentation, and sample code as JSP and as standalone Java programs.
ChartDirector for JSP/Java is distributed as a zip file, with a directory structure compatible with that of a JSP Web Application Archive (WAR). This allows ChartDirector for JSP/Java to be directly installed to a JSP web server as a web application.
Installing ChartDirector as a JSP Web Application
If you are planning to use ChartDirector in a JSP web server, you may consider to install ChartDirector as a JSP web application. To do this, simply rename the ".zip" file extension to ".war" and use it as a WAR. Virtually all JSP web servers support installing WAR. Please refer to your web server's documentation for details.
The advantages of installing ChartDirector as a web application are that the system will be set up automatically for running the sample code and testing ChartDirector. You can also easily uninstall ChartDirector by uninstalling the web application.
After installing ChartDirector as a JSP web application, you can access the ChartDirector documentation and sample code using:
http://server_name/context_path
where "context_path" is the path of the servlet context that you use during installation.
Most web servers will automatically extract (or unzip) the WAR file during installation. However, some web servers, such as Tomcat configured with unpackWARs="false", may use the WAR file directly without extracting it. In this case, ChartDirector will work normally, but you will be unable to modify the sample code and experiment with ChartDirector.
If your web server does not automatically extract WAR files, you may unzip the WAR file to a directory first, and install the extracted directory to the web server. You may then modify the sample code and experiment with ChartDirector.
Installing ChartDirector in a JSP Web Server Manually
If you do not want to automatically install ChartDirector using WAR, you can manually install the ChartDirector sample code by copying the necessary files.
- Extract the ChartDirector for JSP/Java distribution into an empty directory.
- Copy "WEB-INF/lib/ChartDirector.jar" to the "WEB-INF/lib" subdirectory of your web application.
- Copy the entire sample code directory "jspdemo" to your web application.
For some JSP web servers, you may need to restart the web application after modifying the "WEB-INF/lib" subdirectory.
You may then access the sample code using:
http://server_name/context_path/jspdemo/index.htm
Using ChartDirector in Your Own Web Application
To use ChartDirector in your own web application, you need to:
- Copy the ChartDirector Java library to your web application.
The ChartDirector Java library is in "WEB-INF/lib/ChartDirector.jar". Please copy it to the "WEB-INF/lib" subdirectory of your web application.
- (Optional) Map URL of the format "*.chart" to the ChartDirector.GetSessionImage servlet.
This step is needed if you are writing servlet applications that do not use JSP. If you are using JSP, this step is usually not needed.
To set up the servlet mapping, please enter the following lines in the "web.xml" file of your web application.
<servlet>
<servlet-name>GetSessionImage</servlet-name>
<servlet-class>ChartDirector.GetSessionImage</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>GetSessionImage</servlet-name>
<url-pattern>*.chart</url-pattern>
</servlet-mapping>
If you are using a front-end web server to forward servlet requests to a back-end servlet container (eg. using an Apache web server to forward servlet requests to a Tomcat servlet container), please set up your web server so that it forwards "*.chart" to the servlet container, otherwise the servlet container will not see the "*.chart" requests.
Installing ChartDirector for Standalone Applications
If you are planning to use ChartDirector for standalone Java programs, simply extract the ChartDirector for JSP/Java distribution to an empty directory. You can then compile and run the standalone sample programs in the "javademo" subdirectory:
[Microsoft Windows Command Shell Syntax]
javac -classpath "ChartDirector_s.jar;." ChartDirectorDemo.java
java -classpath "ChartDirector_s.jar;." ChartDirectorDemo
[Typical Linux/UNIX Command Shell Syntax]
javac -classpath ChartDirector_s.jar:. ChartDirectorDemo.java
java -classpath ChartDirector_s.jar:. ChartDirectorDemo
In the above, "ChartDirector_s.jar" is a light-weight version of the full "ChartDirector.jar" library. The light-weight version is for systems that support Java GUI. The full version is for systems that may not have GUI support (eg. some Linux/UNIX servers).
Using ChartDirector in Your Own Standalone Application
To use ChartDirector in your own application, you need to include the ChartDirector Java library in your application by including the ChartDirector library in your class path or Java project.
For Java GUI applications, you may use the light-weight version of the "ChartDirector_s.jar" located in the "javademo" subdirectory.
If you are writing a Java program that may run on a "headless" system (that is, a computer without a GUI, such as some Linux/UNIX serves), but the Java VM is not started with headless mode support, you can use the full version "ChartDirector.jar" located in the "WEB-INF/lib" subdirectory. The full "ChartDirector.jar" contains an internal font system acting as a backup to the Java font system. You may refer to
Font Specification for more details.
Javadoc for IDE Integration
Currently, ChartDirector documentation is not in Javadoc format. Instead, it is in both CHM and HTML formats, with the HTML format being similar to the CHM format. The CHM format is preferred because it has integrated search facility, better indexing features, supports bookmarks, and is easier to print.
If you are currently reading the ChartDirector documentation in HTML format, and you are using a Microsoft Windows computer, you are recommended to download the CHM documentation from
http://www.advsofteng.com/download.html.
Some integrated development environments (IDE) can import "Javadoc" and use it to provide "intellisense" tool tips in the source code editor. To support these features, ChartDirector includes "Javadoc" in the "ide_javadoc" subdirectory. Note that the "Javadoc" does not contain any text for human reading. It just contains the ChartDirector API prototypes to allow the IDE to pop up prototypes with proper parameter names in "intellisense". For human reading, please use the CHM (recommended) or standard HTML documentation.
Installing the ChartDirector License
If you have purchased a license to use ChartDirector, you should have a license key delivered to your via email and postal mail.
If your license key is for upgrading from a previous version of ChartDirector, you need to append the upgrade license key to the previous version license key, and use the combined license key.
There are two alternative methods to install the license key.
- Create a one-line ASCII file using Notepad or other text editor, and put the license key in that line. The whole file should contain only the license key. Name that file "chartdir.lic" and put the file in the Java class path visible to "ChartDirector.jar" (eg. "WEB-INF/classes" in a web application, or the class path of the main class in a standalone application).
If the license file appears to have no effect (does not disable the yellow banner line), and you are running on a web server environment, please make sure the web server "anonymous user" has read access to the "chartdir.lic" file. You may copy the file "[ChartDirector]/jspdemo/cdinfo.jsp" to your web server and access it using a browser. It will display a diagnostic page explaining why the license cannot be loaded.
Make sure your license file is called "chartdir.lic". In particular, Notepad may automatically append ".txt" to the file name when creating a new file. So even if the file is saved as "chartdir.lic", it may end up as "chartdir.lic.txt". If this is the case, please rename the file back to "chartdir.lic".
- An alternative method is to hard code the license key into the source code by using the Chart.setLicenseCode API. This method is recommended if your are redistributing ChartDirector, because your customer will then be unable to see the license key (unless your software is open source).
Chart.setLicenseCode(".....your-license-key.....");
© 2017 Advanced Software Engineering Limited. All rights reserved.