[OpenSource] talking about. NET and Java three different ways to call each other

Source: Internet
Author: User

In many large-scale system development, development tools are often not limited to the same development language, but will use a variety of development language mixed-type development. Java and. NET are now claiming 85% of their market share, no matter who is right or wrong, Java and. NET are the two main camps for current application development, so the integration between Java. and net is often a problem in large application development.

The current integration between Java and. NET has three main ideas and practices (after a few days of review, I now see these three ways, there may be other methods):

1) integration based on communication protocols

Based on the integration of communication protocols, the most likely to be first thought, the simple way can be achieved through the Web service, but the efficiency problem, in some cases will become a fatal injury. Using remote for distributed development can improve the efficiency of communication, The good news is that both Java and. NET support the distributed development of remoting remote object invocation; The bad news is that they also have a disadvantage, that is, the limitations of the development language, regardless of which communication method is used, both the server and the client must support the same development language. In this respect, the major development companies made a positive contribution to the development of such as J-integra (aka Ja.net), Iiop.net (Internet inter-orb Protocol), JNBridge and other integrated development tools, to. NET and Java to enable the mutual invocation of remote objects to provide sufficient support. Recommended for use in these products: JNBridge

JNBridge is a leading Java and. NET interoperable product, and with JNBridge technology, Java and. NET code can implement object sharing without the need for cross-compiler. All Java code runs on the JVM, while. NET code runs on the CLR. In this scenario, the JVM and the CLR can run on different machines, run on different processes in a single machine, and even run on different application domains of the same process. After years of development, JNBridge has released JNBridgePro 5.0,jnbridgepro 5.0 with more powerful features.

1. Support Ava and. NET cross-platform transactions;
2. Support for Microsoft Visual Studio and Eclipse plug-ins;
3. Compatible with Windows 7;
4. Cross-platform transaction integration is mainly transparent to users;
5. ' Rollback '-termination of either party will result in the rollback of the actions of both parties;

JNBridge supports. NET to Java, Java to. NET two ways of service, and can be used in TCP, HTTP, soap and other protocols for both parties to communicate.

Reference resources:

Website address:

Http://www.jnbridge.com

2) based on use. NET implementation of Java Virtual machine integration

Currently available open source resources are mainly: Ikvm.net.

IKVM. NET is the open source,. NET CLR-based Java Virtual machine. Based on. NET Java Virtual machine means that we can let Java programs run on. NET, which allows Java programs and. NET applications to work together through a virtual machine. More commendable, IKVM also supports Microsoft's. NET Framework and Mono.

Security is a big omission for the IKVM platform. This issue will depend on. NET platform provides an old, but powerful, security model that is addressed. Despite this, the current project has the ability to successfully run large Java projects.

IKVM is currently immature in the following areas:

1. There is no support for AWT and swing, which is not a high priority in the IKVM development plan.

2. There is no implementation of the Java security model.

Reference resources:

Using Java Classes in your. NET application

Http://www.codeproject.com/Articles/13549/Using-Java-Classes-in-your-NET-Application

3) integration of Java-based local interfaces
The Java local interface (Java Native Interface (JNI)) allows code running on a Java Virtual machine (Java computer (JVM)) to invoke local programs and class libraries, or be called by them, which can be written in other languages , such as C, C + + or assembly language.

Reference resources:

Using the Java Native Interface in C #

Http://www.codeproject.com/Articles/245622/Using-the-Java-Native-Interface-in-Csharp

Review

Choose Jnbride, more suitable for large-scale project development, on both sides of the mutual adjustment support is very good, and the two sides can not feel each other. However, there is a need for a certain amount of overhead in the transmission of information (if there is some loss in the case of very high efficiency requirements).

With Ikvm.net, the. NET call to Java can be "seamless", if you do not consider Java tune. NET (as if Java calls. NET DLL does not have. NET call Java so troublesome), the personal feeling generally is preferred (after all, it is currently insufficient, In general, the impact is not too big, and there are few opportunities involved.

The JNI-based approach to integration, which is not very well understood by Java, is not too much to comment on, but has seen a description: the use of local methods is costly, and it loses many of Java's benefits. If there is no choice, we can choose to use local methods. In any case, from someone else's article: "In my example, I'll show you what to call a couple of Java methods from a C # client.", you can see that from the implementation, it can be done completely. NET calls the Java method.

The above review, all for the individual simple understanding, these days only from the overall consideration of how to "call Java method from. Net", for these three ways of the demo did not follow the introduction of other people to debug and performance testing, just first from the big direction and ideas to do some preliminary research. Next, intends to 1, 2 ways to further research and comparison of the demo, the 3rd way, the current temporary qualitative bit understand it.

[OpenSource] talking about. NET and Java three different ways to call each other

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.