I'm trying to deploy a small console-based program I've been working on as an executable Jar file. I made sure the Manifest file specified the Main-Class, so it should run automatically. There's no GUI, it just uses the console. Good old Scanner
and System.out.println
sort of stuff. When I double-click the Jar file, the console flashes but closes immediately.
To be sure it wasn't something wrong with the program itself, I retried with the simplest program I could think of. I'll include code below, but it's nothing special. I included a Scanner.next()
call to make sure the console should stay open until I give it input, but it's still not running.
I also tried launching the Jar from the command line. java -jar Deploy.jar
works just fine. But I want to be able to run it with a double-click, without having to open the command line or an IDE. Am I missing something?
Deploy.java
import java.util.Scanner;
public class Deploy {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.println("Hello World!");
s.next();
s.close();
}
}
MANIFEST.MF
Manifest-Version: 1.0
Main-Class: Deploy
(Yes, I've got carriage returns at the end of my Manifest)