Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Importing a user-defined class

 
Sara Tracy
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65105
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic