1

Suppose I made a program to take two input and display the sum. It runs in netbeans but when I build out the jar file , and double clicked the jar file , nothing happens. How can I make these program run?

3 Answers3

0

You must run this from command line, and then execute java -jar {PATH_TO_JAR}

Albert Bos
  • 2,012
  • 1
  • 15
  • 26
0

You can use the command-line :

java -jar <yourjar> <yourMainClass>

You can also add the main class in a manifest file into the jar. Doing so, you don't need to specify anymore on command line

Prim
  • 2,880
  • 2
  • 15
  • 29
0

Jar files needs to run in JVM - Java Virtual machine, to run your file use: "java -jar" and your jar. By doing so, you tell Java to run your jar in jvm which means it now can run.