I have a jar file that I would like to run using VBScript. But I don't want to leave the command prompt open while the application is running.
Currently, I can achieve this by putting the java command in a BAT file as follows:
java -Xms256M -Xmx1024M -jar myApp.jar
I then have a VBScript that would call the BAT file as follows:
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & "myApp.bat" & Chr(34), 0
Set WshShell = Nothing
But I think that using a VBScript to call a BAT file to invoke the java command is unnecessary. To optimize, I wanted the VBScript to invoke the java command directly so that I can disregard the BAT file.
I tried replacing the VBScript into something like the following:
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & "java -Xms256M -Xmx1024M -jar myApp.jar" & Chr(34), 0
Set WshShell = Nothing
But the following error occurs:
Error: The system cannot find the file specified.
Code: 80070002
Any ideas?