Calling Mono Assemblies from Java

守給你的承諾、 提交于 2019-12-11 02:53:25

问题


I have a large text proofing framework written in C# and I want to write a OpenOffice extension that uses this set of libraries. My prefered language for doing so is Java. Hence, I need a method to access .NET assemblies from Java (both in Windows and Linux). Is there a way to call Mono assemblies from Java?


回答1:


IKVM should allow you to do what you want but I must admit that I haven't done this myslef.

Here's a link to their project: http://www.ikvm.net/

And a simple java program that calls the .NET API

import cli.System.IO.*;

public class ShowDir{

   public static void main(String[] args){
       String[] files = Directory.GetFiles("."); //.NET System.IO
       for(String file : files){
           System.out.println(file);
       }
   }
}

More useful info.




回答2:


This looks like a duplicate of: howto call c# (mono , .net) methods, delegates from native c

You can use JNI to execute some native c code to get in through that API.



来源:https://stackoverflow.com/questions/14386369/calling-mono-assemblies-from-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!