Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

class path(?)

  Asked By: Pamela    Date: Jan 29    Category: Java    Views: 637

Who uses JBuilder9(personal)? I download jakarta-servlet (lastest
one) and try to write a servlet. When editing project properties -
required libraries, I am not sure what should be added and what
should not. In the end I added all the paths JBuilder can see under
that jakarta-servletapi-4 directory. It works but sure it is not the
proper way... I dont understand this, then I dont understand how to
work with 3rd party packages..



3 Answers Found

Answer #1    Answered By: Felicia Hill     Answered On: Jan 29

Configuring classpath's and configuring software in general is always
a bloody mess for some reason.

I think most just "kick against the box" until things work. Some have
a clear understanding how any why things are working and can fix up
any server's configuration issues no problem. Most, however, don't
know what they're doing because they only way they know how to fix it
is by slapping classpath's left and right until things appear to work.

I would really carefully think about what each component and classpath
is there for. Which one where and why.

For instance, your servlets' code should *not* be part of any
classpath! The app server constructs its own classpath and loads your
servlet through it. This is important so that it can control which
servlets gets which classes and libraries. It can also reload updated
servlets this way.

Normally, it's all about what you have sitting in your ear file.
Usually you either have a war or ear file. They're all zip type
compressed archives. A war sits inside an ear. An ear contains a jar
with the session and entity beans if you have them. The war contains
your web files, and the classes of your servlets.
There are no classpath explicitly expressed to make the app server
find your classes, the app server figures that out and makes its own

Have you tried dropping your war or ear file in JBoss or Tomcat and
see if things deploy properly?

I know configuring can be a huge headache. Don't give up. Learn from
books. Beware of crappy and uninformative books, find better ones.
Find fully functional samples. Once you master all this configuring
crap, they can really paint the town with J2EE.

Answer #2    Answered By: Corinne Rogers     Answered On: Jan 29

A1mint was onto a few good points, I thought I would jump in with some
more stuff.

Answer #3    Answered By: Agatha Miller     Answered On: Jan 29

The other guys were slightly right. You don't need the servlet  api lib
to run a servlet, but you sure as hell need it to compile a servlet.
The jar you should include in your project  lib path  is usually called
servlet,jar (you should find it in thejakarta-servletapi-4/lib directory.
It's best to use the same version of servlet api to compile with as you
will deploy with, just to avoid confusion.
If you are using tomcat - the servket api lib will be in

Didn't find what you were looking for? Find more on class path(?) Or get search suggestion and latest updates.