Actually, as I understand it, "packages" is just a directory containing
the packages. It is not part of the package arborescence. If "MyClass"
is in the package "pakage_one" as it is declared, then the import
should be "import pakage_one.*;" or "import pakage_one.MyClass;".
However, in order for this to work, the directory "packages" must be in
the classpath (check the classpath environment variable and the
-classpath command line option to the java command).
Hope this helps.
jalkadir - 18 Aug 2005 14:19 GMT
Thank you all, for your prompt response.
Before I go any further, I would like to give more information about
what I am doing.
Files and Dir_Tree:
~~~~~~~~~~~~~~~
*Top_Directory
...\java
*Subdirectory or Library
...\java\jaa
*Files
'..\java\AlBuraqRunner.java'
'..\java\AlBuraqRunner.class'
'..\java\Jamiil.java'
'..\java\jaa\Jamiil.class'
This the code:
~~~~~~~~~~~
package jaa;
public class Jamiil{
private String name;
private int age;
public Jamiil(){
name = "Jamiil";
age = 11;
}
public String getName(){return this.name;}
public int getAge(){return this.age;}
}
import jaa.*;
public class AlBuraqRunner
{
public static void main(String args[])
{
System.out.println("Sabron Jameel");
Jamiil obj = new Jamiil();
//System.out.println("My name is: " + obj.getName());
}
}
Now, the problem is that after I type:
javac -g AlBuraqRunner.java
I get an error message that reads:
AlBuraqRunner.java:7: cannot access Jamiil
bad class file: c:\jamiil\dev\java\java\Jamiil.class
class file contains wrong class: jaa.jamiil
Please remove or make sure it appears in the correct subdirectory of
the classpath.
-----
I don't understand the message, what am I doing wrong?
Thanks in advance
Shorty - 19 Aug 2005 13:03 GMT
Isn't there some confusion in your directory names ?
between
'..\java\jaa\Jamiil.class'
and
' bad class file: c:\jamiil\dev\java\java\Jamiil.class '
is Jamiil.class in java\jaa or java\java ?
jalkadir - 20 Aug 2005 12:01 GMT
Oops, sorry. <:)
the line should be
' bad class file: c:\jamiil\dev\java\jaa\Jamiil.class'
Thanks
Andrew Thompson - 20 Aug 2005 12:12 GMT
> Oops, sorry. <:)
> the line should be
> ' bad class file: c:\jamiil\dev\java\jaa\Jamiil.class'
You seemed to take a great deal of effort earlier to
be accurate, so here is a tip that might help both you
and anybody trying to help.
Output can be copied directly from the Windows CLI
be dragging the mouse pointer across the text and
pressing the 'enter'[1] key.
Done.
[1] <http://www.physci.org/kbd.jsp?key=enter>
HTH

Signature
Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
"If I could find the reason, I'd know the answer why"
Status Quo 'Gerdundula'