Starting an UI application using MServer, the application may be launched on background, without focus.
Here are the steps to reproduce:
1. Open command console, and start MServer
2. Move above console to background
3. Open another command console
4. Run an UI application with -XUseMServer, such as ${MVM_HOME}/bin/java -XUseMServer -jar SwingSet2.jar
You can notice that the application is launched behine command console.
The problem is due to the UI application is actually launched from MServer, which is on the background.
The fix is to utilize Windows APIs AllowSetForegroundWindow/SetForegroundWindow to have launcher grant permission to MServer, allows MServer to show window above launcher.
Here are the steps to reproduce:
1. Open command console, and start MServer
2. Move above console to background
3. Open another command console
4. Run an UI application with -XUseMServer, such as ${MVM_HOME}/bin/java -XUseMServer -jar SwingSet2.jar
You can notice that the application is launched behine command console.
The problem is due to the UI application is actually launched from MServer, which is on the background.
The fix is to utilize Windows APIs AllowSetForegroundWindow/SetForegroundWindow to have launcher grant permission to MServer, allows MServer to show window above launcher.