This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help who compiled MVC from HF Servlet book

 
saina smith
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Iam new to servlets.Iam working on the first mvc example in HF servlets book. I downloaded tomcat 5.5 and j2se sdk 1.5. Tomcat is running fine.I set the following in the environment variables.

classpath is %CLASSPATH%;%TOMCAT_HOME%\common\lib\servlet-api.jar;%TOMCAT_HOME%\common\lib\jsp-api.jar;.
TOMCAT_HOME is C:\Program Files\Apache Software Foundation\Tomcat 5.5
JAVA_HOME is C:\Program Files\Java\jdk1.5.0.

When I try to compile BeerSelect using c:\MyProjects\beerV1\javac -d classes src\com\example\web\BeerSelect.java it says package javax.servlet does not exist. Can anyone please help me
 
Jay King
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Post the code of the java file.

~Jay
JavaRSS.com, Java News, Java Articles and Java Blogs, Just one Bookmark.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, posting the code won't help. It is a classpath issue. You do not have the servlets jar file in your classpath. It looks like you have it in your configuration for Tomcat, but it has not affect on running javac from a dos prompt.

I'd do a search on classpath in google to help better understand how classpaths work. If you plan to take the SCJP you will be tested on classpaths, I can guarantee that.

Mark
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You didn't define CLASSPATH before defining TOMCAT_HOME, did you?

From the dos prompt type:
echo %CLASSPATH% and make sure the path to servlet-api really points the correct directory.
 
saina smith
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks I defined TOMCAT_HOME below the classpath so it is not recognising now it is working fine
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic