简体   繁体   English

从Java调用Mono程序集

[英]Calling Mono Assemblies from Java

I have a large text proofing framework written in C# and I want to write a OpenOffice extension that uses this set of libraries. 我有一个用C#编写的大型文本校对框架,我想编写一个使用这组库的OpenOffice扩展。 My prefered language for doing so is Java. 我喜欢的语言是Java。 Hence, I need a method to access .NET assemblies from Java (both in Windows and Linux ). 因此,我需要一种从Java(在Windows和Linux中 )访问.NET程序集的方法。 Is there a way to call Mono assemblies from Java? 有没有办法从Java调用Mono程序集?

IKVM should allow you to do what you want but I must admit that I haven't done this myslef. IKVM应该允许您做您想做的事情,但是我必须承认我还没有做这件事。

Here's a link to their project: http://www.ikvm.net/ 这是他们的项目的链接: http : //www.ikvm.net/

And a simple java program that calls the .NET API 还有一个简单的Java程序,它调用.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 . 更多有用的信息

This looks like a duplicate of: howto call c# (mono , .net) methods, delegates from native c 这看起来像是重复的: 如何调用c#(mono,.net)方法,来自本机c的委托

You can use JNI to execute some native c code to get in through that API. 您可以使用JNI执行一些本机C代码以通过该API进入。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM