This content has been marked as final. Show 7 replies
Define "crash". In what way does it fail? What error message do you get?
Does your jar file include a Class-Path header in the manifest that references the mail.jar file?
Or, have you installed the mail.jar file in the jre/lib/ext directory of the Java runtime you're using?
By crash, I mean that the javaw process halts. My application only uses JOptionPane for GUI and I haven't figured out how to redirect System.err and System.out to a JOptionPane, so I do not know what error is reported.
There is no classpath in the manifest, but I believe the mail APIs are in the right place, please see below:
If I could figure out how to redirect error output to JOptionPane, I could probably see the error thrown. I am also not able to figure out how to see the path to the java that is actually being used by the jar:
java version "1.6.0_27"
Java(TM) SE Runtime Environment (build 1.6.0_27-b07)
Java HotSpot(TM) 64-Bit Server VM (build 20.2-b06, mixed mode)
Edited by: 893531 on Oct 27, 2011 1:21 PM
To find the java that my system was using, I did the following:
This is not even a shortcut in Windows explorer. It is the actual java.exe file. Shouldn't java be in the c:\Program files\java\jdk\bin folder?
893531 wrote:Then that's your problem. The jar's manifest specifies the classpath when you run it like that. And since it's empty, the mail.jar file isn't in the jar's classpath. So when you try to use a class from it, your program fails. Fix the manifest so that mail.jar is in the classpath.
There is no classpath in the manifest, but I believe the mail APIs are in the right place
You might be getting the wrong version of "java". What does "java -version" say?
If you're getting the wrong one, try changing your PATH.
I don't remember how Windows figures out which version of "java" to use to
execute jar files, but that might be an issue too. I'm sure there's something in
the registry to map ".jar" to the program that runs it.
Thanks, following this post, I put the 5 javamail files in all my jdk and jre folders and finally found that java does not use the jdk/jre/lib/ext. Instead it uses C:\program files\jre\lib\ext.
In other words, even though I installed the jdk, Windows actually uses the jre to run files, but the IDE uses the jre within the jdk.
Right, you probably have to reconfigure that mapping in the registry.