1

I have to hand in an assignment that says:

'If you have correctly created an executable jar, then you will be able to double-click on it in Windows to run your program. Please ensure you test this before sending.'

My program doesn't have a user interface and runs in command. When I double click on the .jar nothing happens, what can I do?

  • In the manifest file specify the main class. Google for it because I am lazy now. – SJuan76 Oct 29 '12 at 23:07
  • It is unusual to require a runnable Jar when there is no GUI. One of the reasons is that if the user double clicks the Jar, they will not have an opportunity to provide more input, or see the output. – Andrew Thompson Oct 29 '12 at 23:27

2 Answers2

0

Even if your program is command line based, it will launch a console/terminal window for the program execution. If your program does not prompt for input then it may be opening and exiting so quickly that you don't notice the console window flash on screen.

Try opening a command prompt and running java manually via:

java -jar <your jar>

If that doesn't work, then you do not have an executable jar with a MANIFEST.MF that specifies the Main-Class.

Tim Bender
  • 20,112
  • 2
  • 49
  • 58
0

Start -> Accessories -> Console

On your console

java -jar "C:\your-directory\for\your\java-jar-\application.jar"

EDIT

Try this:

Change the open with program to c:\Program files\java\jre7\bin\javaw.exe

Extracted from this question: Make an executeble JAR run in a console when double clicked

Community
  • 1
  • 1
Bruno Vieira
  • 3,884
  • 1
  • 23
  • 35