Skip to main content

Running the Java Basic Servlet Example


The projects in this folder are all very simple Java Servlet examples that show how to use four different data sources.

Basic Information

You are free to use this example in any way you wish. The instructions are for Windows systems, but the setup process is very similar for any other system that Tomcat supports.



  1. Install the Java SE JDK; Either the 32 or 64 bit version will work.
  2. Setup environment variable JAVA_HOME (point this to the root installation of your Java installation; for example "C:\Program Files\Java\jdk1.6.0_23")
    1. Right click My Computer
    2. Click Properties
    3. Click "Advanced system settings"
    4. Click "Environment Variables..."
    5. Under "System Variables", look for the JAVA_HOME variable.
      • If it is not there, click "New...", then type JAVA_HOME for Variable Name and the path of your jdk installation for Variable Value.
      • If it is there, click "Edit..." and ensure that it points to the path of your jdk installation


Installation of Tomcat

Note: all links assume you are running on localhost.

  1. Go to
  2. Click the link for the Zip File Download under Core. Do not download the windows installation, the code does not work.
  3. Save the file.
  4. Once the download is complete, open the folder that the file was saved to.
  5. Right click the file, highlight WinZip, and click “Extract to…”
  6. Navigate to the C: directory, and click unzip.
  7. In your C: directory, rename the folder “apache-tomcat-6.0.32” to “tomcat6”.
  8. Open a command prompt.
  9. Type cd\ to navigate to the root C: Directory
  10. Type cd tomcat6\bin to navigate to the tomcat6 bin folder.
  11. Type startup.bat to start Tomcat.
  12. In a web browser, navigate to http://localhost:8080. Now that tomcat is installed, you should see the tomcat website. If you do not see the tomcat website, tomcat did not correctly install.
  13. Return to the command prompt, and type shutdown.bat to shut down tomcat.

Running the Servlet Example

  1. Open the Java Engine’s Catapult Help Menu. (Start -> All Programs -> Windward Studios -> Windward Reports Java Engine -> Java Engine Help Launcher)
  2. Click the Basic Servlet tab.
  3. Click the Example Source button for the data source you wish to use.
  4. Copy the contents of the folder.
  5. Navigate to C:\tomcat6\webapps.
  6. Create a new folder named “JavaServletExample”.
  7. Open the folder, and paste. There should be four folders and seven files in the JavaServletExample folder (The path should be 'C:\tomcat6\webapps\JavaServletExample'):
    • 'files' folder
    • 'META-INF' folder
    • 'src' folder (contains the source code for this example)
    • 'WEB-INF' folder
    • 'index.html' file
    • 'ServletExample.iml' file (IntelliJ project file)
    • 'ServletExample.ipr' file (IntelliJ project file)
    • 'ServletExample.iws' file (IntelliJ project file)
  8. If you did not enter your license key during the install or you installed using the ZIP file, copy and paste your Java Engine key into the 'C:\tomcat6\webapps\JavaServletExample\WEB-INF\' file.
    (The key already in the file is not valid.)
  9. Open a command prompt and startup tomcat again by typing cd\ to go to the root directory, cd tomcat6\bin to go to the bin folder, then typing startup.bat.
  10.  If it complains that it can’t find the Windward Libraries copy and paste them into \webapps\JavaServletExample\WEB-INF\lib\
  11. For the different datasource connectors if it does not find the data source driver you can copy and paste the connector jar file into \webapps\JavaServletExample\WEB-INF\lib\

Testing the Sample

  1. In a web browser, go to http://localhost:8080/JavaServletExample.
  2. Click the link that says “Click here to go to the example.
  3. Click “Create report" to run and open the report.


  • All of the source code calling the Windward Java Engine can be found at 'C:\tomcat6\webapps\ServletExample\src'.
  • To build from the source, either
    • Run build.bat in the 'c:\tomcat6\webapps\JavaServletExample\src\com\windwardreports' directory. NOTE: You will need to have javac.exe in your PATH or specify the full path location in build.bat.
    • Open the ServletExample.ipr in IntelliJ and build the project using the UI.
  • Was this article helpful?