GeeCON Prague 2014*
The moose likes Servlets and the fly likes Anyone try to put java classes file into Tomcat ever? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "Anyone try to put java classes file into Tomcat ever?" Watch "Anyone try to put java classes file into Tomcat ever?" New topic
Author

Anyone try to put java classes file into Tomcat ever?

james
Greenhorn

Joined: Jan 28, 2002
Posts: 5
I am doing a test for servlet in using Tomcat4.0.1.
What I did is put a HelloServlet.class file into the following directory,
<tomcat home>webapps\ROOT\WEB-INF\Classes\, then invoke the servlet: http://localhost:8080/servlet/HelloServlet. Based on the tutorial, this processedure should be right. But I failed to invoke HelloServlet.class.
But if I put the class file into: <tomcat home>\classes\, I can get correct response from the servlet.
Do you know the reason?


Learning is no limit!
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12791
    
    5
This may be related the fact that if you don't put your servlet classes in a package, Tomcat looks in it's "current" directory.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16092
    
  21

If you really did name the class directory "Classes", that could be the problem. Java very frequently requires upper/lower case distinctions be maintained in filenames even in OS's like Windows that otherwise don't care. The proper name of the directory is "classes" (all lower-case), and for certain any other capitalization will break the "write-once/run-anywhere" capabilities of the web app, since Unix system filenames ARE case senstive.
It doesn't help any that when you create a folder with the Windows GUI, it very helpfully wants to uppercase the first character.


Customer surveys are for companies who didn't pay proper attention to begin with.
james
Greenhorn

Joined: Jan 28, 2002
Posts: 5
Folks, I solved the problem! I downloaded a zip file then unzip it into my c:\ directory instead of downloading a exe file then install it. This is interesting issue, might be a bug in Tomcat4.0 distribution. After installation, I created /classes directory under /webapps/ROOT/WEB-INF, then put .class file into it, it works.
Tim Holloway:
You are right, it cannot be /Classes, it should be /classes.
 
GeeCON Prague 2014
 
subject: Anyone try to put java classes file into Tomcat ever?