passing environment variable to a java class in command line
Try this command
export VARNAME='variable-value'
Then run your Java main class from the same command line.
Try giving following command,
java -DconfigDir=/etc/myconfig-config/ -cp test-tool.jar service.ScriptGenerator $clinic_count $client_files_count
Your command should be like
java -cp test-tool.jar -DconfigDir=/etc/myconfig-config/ service.ScriptGenerator $clinic_count $client_files_count