Compiling binaries question

I have a project that I have created by using the gradle init -type basic. I have been running the program by using the gradle -q run command. I have now added some command line arguments to the program and I was asking how does one compile binaries from the command line similar to .exe build that I can run perhaps from java with a terminal java myProgram.bin -arg1 -arg2. I did some readings but it was not yet clear to me how to accomplish this end with gradle.

I think you’re looking for the application plugin:

https://docs.gradle.org/current/userguide/application_plugin.html

This will produce a script you can run outside of Gradle and a run task that you can supply arguments to.