This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Chapter 3, Head First Servlets and JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Chapter 3, Head First Servlets and JSP" Watch "Chapter 3, Head First Servlets and JSP" New topic

Chapter 3, Head First Servlets and JSP

Claus Gerull

Joined: Dec 17, 2012
Posts: 1
Hi everyone,

I have problems executing the simple servlet compilation from the book Head First Servlets and JSP.
There are a couple of topics about this chapter on the web. After 2 day searching i didn't found the right one. Most topics are
over the starting for the compilation but starting javac from src and referring to the classes as ../classes won't work either.

I'm working on a Mac OS X 10.6.8 (snow leopard) with Apple's Java stack.

When I try to run the compile statement as written in the book:

javac -classpath ~/apache-tomcat-7.0.28/lib/servlet-api.jar:classes:. -d classes src/com/example/web/

I got no class file.

Modifying the statement to get more info show this:

mymac$ javac -classpath ~/apache-tomcat-7.0.28/lib/servlet-api.jar:classes:. -sourcepath src -verbose -Xlint:all -d classes src/com/example/web/
[parsing started src/com/com/web/]
[parsing completed 9ms]
[search path for source files: src]
[search path for class files: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/jsfd.jar,/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar,/System/Library/Frameworks/JavaVM.framework/Frameworks/JavaRuntimeSupport.framework/Resources/Java/JavaRuntimeSupport.jar,/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/ui.jar,/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/laf.jar,/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/sunrsasign.jar,/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/jsse.jar,/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/jce.jar,/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/charsets.jar,/System/Library/Java/Extensions/AppleScriptEngine.jar,/System/Library/Java/Extensions/dns_sd.jar,/System/Library/Java/Extensions/j3daudio.jar,/System/Library/Java/Extensions/j3dcore.jar,/System/Library/Java/Extensions/j3dutils.jar,/System/Library/Java/Extensions/jai_codec.jar,/System/Library/Java/Extensions/jai_core.jar,/System/Library/Java/Extensions/mlibwrapper_jai.jar,/System/Library/Java/Extensions/MRJToolkit.jar,/System/Library/Java/Extensions/,/System/Library/Java/Extensions/vecmath.jar,/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/apple_provider.jar,/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/dnsns.jar,/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/localedata.jar,/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/sunjce_provider.jar,/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/sunpkcs11.jar,/Users/claus/apache-tomcat-7.0.28/lib/servlet-api.jar,classes,.]
[total 667ms]

What i'm missing are the load statements of java libraries and the final write action. Also the fact that javac reads the file but stopped without compiling and any message is scary.

Compilations of other simple programs work fine as the example in chapter 1 of the same book.

I sorry but i'm totally stuck here. As i can see no error or warning from javac I have no idea where to look.

Any help is appreciated.
I agree. Here's the link:
subject: Chapter 3, Head First Servlets and JSP
It's not a secret anymore!