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).
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.
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
精彩评论