Yes you can, but you almost certainly will have to set the environment properly for any java command to run.
yes, The java is in the path so that I can run it any directory.
Is "java" in the environment PATH for the user that you are running Splunk as ?
yes, I have done all the settings and I can run the batch file manually in command line. But when I try to trigger the batch alert in a schedule search, only the "echo" command executed and "java" command did not.