C # and Java Interaction related research

Source: Internet
Author: User

I've always felt that C # and Java can be applied interactively, but there has been no research due to time and other reasons. Today, the time to search for a moment, finally toss out.

Here are some of my own questions and analysis of the integration of C # and Java, if there is no place, please pass by the prawns to give the point. 3q!

Here's the problem:

1. How does C # and Java integrate?

2. Why is C # (. Net) integrated with Java?

3. What role does Java play in Java and C # consolidation? What role does C # play?

Answer one by one revealed:

1, C # and Java integration there are roughly 4 ways to go.

1.1 The Java package is converted to a DLL or EXE after registering as a COM component, and then called;

1.2 using Web Service; (Http://www.codeproject.com/Articles/32313/How-to-invoke-Java-web-service-in-ASP-net-using-C)

1.3 Use of middleware, such as a commercial middleware: http://j-integra.intrinsyc.com/;

1.4 Using Ikvm.net, this is a Java VM implemented under. NET, so after a conversion, go straight to Java stuff;

(above 4 points, I searched on the Internet)

I mainly say 4th: Use Ikvm.net.

A: Download ikvm-0.40.0.1.zip;ikvmbin-0.40.0.1.zip;openjdk6-b12-stripped.zip;

Unzip the Ikvm-0.40.0.1.zip and add the%ikvm_home%\bin to the path. The%ikvm_home% here refers to the IKVM home directory after decompression.

B: Create a javaproject, customize the package, class, methods that need to be disclosed to the outside world, and then package the Javaproject as a jar file. (Eclipse and MyEclipse are all self-bringing, or you can show off some of the code in black box).

C: Civet cat for Prince: Jar>>dll

Open the black box (ie: win+r,cmd, go to the%ikvm_home%\bin directory),

Execution: ikvmc-out:dllfilenameorpath. dll Javafilenameorpath. jar

At this point, a dllfilenameorpath. dll file appears under the%ikvm_home%\bin directory or under the specified path, which is placed in your. NET project, add a reference, and at the same time,

%IKVM_HOME%\BIN\IKVM. OpenJDK.Core.dll

%IKVM_HOME%\BIN\IKVM. Runtime.dll

%IKVM_HOME%\BIN\IKVM. Runtime.JNI.dll

Add to your. NET project, remember!

Where the using is followed by the package name of the Java class.

2, C # and Java integration, no, it should be. NET and Java consolidation. Why integrate?

In the industry, one person said. NET development in addition to the service layer, development speed, high efficiency. and Java to do background services, security, scalability is high. So only the cattle will integrate the two. Currently. NET and Java integration Technology, is a new banner, but has been applied to the actual development.

3, as 2 said,. NET and Java consolidation, Java is primarily responsible for the DAL, which is the primary interaction with DB, as well as other communications. While. NET is primarily responsible for the BLL.

C # and Java Interaction related research

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.