Setup a Development Environment
Tutorial to setup an environment for developing jWic applications.
Last Update: 2005-11-08
Author: Florian Lippisch


This document describes how to setup a development environment to develop web applications. We will setup a Tomcat webserver, an Eclipse IDE with a Tomcat plugin and create a new Tomcat project that contains jWic and is ready for development. The guide has been written and tested under winXP.

Please note that the described environment is just one possible way how to develop a jWic/web application.

Prerequisites

You need the following products:

I have used Eclipse 3.0.2, Tomcat 5.0.28, tomcatPlugin 3.0 and jWic 2.0.2 for this guide. Other versions should work alike.

Plan the Installation

We have to choose a location for three elements: the Tomcat webserver, the Eclipse IDE programm and the workspace. Its up to you how to organise your files, thats why we reference these pathes in this document using placeholders:

An actual setup could look like this:
TOMCAT_HOME = C:\program files\jakarta-tomcat-5.0.28
ECLIPSE_HOME = C:\program files\eclipse
WORKSPACE_HOME = C:\development\workspace

Setup the Environment

  1. Go to the directory above your TOMCAT_HOME path (C:\program files) and extract the Tomcat archive, which creates a subdirectory named jakarta-tomcat-5.0.28 that contains the required files.
  2. Go to the directory above your ECLIPSE_HOME path (C:\program files) and extract the Eclipse archive, which creates a subdirectory named eclipse that contains the required files. Don't start Eclipse yet!
  3. Go to the plug-in directory of eclipse (ECLIPSE_HOME/plugins) and extract the Tomcat Launcher plugin archive, which creates a subdirectory named com.sysdeo.eclipse.tomcat_3.0.0.
  4. In this plugin directory is an archive named DevLoader.zip. The content of this archive must be extracted to the TOMCAT_HOME/server/classes directory.
  5. Now start Eclipse using the eclipse.exe. Eclipse will now prompt you to select a workspace location:



    Either accept the proposed location or enter the desired location. If the directory does not yet exist, it will be created. Whatever selection you have done, it will be referenced as WORKSPACE_HOME now.
  6. Note: When you have started Eclipse the first time, it recognizes and loads the Tomcat Launcher plugin automatically. If you have started Eclipse before without the plugin, you must tell Eclipse to search for new plugins. You can do this by adding the argument -clean when you start the eclipse.exe.

  7. Next step is to configure the Tomcat plugin. From the menu bar, select Window - Preferences. In the preferences dialog, select the Tomcat category and set the server version to "Version 5.x" and select the TOMCAT_HOME location. The context declaration mode should be "Context files":



    Press Ok to apply the changes.

The development environment has now been setup. You should be able to start and stop the Tomcat server using the actions in the Tomcat menu.

Create a jWic project

  1. In the File menu, select New - Project... In the following dialog, select Tomcat Project, which can be found under the category Java, and hit the Next button. Now give the project a proper name (i.e. "myjwic") and hit Next again.
  2. The proposed URI on the next page is used to access your webapplication. It should be a technical name as it is part of the URL. For the tutorial, name it "myjwic".
  3. Press finish to create your project
  4. Now we need to copy the required jWic files into your new, blank web application. Therefore you need to extract the jwic distribution to a temporary location and copy the required files into your project. You can do this by either using "Copy&Paste" within Eclipse or copy the files directly to the WORKSPACE_HOME/myjwic directory. But if you copy the files "behind" Eclipse's back, you must refresh the view by selecting Refresh in the context menu of your project.
    - Copy the content of the default_webapp from the distribution into your project directory (myjwic)
    - Create a new directory named "lib" in the WEB-INF directory
    - Copy all files from the lib directory in the distribution to the just created lib directory in WEB-INF
    - Copy the jwic.jar and jwic_samples.jar files into the same directory.
  5. Open the project properties dialog (right-click on your project and select properties) and select the Java Build Path category. Select the tab Libraries and hit the button Add JARs. Now mark all libraries in your projects WEB-INF/lib directory and hit Ok. Hit Ok again to apply the changes to your classpath.

You are now ready to develop a jWic application. You can test the installation by starting the Tomcat server and try to run the samples using the following URL:
http://localhost:8080/myjwic/sample/sample1.xwic


jWic Framework - © 2005 jWic Group - http://www.jwic.de