Master Java Classpath(Unix, Mac OS X & Windows)
The classpath is one of the most complex and infuriating parts of the Java™ platform, but mastering it is essential to becoming a professional Java programmer. In this article, Elliotte Rusty Harold lays out the intricacies of the classpath and sourcepath and shows you how to master them on UNIX and Mac OS X. If you're using Windows, see the Java Classpath Windows article.
The classpath is the connection between the Java runtime and the filesystem. It defines where the interpreter looks for .class files to load. The basic idea is that the filesystem hierarchy mirrors the Java package hierarchy, and the classpath specifies which directories in the filesystem serve as roots for the Java package hierarchy.
Unfortunately, file systems are complex and very platform dependent, and they don't perfectly match Java packages. Consequently, the classpath has been a thorn in the side of both new users and experienced Java programmers for years. It isn't the pretty part of the Java platform. It is the annoying glitch that keeps you working well past 5 p.m., trying to debug a small problem that stubbornly refuses solution.
A good IDE like Eclipse can shield you from some of the difficulties of managing the classpath, but only somewhat, and only as long as nothing goes wrong (and something always goes wrong). Consequently, it is essential that every Java programmer fully understand the classpath. Only with in-depth understanding can you hope to debug the thorny problems that arise from the classpath.>>
The classpath is the connection between the Java runtime and the filesystem. It defines where the interpreter looks for .class files to load. The basic idea is that the filesystem hierarchy mirrors the Java package hierarchy, and the classpath specifies which directories in the filesystem serve as roots for the Java package hierarchy.
Unfortunately, file systems are complex and very platform dependent, and they don't perfectly match Java packages. Consequently, the classpath has been a thorn in the side of both new users and experienced Java programmers for years. It isn't the pretty part of the Java platform. It is the annoying glitch that keeps you working well past 5 p.m., trying to debug a small problem that stubbornly refuses solution.
A good IDE like Eclipse can shield you from some of the difficulties of managing the classpath, but only somewhat, and only as long as nothing goes wrong (and something always goes wrong). Consequently, it is essential that every Java programmer fully understand the classpath. Only with in-depth understanding can you hope to debug the thorny problems that arise from the classpath.>>

0 Comments:
Post a Comment
<< Home