I can't run JAR file?

I have created a Java JAR file in NetBeans. I have already run clean and build on the program and everything was successful. When I run the program in NetBeans is also successful, but when i locate the JAR file in the NetBeans dist folder and run it, nothing happens. The program doesn't run, and there are no exceptions or messages. Could you please help me understand why.

EDIT: I already solved the problem.

Upvotes: 0

Views: 4247

Answers (3)

Kamal
Kamal

Reputation: 1122

Are you trying to make executable jar ? You might wanna put your main class in manifest of the jar file.

Something like :

Main-Class : file_name_with_main_method

Upvotes: 1

paulsm4
paulsm4

Reputation: 121609

It sounds like you're probably on Windows :)

One way to "run" a .jar file is to create a Windows File association for ".jar" suffix and the "javaw.exe" command:

1) Go into Windows Explorer and [Browse...] to your .jar file

2) Right-click the .jar file, and select the "open with..." option.

3) Select javaw.exe as above, and see if it runs.

Upvotes: 1

CodeGuy
CodeGuy

Reputation: 28907

I would suggest checking the Console if you are on a Mac. You can view errors from the Jar launch to understand why it failed.

Upvotes: 0

Related Questions