简体   繁体   English

VMWare-RunScriptInGuest,RunProgramInGuest Java-jar执行问题

[英]VMWare - RunScriptInGuest, RunProgramInGuest Java - jar excution problem

I'm trying to execute a jar inside a virtual machine. 我正在尝试在虚拟机中执行jar。 I'm very new to VMWare and I've hit a brick wall trying to run a jar inside some vms. 我是VMWare的新手,遇到了一些砖墙,试图在某些vms中运行jar。

I've tried both of the following with no luck. 我没有运气就尝试了以下两种方法。

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

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

I'd be grateful for any advise. 如有任何建议,我将不胜感激。

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. 我不确定您正在使用的API的确切接口,但是看起来您将前两个参数向后了。 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. 对于运行JAR文件,命令行可执行文件是java ,后跟要执行的JAR。 For example: 例如:

java C:\Simulation.jar

Reversing your first two arguments should give you the API equivalent of that command: 反转前两个参数应为您提供与该命令等效的API:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM