wood burning stoves 2.0*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Compiling servlet with a helper class does't work Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Compiling servlet with a helper class does Watch "Compiling servlet with a helper class does New topic
Author

Compiling servlet with a helper class does't work

Petar Thomas
Ranch Hand

Joined: Oct 11, 2009
Posts: 234
I can't compile a servlet if I try to instantiate some plain old Java class inside.

example:





C:\java\project1>javac -classpath c:\apache-tomcat-6.0.26\lib\servlet-api.jar;. - d classes c:\java\project1\src\foo\ServletTest.java


gives me an error described in the source code of the TestServlet.java


I have set variables JAVA_HOME, and CATALINA_HOME. I didn't set CLASSPATH, but when I set the CLASSPATH, nothing changes.

Once before I used a helper class, and then it compiled and worked, now it doesn't anymore.

I don't have any idea. Please , help me.
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9293
    
  17

Can you tell us where you put your Test.java file?? If it is in the c:\java\project1\src\foo\ directory, then use this command to compile your servlet

C:\java\project1\src>javac -classpath c:\apache-tomcat-6.0.26\lib\servlet-api.jar;. -d ..\classes foo\ServletTest.java


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Petar Thomas
Ranch Hand

Joined: Oct 11, 2009
Posts: 234
Hi! It is nice to see Your name again.

Thank You, that's it.

: )
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9293
    
  17

Petar Tomičić wrote:Hi! It is nice to see Your name again.

I don't remember changing my name at javaranch to anything else
Petar Thomas
Ranch Hand

Joined: Oct 11, 2009
Posts: 234
: ))

Few months ago I was for some time on SCJP forum, and I liked to read Your answers, and now it just made me happy to read again Your answer.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Compiling servlet with a helper class does't work