| Author |
Package woes
|
Cathy Song
Ranch Hand
Joined: Jul 01, 2003
Posts: 92
|
|
I have 2 classes(A, B) in a package. -->lev1.lev2.lev3; So, I created 3 directories lev1, lev2 and lev3 and placed my classes in lev3. package lev1.lev2.lev3; class A { public static void main(String[] args) {} } package lev1.lev2.lev3; class B { } Now when I run A.class, I get the followign error: java.lang.NoClassDefFoundError: lev1/lev2/lev3/A Please help!! -Cathy.
|
 |
Blake Minghelli
Ranch Hand
Joined: Sep 13, 2002
Posts: 331
|
|
To run a class defined in a package, the root directory must be included in your classpath. For example, if you have the following structure: Then the root directory "projects" must be in your classpath and you need to execute the program using the fully-qualified name: e.g. "java lev1.lev2.lev3.A"
|
Blake Minghelli<br />SCWCD<br /> <br />"I'd put a quote here but I'm a non-conformist"
|
 |
 |
|
|
subject: Package woes
|
|
|