The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
December 2000



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.



Posted by R.VENKATASUBRAMANIAN on December 22, 2000 at 6:26 AM

1. See the spelling mistake in "package"

2. put it in a directory called package1

3. come one directory previous to that

4. compile like javac mypackage\

5. Run it from there itself.

6. It will absolutely works inspite of classpath and all.

7. For this the most important thing is in CLASSPATH there must be one . in the CLASSPATH. That . denotes for the current directory. If you include that , then the VM will take the classpath from there itself. O.K.

ie. CLASSPATH=.;C:\JDK1.2.2\LIB\tools.jar

like that.
This is clearly because of the namespaces in the java.

Are you clear.

Thanx and Regards
> There are two files
> This is first file
> pacakge package1;
> public class Box {
> public Box(int a, int b){
> int len = a;
> int wid = b;
> }
> }
> I stored this file in package2 directry
> Then next file is

> package package2;
> public class Test {
> Box box= new Box(2,4);
> }
> I stored this also in package2 directry. Then I compile first one
> no error message.But when compiling second one the error message is
> "class package2.Box not found"
> I couln't find the reason. If you know please tell me
> Thank you


Sponsored Links

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