如何在java中调用exe中的函数 [英] How to call a function in exe in java
本文介绍了如何在java中调用exe中的函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经从这个c#类创建了一个exe
I have created a exe from this c# class
using System;
using System.Collections.Generic;
using System.Text;
using SharedClientAPI;
using System.Runtime.InteropServices;
using System.Reflection;
namespace JavaExeCallTest
{
public class JavaExe
{
public JavaExe()
{
}
public String testFromC(String str)
{
return "Hellow From C#:"+str;
}
}
}
我创建了JavaEXeCallTest.exe。我需要从java调用testFromC(String str)函数并打印消息。如何在java中执行此操作
I have created the JavaEXeCallTest.exe. I need to call the testFromC(String str) function from java and print the message. How can do this in java
推荐答案
你不能这样做;您需要使用Java Native Interface库将Java类连接到.NET。请参阅 http:// jnbridge.com/software/jnbridgepro/overview/?utm_campaign=217739905&utm_source=g&utm_medium=15189019705&utm_term=java%20.net&gclid=CNOUqtHmockCFdUaGwodMCANOA [ ^ 对于一个这样的人。
You can't do it like that; you need to use on of the Java Native Interface libraries to connect a Java class to .NET. See http://jnbridge.com/software/jnbridgepro/overview/?utm_campaign=217739905&utm_source=g&utm_medium=15189019705&utm_term=java%20.net&gclid=CNOUqtHmockCFdUaGwodMCANOA[^] for one such.
这篇关于如何在java中调用exe中的函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文