Hi all,
I have a program that runs in netbeans but the jar file doesn't run.
Can anyone please help... I have included the link to the project folder:
http://dl.dropbox.com/u/6917833/layo...emoProject.zip
Printable View
Hi all,
I have a program that runs in netbeans but the jar file doesn't run.
Can anyone please help... I have included the link to the project folder:
http://dl.dropbox.com/u/6917833/layo...emoProject.zip
What you mean that the JAR file doesn't run? Can you clear it more, on what it's not running?
Yes I apologize,
When I double-click the built .jar file located in the dist folder, I get the following error message.
failed to load main-class manifest attribute
I googled it and I found a solution to add a manifest.mf file to the project and follow a few more steps which allowed the program no to produce the error message however, when I double click noting happens.
-Thank you for the reply
That's because in NetBeans you don't have define the main class before build the project. NetBeans not execute the project through the IDE suing JAR files, used the *.class files. That's why your application is executed properly in NetBeans.
Right click on the project and click properties. Then define the main class in Run section of the dialog.
Yes I've done that sorry I should've reported all the steps I've taken.
I do have several main classes defined though but I'm sure I've chosen the correct main class for the run argument.
thank you again for replying.
You are welcome. Please mark the thread solved then.
You misunderstood me I've did that already but the program won't run. It's not even visible as part of my processes.
Oh, I thought you've solve the problem. Did you define the main class properly?
If so extract the JAR file and check the manifest file content.
Ok I figured out a way how to fix the problem.
Since I was double clicking on the jar file from a windows environment, I couldn't figure out the problem, but when I ran the program form cmd using java -jar, I saw I had null pointer exception thrown without handling. Thus running your program from cmd, will output the problem.
Then how it's run with the NetBeans?
It's possible if it's some resource (ie properties file) that hasn't been copied into the jar, so it would work in Netbeans but not through the jar.
OP dosen't mentioned about anything relate to that.
He doesn't mention much at all, to be honest....but that's one of the more common ways for getting an NPE in a jar when it worked fine in the IDE.
I apologize I forgot to explain in details.
I use several directories in my program and I didn't copy them in the dist folder where the .jar file was running from. Also when running from the cmd, you must travel to the dist directory and run the jar file from there where the folders are located.
Yes, you've to change the working folder path to the dist folder in command prompt to keep the folder structure in your project.