Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Please explain this - compiling java file

 
Suchitra Bhat
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

It will be very helpful to me if any one explains me what is the below command exactly doing ? I found this command while preparing for SCWCD in HFSJ

javac -classpath /Users/bert/Applications2/tomcat/common/lib/servlet-api.jar:classes:. -d classes src/com/example/web/BeerSelect.java

I could just make out that it is compling BeerSelect.java including servlet-api.jar and putting the class file in classes directory. but why is classes directory mentioned twice i.e after -d option and also before -d option in the command.
doubt is in ":classes:. -d classes " part of the command.

Thanks in advance,
Suchitra
 
Kudret Serin
Ranch Hand
Posts: 167
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"-d classes" says the compiler that, the BeerSelect.class file must be placed under "classes/src/com/example/web/" (same directory structure with the .java file). The compiler will generate the directories (src/com/...) even if you had not them.
 
Ed Mandera
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"-classpath /Users/bert/Applications2/tomcat/common/lib/servlet-api.jar:classes:." sets the classpath to include servlet-api.jar, all the class files in the classes directory structure, and all the class files in the current directory.

The colon is the delimiter for classpath entries.

Hope this helps!

Ed
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic