• Post Reply Bookmark Topic Watch Topic
  • New Topic

Compiling a servlet  RSS feed

 
Ranch Hand
Posts: 153
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
% cd MyProjects/beerV1
% javac -classpath /Users/bert/Applications2/tomcat/common/lib/
servlet-api.jar:classes:. -d classes src/com/example/web/BeerSelect.java

I am trying to understand what exactly this command does. I understand most of it. Is this command saying that BeerSelect.java should be compiled using tomcat's servlet-api.jar as a support library?
 
Rancher
Posts: 42972
73
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes- being a servlet, it probably extends the HttpServlet class - which therefore must be present during its compilation (and also at runtime, of course). It also references other Servlet API classes like HttpServletRequest and -Response. All these are defined in that Servlet API jar file.
 
Ryan McClain
Ranch Hand
Posts: 153
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you.
 
Author and ninkuma
Marshal
Posts: 66307
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note that the classpath also include the classes folder that is relative to the current folder (so I assume it assumes that you are in WEB-INF -- perhaps not the best of assumptions), and . which denotes the current folder.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!