aspose file tools*
The moose likes Java in General and the fly likes Tomcat can't find my class files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Tomcat can Watch "Tomcat can New topic
Author

Tomcat can't find my class files

Keith Walters
Greenhorn

Joined: May 22, 2003
Posts: 2
Can't find classes
I used to run tomcat 3.X and all i needed to do to get up and running was put my html and jsp files in Tomcat Tomcat 3.X\webapps\ROOT\WEB-INF and my class files in Tomcat 3.X\webapps\examples\WEB-INF\classes and then access my html/jsp that where using my class files via http://localhost:8080/myJspFile.jsp . I didn't use any jsp tags, except if I needed to import something.

Example
webapps/root/web-inf/myJspFile.jsp ....
<html>
<% MyClass myClass = new MyClass(); %>
</html>

This isn't working with 4.X.

Here error I get is this:
symbol : class TestDClass
location: class org.apache.jsp.index_jsp
MyClass myClass = new MyClass();

Is there a place that I can put my class files and my jsp files and run things without having to change anything with tomcat, and without having to use packages or tags. And if I do need to use packages, what directory do I put them in, and were to I put the jsp/html files, and do I need to use an import statement in the jsp/html files, and what would that look like.

Thanks,
Keith
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Keith,
Welcome to JavaRanch. Well you really should package up your classes and you really shouldn't use Tomcat's examples directory. You should create a directory under webapps and give it an appropriate name like KeithsWebApp. Under that you should have a WEB-INF directory which contains your deployment descriptor file web.xml. Also under WEB-INF, you should have a classes directory and that's where you should put your servlets and other classes. Of course if you use packages then an appropriate diretory structure should follow in the classes diretory. Ordinarily you would not place any JSP or static HTML under the WEB-INF, they usually go somewhere inside the context root, which in this example would be KeithsWebApp. Tomcat should automatically pick up any new webapp on restart.
[ May 22, 2003: Message edited by: Michael Morris ]

Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Moving to the Tomcat forum.


"JavaRanch, where the deer and the Certified play" - David O'Meara
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tomcat can't find my class files
 
Similar Threads
Tomcat can't find my class files
Help!!! I can't acces my class from JSP without a package
Make Tomcat go
how to use the servlet in tomcat??
How to package a project and install in tomcat webapps?