由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - Jar question
相关主题
问个run java file 的问题java inner class - 初学者问
How to import a class?Re: [转载] Re: .jar文件是怎么产生的?
[转载] Urgent Help needed about Java Servlet?新手问一个:如何找.jar文件里都有什么class?
系统classHow to use classes in a jar file?
为何运行JAVA出现这个错误?Can I find the classes relationship
Help!: tomcat classloading problem[转载] 有用Eclipse的嘛?
Re: Help!: tomcat classloading probleminner class 让认糊涂
weird class definition问一简单的问题 关于import
相关话题的讨论汇总
话题: jar话题: class话题: java话题: put话题: file
进入Java版参与讨论
1 (共1页)
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.
1 (共1页)
进入Java版参与讨论
相关主题
问一简单的问题 关于import为何运行JAVA出现这个错误?
multiple classes in one file:revistedHelp!: tomcat classloading problem
入门Java CLASSPATH问题: Re: Help!: tomcat classloading problem
jar file questionweird class definition
问个run java file 的问题java inner class - 初学者问
How to import a class?Re: [转载] Re: .jar文件是怎么产生的?
[转载] Urgent Help needed about Java Servlet?新手问一个:如何找.jar文件里都有什么class?
系统classHow to use classes in a jar file?
相关话题的讨论汇总
话题: jar话题: class话题: java话题: put话题: file