0

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]);
        }

    }
}
SeHoon
  • 11
  • 3
  • Try to run it using command line. – Neeraj Benjwal Oct 14 '20 at 09:33
  • The reason is obvious: The application runs, executes the code (for-loops, printing out) and terminates since there is no infinite while loop with a condition to break. The execution is so fast that it happens in the blink of an eye and looks like it is turned off immediatelly (which acutally is). Very simply said: the computation is done, the program finishes, there is nothing to keep the program open. – Nikolas Charalambidis Oct 14 '20 at 10:03
  • Thanks everyone. I solved it. "The execution is so fast that it happens in the blink of an eye and looks like it is turned off immediatelly". In my opinion, it might not be visible even for a moment. – SeHoon Oct 14 '20 at 10:35

1 Answers1

1

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.

Vladimir Stanciu
  • 1,468
  • 1
  • 7
  • 24