This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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: 13000
    
    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: 17030
    
  26

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.


An IDE is no substitute for an Intelligent Developer.
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.
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Anyone try to put java classes file into Tomcat ever?
 
It's not a secret anymore!