hi all i have a little problem in referenceing packages
I have the following classes
when i compile first class...it compiles fine..
but when i compile the second class...it cannot find the package one.
both my classes are in same directory...and i have included the directory in PATH variable...and iam using vista ...
Shouldn't the two classes be in separate directories? One package class in the one directory, and the two package class in the two directory.
Remember, the term package is just a Javaesque name for a folder. If two classes are in two different packages, that means they are in two different folders, with the folders nested in the same manner that the package is delineated with periods or 'dots.'
Joined: Mar 30, 2007
thanks a lot for the early reply...
ok....as you suggested i just created a folder called java -- and two sub direcories one and two
and B throws the same error...and says package one does not exists....
The other thing to keep in mind is that the classpath specifies the root of the classes -- and if you don't specify a classpath, it assumes the current directory is the root. So... you need to compile from the root directory...
> cd Desktop/java
Desktop/java> javac one/A.java
Desktop/java> javac two/B.java
[And by root directory, I mean the root of the java classes -- not the unix root directory]