• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Tomcat can't find my class files

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to the Tomcat forum.
 
Did Steve tell you that? Fuh - Steve. Just look at this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic