Search code examples
javaconsoleexejsmooth

Why does an exe file made with java immediately turn off?


I made a jar in eclipse and converted it from jsmooth to exe. The exe is created, but if I double-click it, it turns off immediately. Is my code the problem?

public class plz {

    public static void main(String[] args) {
        // TODO Auto-generated method stub

        System.out.println("Hello World!");
        for(int i = 0; i< args.length; i++) {
            System.out.format("args[%d}: %2 %n", i, args[i]);
        }

    }
}

Solution

  • Yes, it is. Your code states that it should loop through the list of arguments(which you provide when you start the application). Once this is done, the application will stop.