File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Importing a user-defined class " Watch "Importing a user-defined class " New topic

Importing a user-defined class

Sara Tracy
Ranch Hand

Joined: Jan 06, 2006
Posts: 45

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
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63865

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] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Importing a user-defined class
It's not a secret anymore!