aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes HFSJ: Error while compiling servlet example Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "HFSJ: Error while compiling servlet example" Watch "HFSJ: Error while compiling servlet example" New topic
Author

HFSJ: Error while compiling servlet example

Patrick Beck
Ranch Hand

Joined: Nov 07, 2006
Posts: 82
Hi all,

I am currently studying for SCWCD and tried to compile the example on page 176 (the listener test).

I created the java files and first compiled the Dog.java file with



Works fine, Dog.class was created in classes/com/example.

Now I tried to compile src/com/example/MyServletContextListener.java out of the WEB-INF directory with



and I get the following error:



Don't know why Dog class is not found, it is in the same directory.
I think I am just missing sth but I cannot figure out what?

Any ideas?

Thank you!


SCJP5<br />SCWCD<br />SCBCD (preparing)<br />IBM/Lotus CLS, CLP, PCLP R5/R6/R7<br />LPIC-1, LPIC-2
Dagbj�rn Nogva
Greenhorn

Joined: May 20, 2007
Posts: 10
Hi Patrick,

You need to add the classes directory to the -classpath on the javac command line, otherwise the compiler won't find Dogs.class when compiling MyServletContextListener.java.

Cheers,
Dagbj�rn
Patrick Beck
Ranch Hand

Joined: Nov 07, 2006
Posts: 82
Thanks for your help, I tried to concatenate the path to the Dog.class to the classpath, seperated with a semicolon.



The following result:


Well, I do have sufficient access rights.

But then I tried to compile a bunch of java files with "javac ... *java" and now it works.

All 3 files have been compiled and moved to the classes dir.

Don't know what the reason was, but now it works

But thanks for your help!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HFSJ: Error while compiling servlet example