Compiling servlets and jsp

Using the Java SDK with TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
Gary

Compiling servlets and jsp

Post by Gary »

I've just started using textpad to write and coompile java files. I'm having trouble configuring textpad to compile servlets and jsp. I can compile (and run) non-servlet/non-jsp java files. I found information for configuring textpad for compiling java files, but I'm having problems getting it to work. Any help is greatly appreciated.
Andreas

Re: Compiling servlets and jsp

Post by Andreas »

So what is the problem?
Which error messages do you get?
Gary

Re: Compiling servlets and jsp

Post by Gary »

I have corrected the problems. The JSP files needed to tbe placed somewhere in the servlet directory structure. For the servlets, I had a typo in my classpath. I'm running Windows NT 4.0.
Galaham

Re: Compiling servlets and jsp

Post by Galaham »

I am having the same problem with Servlets. Where did you set your classpath? In the system\enviornment?

Is there a way to set the classpath within textpad?
Gary

Re: Compiling servlets and jsp

Post by Gary »

In textpad you can set the classpath, and the base servlet directory path to store compiled class files, in Configure - Preferences - Tools - Compile Java - Parameters. For example, in my Jaguar CTS server set-up I use the following parameters to set the classpath and the base servlet directory to store compiled class files:

The classpath parameter is:

-classpath "D:\Program Files\Sybase\Jaguar CTS 3.5\html\classes;D:\Program Files\Sybase\Jaguar CTS 3.5\java\classes;D:\Program Files\Sybase\Jaguar CTS 3.5\html\classes\myClassFiles;D:\Program Files\Sybase\Shared\Sun\jdk122\lib\classes.zip"

The Jaguar base servlet directory parameter to store compiled class files is:

-d "D:\Program Files\Sybase\Jaguar CTS 3.5\html\classes"

The files name without path (filename.java) parameter is:

$FileName

The three parameters together are:

-classpath "D:\Program Files\Sybase\Jaguar CTS 3.5\html\classes;D:\Program Files\Sybase\Jaguar CTS 3.5\java\classes;D:\Program Files\Sybase\Jaguar CTS 3.5\html\classes\myClassFiles;D:\Program Files\Sybase\Shared\Sun\jdk122\lib\classes.zip" -d "D:\Program Files\Sybase\Jaguar CTS 3.5\html\classes" $FileName

It is important to have spaces between the classpath parameter, directory parameter and filename parameter. Also, if any of the paths contain spaces as mine did, you need to start and end the parameter with double quotes.

When you package a class file, the directory must exist in the base servlet directory path. For example, I'm saving class files to a package called myClassFiles. I need to have the following directory structure:

D:\Program Files\Sybase\Jaguar CTS 3.5\html\classes\myClassFiles

In my Java code, the first line would be:

package myClassFiles;

When I compile, the class will be saved to the D:\Program Files\Sybase…myClassFiles directory.

Alternatively, you can set the classpath in the control panel - system - environment in Windows NT as a system variable. If you permanently set the classpath, than the parameters in textpad would be set with the base servlet directory and file name as follows:

-d "D:\Program Files\Sybase\Jaguar CTS 3.5\html\classes" $FileName

Hope this helps.

Gary Schultz
GIS Specialist
Wisconsin Department of Commerce
Post Reply