This is really a classpath issue. What is your classpath set to?
Mat
Satish Kesiboyana
Greenhorn
Joined: Sep 11, 2005
Posts: 3
posted
0
Hello,
My Classpath is C:\Apache Software Foundation\Tomcat5.0\common\lib\servlet-api.jar
Do I have to use any other class path.
Mat Williams
Ranch Hand
Joined: Jul 20, 2005
Posts: 215
posted
0
Hi,
You will also need 'c:\myprojects\beerv1\src\' in the classpath, so that the compiler can find the package com.example.model
HTH
Mat
Satish Kesiboyana
Greenhorn
Joined: Sep 11, 2005
Posts: 3
posted
0
Hi Mat,
Thnx a lot, its working now.
But I had one question...suppose if I had to include 10 user defined packages which are located in 10 different locations, then do I have to include all those package paths in my classpath.
Thnx,
Satish
Mat Williams
Ranch Hand
Joined: Jul 20, 2005
Posts: 215
posted
0
Hi Satish,
When you compile you do, yes. When you deploy, as long as you use the standard deployment (ie all classes in WEB-INF\classes and all jars in WEB-INF\lib) then no you don't as the container will do that for you.
An easy way arount the problem is to compile all the fairly static classes, that is classes that don't change much and put them into a jar file. Then your classpath will only need one jar file. Alternatively start looking at an IDE such as Eclipse which will do some of that hard work for you.
I was working on the same example, had same problem - the CLASSPATH example works, but the book itself has the correct CLASSPATH which we have overlooked
$CLASSPATH:classes:.
that should cover your bases under your source dir