gpt4 book ai didi

java 使用 exe 和 xml 文件调用 C# 程序

转载 作者:太空宇宙 更新时间:2023-11-04 06:21:38 24 4
gpt4 key购买 nike

我们的 java 程序应该调用我们的供应商用 C# 创建的程序。我们有两个文件

1.exe文件

2.一个 xml 文件...其内容如下

<doc>
<assembly><name>someProgram</name></assembly>
<members>
<member name="P:SomeConnector.callSomeOtherProgram()">
<summary>a method to connect to some program</summary>
<remarks></remarks>
</member>
</members>
</doc>

我们不知道如何做到这一点。有人有想法吗?

最佳答案

在java中运行命令行使用:

Runtime rt = Runtime.getRuntime();
Process pr = rt.exec("MyOtherProg.exe progParameter1 progParameter2");

根据您的评论和问题,我认为您有一个 class library ,解决这个问题的正确方法是创建您自己的 C# 程序,使用给定的 xml 作为程序 args 或其他方式

调用该类库上的不同方法

编辑

您的评论:

unning the exe manually (double click) shows up a wizard with an input text field and some buttons which does different tasks. the idea is for our java program to automatically run it and provide the fields and execute which buttons we would like to trigger to do the function we want. the java program just automates whatever is done manually

答案:

好的,现在我们用火炼焦:)

所以,此时我会去找供应商询问我是否可以获得一个类库而不是当前的用户界面,因为您希望它自动运行,无需人工干预。在使用该程序时,我会检查您是否有其他 .dll 文件。如果是这样,请使用 VS 调查它们.

最后一件事,如果一切都变坏并且您必须进行点击,它还没有丢失,但此时您有很多工作,我无法从这里帮助您,但我将向您发送一个链接以开始您需要的内容,您将从那里进行探索:

关于java 使用 exe 和 xml 文件调用 C# 程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27353699/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com