The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
April 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.


Packages - Accross Files

Posted by karthik on May 18, 2000 at 10:57 PM

I have small program which has a base class (class name: "base"), with a defualt constructor wich just prints base's member variable. The scope of this class and the constructor is "Public". I create this in a package "MyPack" and save in a file called
I have a different file called which imports the package "MyPack" and it derives from class base. In this class i just print the value of base class value.
I have a third file called "" which has the main method creating an object of the derived class.
Now i store these 3 files in a directory c:\test\*.java
I want to compile these 3 files and put the resulting .class files in the directory c:\test\MyPack.
The problem i'm facing is : the first file gets compiled and puts the base.class file in
c:\test\MyPack\base.class. Now while compiling, it gives a error that the "base class is not found".

i compiled like :c:\test\> javac -d c:\test\MyPack\

I tried with -classpath option also. It's still giving the same error. How to compile this and what could be reason for the error?


Sponsored Links

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