I’m using gradle for several Java projects, in which I’m also using the gradle start scripts generated by distZip or starting the program with ‘gradle run’. While this eases the handling of the classpath, the management afterwards is awkward because of the extremely long -classpath argument on the java command line due to all the jars of the dependences being on the command line. This results in a long output from something such as ‘ps aux’ or something similar and also makes it hard to find out which program is actually running.
The start script contains a line similar to
java … -classpath “$CLASSPATH” my.main.class “$@”
A much cleaner process name result from using
export $CLASSPATH java … my.main.class “$@”
The CLASSPATH variable is already built in the start script, so why not just export it rather than passing it as a command line argument? Since it’s exported in the shell script in the newly spawned shell, it will not clutter the outer CLASSPATH variable after the program terminates.
The same thing would be preferabble in programs started using ‘gradle run’.