Can application startup scripts pass the called program name into the application?


(Laurence Gonsalves) #1

Executing the gradle application plugin’s installDist task creates a directory build/install/my-application-name/bin that contains wrapper scripts, my-application-name and my-application-name.bat. Running either of these scripts runs the application, and arguments passed to these scripts are passed to the underlying application.

In UNIX shell scripts you can access the name that was used to execute the program as $0. In fact, the UNIX version of the gradle-generated startup script uses $0 several times.

Is there a way to configure the gradle application plugin such that these scripts will pass the value of $0 (and whatever the Windows equivalent is on Windows) into the underlying application, perhaps as a Java system property?

(I asked this same question on Stack Overflow, but it hasn’t gotten any response.)