This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Tomcat and the fly likes Importing a user-defined class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Importing a user-defined class " Watch "Importing a user-defined class " New topic
Author

Importing a user-defined class

Sara Tracy
Ranch Hand

Joined: Jan 06, 2006
Posts: 45
Hi!

I'm using Oracle's JDevloper for writing programs, and deploying it to Tomcat. I have deployed a web application which is in package "aa.mypacakge". I have also written an encryption program, and this class "enc.class" will be accessed by anybody in our team. Even my program needs to access this class file.

So where should I place it in the Tomcat directory (on the server)? Is it in Tomcat\common\classes ? And how do I have to access it from my program which is calling this class ? Is it

import common.classes.enc;

Any help appreciated
Sara
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60741
    
  65

If the classes are specific to your application, place them in the hierarchy rooted at WEB-INF/classes.

If you want them to be shared across all web apps (be sure that's what you want -- you will be unable to have separate apps use different versions of the classes if you share), place the classes in a jar file and place it in Tomcat's shared/lib folder.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Importing a user-defined class
 
Similar Threads
a servlet which have to access Microsoft access
Class Not found!
how to set the class path for tomcat?
load a class in already running tomcat
Problem accessing Database from JSP