We’ve written a Java program which we are looking to use and interact with from C#. What are our options? Optimally it would be possible to compile the Java application as a library (.DLL) that we could reference from C# perhaps using P/Invoke. This, however, doesn’t appear to be an option according to the first few searches online.
We opt to be able to use ASP.NET to built a search engine powered by the Java code, so if this opens up for any other options please let us know.
Sorry, you
cannotcall javacode / classesDirectlyfrom C# code.One way of doing this is to
wrapup your java classes in ajava Web Serviceand call classesindirectlythrough that web service interface in your C# code.Another way is using
javareg.exewhich exposes java classes asCOM. You can find it at following location:Following posts might help as well
.NET (uses runtime bridge)