• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • Carey Brown
  • Stephan van Hulst
Bartenders:
  • Frits Walraven
  • fred rosenberger
  • salvin francis

Compiling servlet with a helper class does't work

 
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 9683
42
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Petar Thomas
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi! It is nice to see Your name again.

Thank You, that's it.

: )
 
Ankit Garg
Sheriff
Posts: 9683
42
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
: ))

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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic