Redian新闻
>
another question driving me crazy...
avatar
another question driving me crazy...# Java - 爪哇娇娃
q*c
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).
avatar
g*s
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).

avatar
r*l
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).

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。