Best way to wait for a method?

Hi, I have recently started experimenting with a making a launcher that will keep games up to date, I have gotten it working. I just want to clean it up so it works just as I want to, and one issue I have come across is waiting for the game to close before it updates. Here is the method I use to detect if the game need updating, and to queue up the flies for download.

        public List<queuedFile> checkUpdate(boolean forced){
            List<queuedFile> downloadList = new ArrayList<>();
            String sUrl = settings.readString("software.server.url", null);
            HttpRequest http = new HttpRequest(sUrl);

            for(String raw : http.send("o=version")){
                String[] data = raw.split("/");

                switch(data[0]){
                    case "file":
                        try{
                            long lastModified = TIME_FORMAT.parse(data[3]).getTime();
                            String sFile = URLDecoder.decode(data[2], "UTF-8");
                            int fileId = Integer.parseInt(data[1]);

                            if(!isOutdated(lastModified, sFile) && !forced)
                                continue;

                            if(scanner != null && !scanner.hasStopped())
                                scanner.requestStop();

                            //Why I don't use a else statement is becausae it's possible the scanner stops before this statement.
                            //And a else statement would jump over that.
                            if((scanner == null || scanner.hasStopped())){
                                downloadList.add(new queuedFile(sUrl, fileId, sFile, lastModified));
                            }
                        }catch(Exception e){
                            e.printStackTrace();
                        }
                    break;
                }
            }

            return downloadList;
        }//End of checkUpdate

The problem is that the method “scanner.requestStop();” do so the game start to close it’s loop, without force closing it. But that means the code continues after invoking that method, and does not wait for the game to close. How do I change that? BTW, “scanner.hasStopped();” checks if the game is closed.

Here is the methods that makes up requestStop()

    public void runVoidMethod(String name){
        try{
            scannerObject.getClass().getMethod(name).invoke(scannerObject);
        }catch(Exception e){
            e.printStackTrace();
        }
    }
    
    public void requestStop(){
        runVoidMethod("requestStop");
    }

Last thing, the game is in it’s own jar file, and gets loaded and started like this.

    public boolean load(File file){
        try{
            //Setup and load the class
            URL[] urls = {file.toURI().toURL()};
            URLClassLoader loader = new URLClassLoader(urls);
            Class<?> clazz = loader.loadClass("scanner.Scanner");
            scannerObject = clazz.getConstructor().newInstance();
            return true;
        }catch(Exception e){
            return false;
        }
    }