Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I cannot run my servlet..

Status
Not open for further replies.

dumkopf

Programmer
Jun 24, 2003
2
SE
I've cut and pasted a HelloWorld.java servlet file and managed after lot of hassle to compile it without errors.

Now I'd like to view it in the browser, but it doesn't find it. Tomcat4 is up and running on RH 9.. and I can view the example files that were downloaded with tomcat.

The HelloWorld.java is placed in CATALINA_HOME/webapps/ROOT/myfolder/WEB-INF/classes/

It looks like i need to make a xml file.. where do i put it?? In CATALINA_HOME/webapps/ROOT/myfolder/?? is that the server.xml?? How do I configure it?

Thanks,
Mikael

 
I could be wrong, but the path
CATALINA_HOME/webapps/ROOT/myfolder/WEB-INF/classes/
will not be understood by tomcat. You want

CATALINA_HOME/webapps/ROOT/WEB-INF/classes/

or

CATALINA_HOME/webapps/myfolder/WEB-INF/classes/

The ROOT dir is the default dir for tomcat, and you place any other contexts next to it (ie in webapps, following the ROOT sub-dir setup)

Ben
 
Thanks Ben,

I am very new to this.. and java too..

You were right about where the files have to be placed. All I did was to move down myfolder one step.. remove the word myfolder in web.xml.. then i restarted the server.. and it didn't work.. =/

Then I pressed reload for the second time.. VOILA!! =)

Thanks,
Mikael
 
Hi dumkopf
I'm also very new to Java and is stuck with the compilation part.
I'm very confuse about setting the environment variables.
According to the tutorials, I set them like this:
set Java_Home=c:\jdk1.3.1_07
set classpath=c:\tomcat\common\lib\servlet.jar
Where "c:\tomcat" is the my tomcat directory.

Am I setting correctly here? (Shouldn't be, cos it didn't work...)

The tutorial also told me to set them up using autoexec.bat, but I cannot write anything in there!
So I set them up in MS-DOS.
Is this allowed?

Thanks for any help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top