从Java调用VB.NET函数的最佳方法? [英] Best way to call VB.NET function from Java?
问题描述
- Java本机访问)
- Java本机接口(JNI)
- COM / ActiveX桥接(虽然我不能完全说出我知道这些是/如何使用它们_
- JNBridge
现在据我所知,这些都是问题我分别找到:
- 使用此选项需要使用C或C ++从Java到.NET的中介,并给出我只是真的知道Java,我不想在这个混乱中纠结。
- 似乎比JNA更复杂一些,我觉得它没有真正的优势无论如何,他们似乎都需要一个C / C ++中介。
- ...除了我不太确定我可以如何关于实现这种方法。
- 这个和其他类似的b山脊必须是最后的手段。该产品的开发许可证相当昂贵,我确信他们没有资源使用本产品。我可以试着问,但我真的不认为这是一个实习生的地方,要求一家公司投资太多。
为了增加一个事实,我不是那么擅长编程,所以我主要是为了自己这么做,所以非常感谢提前阅读我的问题。如果有一些我还没有完全解释,需要进一步解释,请让我知道!
我可以建议JNA与 UnmanagedExports ,因为它只需要C#,VB.NET或F#.dll与以下标题
C#:
[RGiesecke.DllExport.DllExport]
public static String yourFunction(String yourParameter)
{
returnCSharp String;
}
之后,您可以像JNA一样使用任何其他C或C ++ .dll在Java中。你可以在这个类似的问题中找到一个例子和一些我在答案中无法解决的限制:使用JNA从Java调用DLL
我只用C#尝试过,但如 documentation 它应该与C#,F#和VB.NET一起使用。
I'm interning as a software developer for a company. There is a client-installed software program written in C# that has dll's in VB - both on the .NET framework. Our entire cloud-based server is written in Java, so for now, my task is simply to call a function in Java that gets/sets a private(? sorry, not really familiar with VB so I might be using this term inappropriately) variable located within the dll. Ultimately, though, my task will be to collect data from the client program and put it in our server. I've been researching how to go about doing this for the past few days and have found a few options:
- Java Native Access (JNA)
- Java Native Interface (JNI)
- COM/ActiveX bridges (though I can't entirely say for sure that I know what these are/how to use them_
- JNBridge
Now as far as I know, these are the issues I've found with each, respectively:
- Using this option requires an intermediary from Java to .NET using either C or C++, and given that I only really know Java, I'd not really like to get tangled in this mess.
- Seems a tad bit more complicated than JNA, and I think it has no real advantages over JNA anyways. They both appear to have the need of a C/C++ intermediary.
- ... can't really say much aside from the fact that I'm not really sure how I can go about implementing this method.
- This and other similar bridges has to be a last resort. The developer license for this product is quite pricey, and I'm sure they we don't have the resource to use this product. I could try asking, but I don't really think it's in the place of an intern to ask that a company invest so much.
To add to the fact that I'm not really that adept in programming, I've been left to mostly do this on my own so thanks so much in advance for reading my question. If there's something I haven't fully explained that necessitates further explanation, please let me know! Any other tips/pointers would be immensely appreciated.
I can recommand JNA together with UnmanagedExports since it requires only C#, VB.NET or F# .dll with the following Header
C#:
[RGiesecke.DllExport.DllExport]
public static String yourFunction(String yourParameter)
{
return "CSharp String";
}
after that you can consume it with JNA like any other C or C++ .dll in Java. You can find an example and some restrictions I couldn't come around in my answer at this similar question: Call DLL from Java using JNA
I only tried it with C#, but as stated in the docu it should work with C#, F# and VB.NET.
这篇关于从Java调用VB.NET函数的最佳方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!