The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
December 2000

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:

package Reply

Posted by Pritpal Singh on December 20, 2000 at 2:39 AM

problem is you are not following the proper package hierarchy

The Second file should be placed inside a folder package2 (in case of windows)then only it will compile and box.class should also be placed in package1 folder which itself lies in package2 folder
hence
Package2 folder(which is in classpath)
contains a) Test.class
b) Folder Package1 which itself has Box.class


bye


> 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






Replies:
  • Thankyou siva December 20, 2000 at 5:11 AM (0)
  • Thankyou siva December 20, 2000 at 5:09 AM (0)

Sponsored Links



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