tags:

views:

58

answers:

2

I need to run a jar file on a remote machine. The jar takes several arguments.

psexec \\somemachine -i  /accepteula -i -u domain\user -p password  cmd /S "c:\mydir\myjar.jar" [my jar args here]

Can someone tell me how to do this? The closest I have gotten is getting CMD to launch but with not command.

A: 

To run a java executable (which I assume myjar.jar is), you have to use the following command:

java -jar [jar name]

So try this:

psexec \\somemachine -i  /accepteula -i -u domain\user -p password  cmd /S "java -jar c:\mydir\myjar.jar" [my jar args here] 
Starkey
Thank you.. Not sure why I forgot to add java -jar. This launches cmd.exe but with no command entered.
Nick
Don't you need a /C as an argument to cmd.exe to launch java?
Starkey
A: 

Have you tried

psexec \\somemachine -i  /accepteula -i -u domain\user -p password  cmd /c "java -jar c:\mydir\myjar.jar [my jar args here]"

?

Frank