The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
November 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Re: Classpath Problem

Posted by Brian Sanders on November 20, 2001 at 9:21 AM

My Directory structure is as follows

root
-----pack1
-----pack2

i added the following in the classpath


d:\root\pack1;d:\root\pack2

Add d:\root (not d:\root\pack1;d:\root\pack2) to your classpath. With the JDK, your package statements and directory structure are interrelated. When trying to find your class "pkg2.SUBCLASS", the compiler will look in each of the directories in your classpath for a subdirectory matching the package name of the class. In this case, it looks for a subdirectory called "pkg2". If your class was in the package "com.artima.foobar", it would expect you to have the directory structure "com\artima\foobar".

Take a look at any of the .jar or .zip files in your classpath, and you'll see that the directory structure within these compressed files matches the package structure as well.



Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us