-2

Many java developers face CLASSPATH issue.Let me know why CLASSPATH is important in java applications including desktop , web and mobile.

Sai Ye Yan Naing Aye
  • 6,622
  • 12
  • 47
  • 65
  • 1
    "Face classpath problems"? Really? Maybe you could be a bit more specific about what kind of problems they face? – Fredrik Aug 27 '12 at 11:18
  • 2
    My first guess is understanding it at all. Sounds too much like a homework question to me. Voting to close and down voting. – duffymo Aug 27 '12 at 11:19
  • @Fredrik Type the word "Classpath" into Stock OverFlow's search box> You must see many classpath problems.So can I ask this question? – Sai Ye Yan Naing Aye Aug 27 '12 at 11:23
  • @duffymo Can I ask the question what i really want. Stack OverFlow said Q&A site for all. – Sai Ye Yan Naing Aye Aug 27 '12 at 11:24
  • 1
    @SaiYeYanNaingAye I don't really need to search to prove anything. Out of all the questions on Stack overflow regarding Java, I would say questions about classpath is a minority. – Fredrik Aug 27 '12 at 11:28
  • Easy duplicate: http://stackoverflow.com/questions/2396493/what-is-a-classpath-confused-and-need-a-human-touch-to-understand – Shafi Aug 27 '12 at 11:52

2 Answers2

3

In Java, classes are loaded as needed while a program runs. The classpath is a list of locations (directory or JAR files) in which the JVM will look for classes to load. If a class to be loaded cannot be found, there will be an error and the program may abort.

Thus, the contents of the classpath are very important, and since it can be configured in a number of ways (the environment variable CLASSPATH is not recommended nowadys), some of them quite complex, there are often problems with a missing or incompletel classpath, especially in server applications.

Michael Borgwardt
  • 342,105
  • 78
  • 482
  • 720
2

Whenever you are using third-party libraries, you need to put them into your program's classpath. Otherwise your code will not be able to find the classes it needs from the third-party libraries. There are several ways to specify the classpath, but this is not the point of the question.

Dan D.
  • 32,246
  • 5
  • 63
  • 79
  • More importantly, there are many ways to forget to specify the classpath, or to override the correct classpath with an incomplete one, which leads to the issues that are faced. – Cephalopod Aug 27 '12 at 11:21