Call CLR code from JVM

梦想与她 提交于 2019-12-11 00:53:39

问题


Is it possible to call CLR methods from JVM? Any library that would host a .NET CLR instance inside JVM, and provide a simple mapping for Java? Are there any libraries that would do that?

I'd like to write a plugin for existing Java application which already runs on JVM.

I'd like to avoid having two binaries. I only want to call few methods in an existing .NET assembly (MSBuild-related Microsoft.Build.Framework.* stuff).


回答1:


Natively no this is not possible. The Java and CLR virtual machines are very different beasts that do not natively support each others byte code set.

It is possible though to use third party libraries to bridge the two techonologies together. Here are a few (more available via google)

  • http://www.theserverside.net/news/thread.tss?thread_id=34693
  • http://conferences.embarcadero.com/article/32261



回答2:


There are two different ways to do this. You can run Java on the CLR using IKVM. Conversely you can embed Mono which is a .NET CLR implementation, although this will require using C and JNI.
All these assume that you can comply with the terms the open source licenses.



来源:https://stackoverflow.com/questions/3602091/call-clr-code-from-jvm

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