问题
I have a Java API in jar file with some dependencies from other jar files.
Is there any way to call a specific method from this API, like using PInvoke from .NET?
回答1:
Here you go :) I've used it myself and was very please with the implementation.
IKVM: Using Java API's in .NET Applications
(1) If you just want some libraries from Java.
(2.1) If you have access to the code.
(2.2) Last resort, dynamically load the Java into .Net (interpreter)
回答2:
I don't think it will be an easy task to interoperate .net and java. May be you could use sockets, and use them to send messages from one environment to another. It is just an idea, though.
EDIT:
I have found some libs that say they can do this:
http://www.jnbridge.com/
http://www.codeproject.com/KB/dotnet/Espresso.aspx
回答3:
You can use CORBA to "call" java methods from .NET.
For .NET here you can find some CORBA libraries.
Java SDK includes CORBA capabilities so you don't have to download 3rd party libraries.
来源:https://stackoverflow.com/questions/5928200/call-java-method-from-api-in-net