Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tomcat can't find my class files

 
Keith Walters
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to the Tomcat forum.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic