File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes class path Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "class path" Watch "class path" New topic
Author

class path

sangeeta reddy
Greenhorn

Joined: Jul 26, 2008
Posts: 1
how and where to set the classpath
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

Originally posted by sangeeta reddy:
how and where to set the classpath


For servlets this is server dependent for general classpath settings. Generally, however, all your classes should go into your web application's WEB-INF/classes/ directory and your JAR files should go into the context's WEB-INF/lib/ directory. If you have classes/jars in other places it is usually a better idea to move or copy them to the above mentioned places.


Steve
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61654
    
  67

Originally posted by sangeeta reddy:
how and where to set the classpath
You do not set the classpath for web applications. As was pointed out, web containers look for classes in specific locations and not along any classpath.

Or perhaps your question was incomplete?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3855

Generally, however, all your classes should go into your web application's WEB-INF/classes/ directory and your JAR files should go into the context's WEB-INF/lib/ directory


Is this mean say for example if we refer EJB from a servlet that ejb-jar should goes in to the above directory? We can put the ejb-jar with the WAR file which includes the servlet etc.. and deploy it in the container as an EAR file right?

Thanks in Advance,


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2716
    
    6

Hi sangeeta reddy welcome to Javaranch
Firstly UseAMeaningfulSubjectLine. class path makes little sense.

Then tell us a little more detail about your problem. For what purpose are you setting the classpath. The posters above have assumed that you need it for a web application.
Is it what you are really trying to do?


SCJP, SCWCD.
|Asking Good Questions|
sudhir nim
Ranch Hand

Joined: Aug 29, 2007
Posts: 212

If you are talking about just CLASSPATH but not in terms of web applications, On windows platform it is set as environment variable.

Look at http://www.jsptube.com/Servlet-Tutorials/setup-servlet-development-environment.html


[Servlet tutorial] [Servlet 3.0 Cook Book]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: class path