Why code never ends which contains EventQueue.invokeLater?

54 Views Asked by At

I have a main class : MyMainSDK

public static void main(String[] args) { 
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    MyMainSDK frame = new MyMainSDK();
                    frame.setVisible(false);
                    System.out.println("f1"); 
                } catch (Exception e) {
                    System.out.println("Error: " + e.getMessage()); 
                    e.printStackTrace();
                }
                System.out.println("f2"); 
            }
        });


    System.out.println("f3"); 
    }

and my class is:

    public MyMainSDK() {


           /*

             do something

                System.out.println("do something logs"); 

            */

       System.out.println("everything is finished"); 

 }

I run my java code on batch file. It works what I expect .

But the batch file seems it is not finished. But I see these logs:

f3
do something logs
f1
f2

how can I solve this?

thanks in advance

0

There are 0 best solutions below