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 JSP and the fly likes Making things work... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » JSP
Bookmark "Making things work..." Watch "Making things work..." New topic

Making things work...

George Larry
Ranch Hand

Joined: Nov 07, 2001
Posts: 52
I need some help setting things up. Can someone please either explain how- or point me in the direction of some basic, direct documentation that can show me how to (I'm using Tomcat 4.01):
1. Run my application from somewhere other than ..\examples\jsp\..
2. Let me call my application from the browser with a URL that I set- something other than localhost:8080...
3. My beans aren't working and I think it's because I need to change my CLASSPATH. I tried changing it in my autoexec.bat file, but no matter what I do Tomcat always starts up 'Using CLASSPATH: C:\Tomcat\bin\bootstrap.jar;C:\jdk\lib\tools.jar. How can I tell it to look for my classes where I want to put them?
Thank you.
rom chatterjee
Ranch Hand

Joined: Dec 11, 2001
Posts: 46
You may like to know that the documentation for Tomcat can be downloaded at It will help you a lot in your developing.
In brief the first 2 question refer to the server.xml file this describes Tomcat the server.
1.Run my application from somewhere other than ..\examples\jsp\..
Edit the <tomcatHome>/conf/server.xml file for every new web application you build add the following before the closing </host> tag:

The path refers to the URL ie http://localhost:8080/myApplication. The docbase can be relative or full path to your first page/file (usually index.html/htm/jsp)
2. Let me call my application from the browser with a URL that I set- something other than localhost:8080...
Open the server.xml file as above and search for 8080. Youll soon find the tag containing the port number.
3. My beans aren't working and I think it's because I need to change my CLASSPATH.
Check the documentation, but for a quick fix place any jar files in your <tomcatHome>/lib directory. I believe that the proper way is to have your own lib directory within your docBase (see above)
Hope this helps

Rom Chatterjee<BR>Sun Certified Java Programmer
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17033

Depending on whether you're using Tomcat 3 or Catalina (Tomcat 4), the exact set of rules for classpaths is slightly different, but normally beans are going to be part of your specific web app, and that part is the same for all recent Tomcats and J2EE-compliant servers in general.
If your bean is in loose class files, place the classes in WEB-INF/classes. This is automatically added to the app's CLASSPATH. The same rules about directory structure and filename capitialization apply as they would for any Java app.
If the beans are in jars, add the jarfiles to the WEB-INF/lib directory. Each jar will be added to the CLASSPATH for that web app.

An IDE is no substitute for an Intelligent Developer.
Arun Boraiah
Ranch Hand

Joined: Nov 28, 2001
Posts: 233
all you have to do is
create a folder name of your choice inside <tomcat root>/webapps/new folder name
map this folder name side the server.xml file found inside <tomcat root>\conf\server.xml i.e,
add this line
<Context path="/NEW FOLDER NAME" docBase="webapps/NEW FOLDER NAME" crossContext="false" debug="0" reloadable="true"/>
also you have to place folder named WEB-INF inside you new folder and inside web-inf folder place a folder called 'classes' inside classes folder place your servert and beans and helper classes of need for your purpose.
one more thing place web.xml file (you can get this file inside example\web-inf folder). This file is used for your servlet regester.
if you want change the port insted of 8080 your can do by changing the port number in server.xml(replace 8080 found in xml to port of your choice0
also you need not refer with localhost you can call by the ip of your system (like http://ipaddress ortnumber).
regarding classpath simple suggestion would be append to the existing classpath in the command prompt you running which is used to run tomcat. This will not effect another application using classpath set by the systme.
[ January 25, 2002: Message edited by: arun boraiah ]

Sharing is learning
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Making things work...
It's not a secret anymore!