java - Runnable Jar file is not running on double click -


i have simple java project, has file input.java. code input.java goes -

package com.src.functionalities;  import java.util.scanner;  public class input {      public static void main(string[] args) {         // todo auto-generated method stub         scanner reader = new scanner(system.in);  // reading system.in         system.out.println("enter number: ");         int n = reader.nextint(); // scans next token of input int.         system.out.println("you have provided : " + n);      }      } 

now, have created executable jar file in eclipse export -> jar -> executable jar file , named jar file test.jar.

now, when try open via command prompt, works fine.

java -jar test.jar 

but, expecting open command prompt when double click on runnable jar file. problem here?

thanks!

that because jvm expects app have gui, app strictly console app. if don't have gui, nothing happens, since jvm not invoke windows console.

either make batch file jar or can software distributes java applications exe file, doing batch file you, install4j.


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -