The first problem is the package declarations. Your declarations need to reflect the entire structure.
for class A
package a;
for class B
package a.b;
for class C
package a.b.c;


The second problem is that your imports need to reflect the entire structure, for example, class A should import B like this
import a.b.B;


and class B should import C like this
import a.b.c.C;

J

At 08:01 AM 2/26/2005, you wrote:

--- Jonathan  Boutelle <[EMAIL PROTECTED]> wrote:

> com.rsx.A.B.file two.java should have
>
> "import com.rsz.A.B.C.file three"
>
> The package statement for each file should reflect
> the package it is
> actually a member of:
> (e.g. for  file two, com.rsz.A.B, etc.)
>
> Hope that helps,
> -J
hi i got this...
------------------CLASS_A--------------------------
import b.*;


class A

{
        public static void main(String args[])
        {
                System.out.println(">In a");
                B bob=new B();


} }

------------------CLASS_A--------------------------

||||||||||||||||||CLASS_B|||||||||||||||||||||||||||

package b;

import c.*;

public class  B

{
        public B()
        {
                System.out.println(">In b");

                        C.test();

        }
}


||||||||||||||||||CLASS_B|||||||||||||||||||||||||||

******************CLASS_C***************************
package c;

public class  C

{
        public static void test()
        {
                        System.out.println("in c");
        }

}

******************CLASS_C***************************

apologies for modifying the original assumed example
from one.two,three to A,B,C

the directory hierarchy goes like this..
Top most directory a has directory b and file A.java
Next directory b has directory c and file B.java
the final directory c has file C.java

                           a
                          / \
                         b  A.java
                        / \
                       c  B.java
                      /
                    C.java

small letters are directories.

i get the following at runtime...

==================RUNTIME======================
>In a
>In b
java.lang.NoClassDefFoundError: c/C
        at b.B.<init>(B.java:12)
        at A.main(A.java:10)
Exception in thread "main"
Output completed (0 sec consumed) - Normal Termination
==================RUNTIME======================

kindly help and point any (silly)mistake.

thanks & regards,
rohit.

=====
NAMASTE, i honour the spirit in you which is also in me.
```````````````````````````````````````````````````````
http://www.geocities.com/rohitsz2

|Anytime you feel i need to understand|
|a concept before i am eligible to get|
|an answer i would be happy to know.  |
^*************************************^



__________________________________
Do you Yahoo!?
Yahoo! Mail - 250MB free storage. Do more. Manage less.
http://info.mail.yahoo.com/mail_250

_______________________________________________
Java mailing list
[email protected]
http://mail.jug-delhi.org/mailman/listinfo/java_jug-delhi.org

----^-------^------^--------^-------^ Jon Boutelle Principal, Uzanto Consulting San Francisco, CA

Phone: 510-708-9825
urls: www.uzanto.com
www.jonathanboutelle.com
----^-------^------^--------^-------^



_______________________________________________
Java mailing list
[email protected]
http://mail.jug-delhi.org/mailman/listinfo/java_jug-delhi.org

Reply via email to