my dog learned polymorphism
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Setting Classpaths Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Setting Classpaths" Watch "Setting Classpaths" New topic

Setting Classpaths

Robert Gordon

Joined: Jul 17, 2002
Posts: 2
I`m develloping a servlets that uses the jini
service. When i run the servlet (connecting from a remote browser to the
Apache HTTP server where my servlet is running) the jini service doesn`t
work. I suppose it happens because I`m not able to set classpath for
servlets; In fact if I use the same jini service from command line
(using java -cp .... filename.class )
it works well.
How can I set classpath for servlets using Apache HTTp server?
Carl Trusiak

Joined: Jun 13, 2000
Posts: 3340
Apache itself can not run servlets. You need an external servlet runner such as Tomcat, Resin, JRun etc. and configure a connector between Apache and the servlet runner. This is different for each servlet runner and connector, as is setting the classpath for it. Consult the documentation for your servlet runner to determine how to do these tasks.

I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
Frank Carver

Joined: Jan 07, 1999
Posts: 6920
I'm also a bit worried by the use of Jini in this question. Is the code in your jar file really a Jini "service", or some client code which looks up and uses a Jini service on a network.
If your jar is the actual service, then I'm not sure calling it directly from a servlet makes much sense. If your jar is some Jini client code, you may have other network issues besides the classpath to worry about. Is the server machine normally part of the Jini network?

Read about me at ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
rajesh karmani

Joined: Jun 26, 2001
Posts: 23
Everything in use by a servlet must either be in the WEB-INF\lib or WEB-INF\classes folder. These are the default classpath in case of any servlet container and we cant configure it to use classes outside these folders
Rajesh Kumar
(SCJP2 - 90%, SCWCD 93%, UML 79% , J2EE 89%)
I agree. Here's the link:
subject: Setting Classpaths
jQuery in Action, 3rd edition