Open a command line window, go to the directory where your JAR file is located at, and execute java -jar XXX.jar. This will show you the exception stack trace that's being suppressed when you double click the JAR file.
Campbell Ritchie wrote:No longer a “beginning” question. Moving.
I had tried it, but it still cannot,
here the results :
D:\javacourse>java -jar HelloWorldSwing.jar
Exception in thread "main" java.lang.NullPointer.Exception
at sun.launcher.LauncherHelper.getMainClassFromJar(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
I am also working on jar files with my application. As far as I understand it, the JVM needs to know which class holds the main method. Have you done this?
You do this by including a manifest.txt file which holds an entry like this
Source [0]
This is one way of setting the entry class. You can also do it when you create the jar file. When you pass e when creating the jar file, it points to the entry point in your application:
@Gong - Did you copy the Exception the same way. I see a "." between the NullPointer and Exception strings. Was the line of code that created listed in the trace?
Exception in thread "main" java.lang.NullPointer.Exception
gong pex
Ranch Hand
Joined: Oct 27, 2011
Posts: 32
posted
0
Adam Cripps wrote:I am also working on jar files with my application. As far as I understand it, the JVM needs to know which class holds the main method. Have you done this?
You do this by including a manifest.txt file which holds an entry like this
Source [0]
This is one way of setting the entry class. You can also do it when you create the jar file. When you pass e when creating the jar file, it points to the entry point in your application:
Adam Cripps wrote:I am also working on jar files with my application. As far as I understand it, the JVM needs to know which class holds the main method. Have you done this?
You do this by including a manifest.txt file which holds an entry like this
I had create it on notepad like this:
I think it may be important that Adam suggested your manifest should contain a "Main-Class" entry, but your manifest doesn't. It contains a "Main-class" entry, which might well be considered as different. Unless perhaps case isn't significant -- the tutorial would certainly say so, if that's the case. Does it?
gong pex
Ranch Hand
Joined: Oct 27, 2011
Posts: 32
posted
0
Paul Clapham wrote:
gong pex wrote:
Adam Cripps wrote:I am also working on jar files with my application. As far as I understand it, the JVM needs to know which class holds the main method. Have you done this?
You do this by including a manifest.txt file which holds an entry like this
I had create it on notepad like this:
I think it may be important that Adam suggested your manifest should contain a "Main-Class" entry, but your manifest doesn't. It contains a "Main-class" entry, which might well be considered as different. Unless perhaps case isn't significant -- the tutorial would certainly say so, if that's the case. Does it?
I had tried to repair based on Adam's advice but the results still same, I don't know what I must do ___________________________________________________________________________________
Today I had tried to convert .java file to .exe file using iexpress
because I had despair to tried using .jar (because always failed)
but the results it's same too, even my computer is stuck,
can someone tell me how to convert it?(I hope I can use free software)
Thanks
Tim Moores
Rancher
Joined: Sep 21, 2011
Posts: 2407
posted
0
Does that mean you tried to fix it along the lines of what Paul suggested, or does that mean you determined that that would not make a difference?
gong pex
Ranch Hand
Joined: Oct 27, 2011
Posts: 32
posted
0
I understand what Paul meant,
Thanks for answer
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.