Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Compiling a servlet

 
Nikhil Jain
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ranchers,

In HFS book, one of the chapters gives the following syntax to compile the servlet

%javac -classpath /yourpath/tomcat/common/lib/servlet-api.jar -d classes src/ch1servelet.java

Project1
--Src -> Ch1Servlet.java
--classes
--etc -> web.xml

when we compile this the class file lands in the Project1-Classes folder automatically, but we did not specify this path. How does this happend...

please help!

Thanks
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
-d classes sets the destinationation directory to the classes folder.

It's pretty safe to say the javac command is being called from the Project1 folder.
 
Ashley Bideau
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when we compile this the class file lands in the Project1-Classes folder automatically, but we did not specify this path. How does this happend...


Thats why clearing SCJP 5.0 is so fun

-Ashley
SCJP 5.0
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!