avatar
b*e
1
I have put several java classes in a Jar file, one class
is the main entry, so I also put the main class information
in the manifest file.
However, when my class call j2ee classes (say java mail class),
"java -jar xyz.jar" always report can't file class error,
even i put -classpath c:\j2eeinstalpath\lib\j2ee.jar in the command.
There is no problem if i don't use jar file at all.
I wonder if this is the limitation of Jar? Thanks.
avatar
g*g
2
Did you put . there with your cp?

【在 b*e 的大作中提到】
: I have put several java classes in a Jar file, one class
: is the main entry, so I also put the main class information
: in the manifest file.
: However, when my class call j2ee classes (say java mail class),
: "java -jar xyz.jar" always report can't file class error,
: even i put -classpath c:\j2eeinstalpath\lib\j2ee.jar in the command.
: There is no problem if i don't use jar file at all.
: I wonder if this is the limitation of Jar? Thanks.

avatar
b*e
3
i did set all the classpath including '.'.
And i ran the unjarred program without any problem.

【在 g*****g 的大作中提到】
: Did you put . there with your cp?
avatar
g*g
4
Well, maybe you put the exception here, which class is not found?

【在 b*e 的大作中提到】
: i did set all the classpath including '.'.
: And i ran the unjarred program without any problem.

avatar
b*e
5
say if my main class name is SendEmail.java, there are
also other small clases. This SendEmail.java imports
javax.mail which is a part of j2ee.
if I don't jar all the classes. I use
% java SendEmail
at the command line, everything works smoothly.
However, if I jar everything in one SendEmail.jar, when I use
% java -jar SendEmail.jar
or
% java -classpath (path of j2ee) -jar SendEmail.jar
it will report run-time error, such as javax.mail.Address not found.

【在 g*****g 的大作中提到】
: Well, maybe you put the exception here, which class is not found?
avatar
b*e
6
OK. After searching google, i've found the answer.
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。