q**c 发帖数: 179 | 1 say I have two packages B and C put as
in the directory /A/B and /A/C. The classpath is set as /A.
so when compiling them, no problem at all.
Now have a test class named Cplot.class in /A/C.
When run it, it gives message:
"Exception in thread "main" java.lang.NoClassDefFoundError: Cplot".
I find since classpath is set as /A, java cannot find this Cplot.
So I add /A/C to the classpath, but it gives message:
"Exception in thread "main" java.lang.NoClassDefFoundError: Cplot (wrong name:
A/C/Cplot). | g*s 发帖数: 2277 | 2 make Cplot.java as one class in package C
and run "java C.Cplot"
【在 q**c 的大作中提到】 : say I have two packages B and C put as : in the directory /A/B and /A/C. The classpath is set as /A. : so when compiling them, no problem at all. : Now have a test class named Cplot.class in /A/C. : When run it, it gives message: : "Exception in thread "main" java.lang.NoClassDefFoundError: Cplot". : I find since classpath is set as /A, java cannot find this Cplot. : So I add /A/C to the classpath, but it gives message: : "Exception in thread "main" java.lang.NoClassDefFoundError: Cplot (wrong name: : A/C/Cplot).
| r*****l 发帖数: 2859 | 3 cd to /A and run it.
【在 q**c 的大作中提到】 : say I have two packages B and C put as : in the directory /A/B and /A/C. The classpath is set as /A. : so when compiling them, no problem at all. : Now have a test class named Cplot.class in /A/C. : When run it, it gives message: : "Exception in thread "main" java.lang.NoClassDefFoundError: Cplot". : I find since classpath is set as /A, java cannot find this Cplot. : So I add /A/C to the classpath, but it gives message: : "Exception in thread "main" java.lang.NoClassDefFoundError: Cplot (wrong name: : A/C/Cplot).
|
|