VMWare - RunScriptInGuest, RunProgramInGuest Java - jar excution problem

808 views Asked by At

I'm trying to execute a jar inside a virtual machine. I'm very new to VMWare and I've hit a brick wall trying to run a jar inside some vms.

I've tried both of the following with no luck.

vmObject.RunProgramInGuest(@"C:\Simulation.jar", "", true, false, false);

vmObject.RunScriptInGuest(@"C:\Simulation.jar","java", true, false);

I'd be grateful for any advise.

1

There are 1 answers

0
Evan Powell On BEST ANSWER

I'm not sure exactly what interface to the API you're using, but it looks like you've got the first two arguments backwards. Here is the function call for reference (from here):

HRESULT
RunProgramInGuest([in] BSTR guestProgramName,
                  [in] BSTR commandLineArgs,
                  [in] LONG options,
                  [in] IVixHandle* propertyList,
                  [in] ICallback* jobDoneCallback,
                  [out,retval] IJob** runJob);

For running JAR files, the command line executable is java, followed by the JAR to execute. For example:

java C:\Simulation.jar

Reversing your first two arguments should give you the API equivalent of that command:

vmObject.RunProgramInGuest("java", @"C:\Simulation.jar", true, false);