b*e 发帖数: 3845 | 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. | g*****g 发帖数: 34805 | 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.
| b*e 发帖数: 3845 | 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?
| g*****g 发帖数: 34805 | 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.
| b*e 发帖数: 3845 | 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?
| b*e 发帖数: 3845 | 6 OK. After searching google, i've found the answer. |
|