Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Servlet API again  RSS feed

 
YorikNMe
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry to be dense.
I have read posts here on compiling servlet programs- but javac still complains bitterly.
I copied servet.jar to /jre/lib, but no joy. I notice the import command is
import javax.servlet.*; So should this file be in a sub directory?
Thanks,
DB.
 
Bill Siggelkow
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To compile you need the servlets jar on your classpath. Try adding it to your classpath or explicitly specifying it using the -cp option of the javac command.
 
Jessica Sant
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Bill Siggelkow:
To compile you need the servlets jar on your classpath. Try adding it to your classpath or explicitly specifying it using the -cp option of the javac command.

And just in case you don't know -- to set your CLASSPATH variable in Windows do:
set CLASSPATH=%CLASSPATH%;c:/blah/something.jar;c:/blah/somethingelse.jar
you can type 'set cl; to see what your current CLASSPATH is set to.
In UNIX it will look something like this (my syntax might be a bit off, someone please correct me if need be)
CLASSPATH=$CLASSPATH:/opt/blah/something.jar:/opt/blah/somethingelse.jar
export $CLASSPATH
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
YorikNMe, Copy it to jre\lib\ext\
 
Eric Peterson
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
YorikNME,
There is a very good book written by Marty Hall called Core Servlet and Java Server Pages and it is available online in pdf format. I am sure if you are wanting to compile your servlets you will want to test them so you will need Tomcat or some other servlet engine. The first chapter of the above mentioned book will walk you through configuring your environment to compile and test your servlets. I hope this helps.
 
YorikNMe
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you all very much. Got the programs to compile.
Appreciate it!
DB
 
Dave Vick
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
YorikNMe
Welcome to the Java Ranch, we hope you’ll enjoy visiting as a regular however,
your name is not in keeping with our naming policy here at the ranch. Please change your display name to an appropriate name as shown in the policy.
Thanks again and we hope to see you around the ranch!!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!