The projects in this folder are all very simple Java Servlet examples that show how to use four different data sources.
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.
- Windward Java Engine
- Java SE JDK
- Tomcat 6
- Installation outlined in this document
- Install the Java SE JDK; Either the 32 or 64 bit version will work.
- 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")
- Right click My Computer
- Click Properties
- Click "Advanced system settings"
- Click "Environment Variables..."
- 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.
- Go to http://tomcat.apache.org/download-60.cgi.
- Click the link for the Zip File Download under Core. Do not download the windows installation, the code does not work.
- Save the file.
- Once the download is complete, open the folder that the file was saved to.
- Right click the file, highlight WinZip, and click “Extract to…”
- Navigate to the C: directory, and click unzip.
- In your C: directory, rename the folder “apache-tomcat-6.0.32” to “tomcat6”.
- Open a command prompt.
- Type cd\ to navigate to the root C: Directory
- Type cd tomcat6\bin to navigate to the tomcat6 bin folder.
- Type startup.bat to start Tomcat.
- 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.
- Return to the command prompt, and type shutdown.bat to shut down tomcat.
Running the Servlet Example
- Open the Java Engine’s Catapult Help Menu. (Start -> All Programs -> Windward Studios -> Windward Reports Java Engine -> Java Engine Help Launcher)
- Click the Basic Servlet tab.
- Click the Example Source button for the data source you wish to use.
- Copy the contents of the folder.
- Navigate to C:\tomcat6\webapps.
- Create a new folder named “JavaServletExample”.
- 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)
- 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\WindwardReports.properties' file.
(The key already in the WindwardReports.properties file is not valid.)
- 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.
- If it complains that it can’t find the Windward Libraries copy and paste them into \webapps\JavaServletExample\WEB-INF\lib\
- 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
- In a web browser, go to http://localhost:8080/JavaServletExample.
- Click the link that says “Click here to go to the example.
- 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.