Open Swing App from Task


I would like to open Swing App to collect, some of information from User, before executing that task.

I tried different ways , but failed. In all my trails, the Swing will open, but task will complete immediately… Hence, neither I am able to view Swing app nor able to collect information.

Is it possible to open Swing Application, from Gradle task ? If so, what’s correct way ?