C # Research on interaction with Java

Source: Internet
Author: User

I used to think that C # and Java can interact with each other. However, due to time and other reasons, no research has been conducted. Today, I took the time to search and finally found out.

 

The following are some questions and analyses on the integration of C # And Java. If there are any mistakes, please point out them. 3Q!

 

Question:

1. How to Integrate C # and Java?

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

3. What role does Java play when Integrating Java and C? C # What role does it play?

Answer:

1. There are roughly four ways to integrate C # and Java.

 

1.1 convert a Java package into a DLL or EXE, register it as a com component, and then call it;

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

1.3 use middleware; for example, a commercial middleware: http://j-integra.intrinsyc.com /;

1.4 IKVM. NET is used, which is a Java VM implemented under. net. Therefore, after a conversion, Java is directly run;

(I searched the website for the above four points)

 

I will focus on the fourth point: Using IKVM. NET.

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

Decompress ikvm-0.40.0.1.zip and add % IKVM_HOME % \ bin to path. Here % IKVM_HOME % refers to the main directory of ikvm after decompression.

B: Create a JavaProject, customize the packages, classes, methods that need to be disclosed to the outside world, and then package the JavaProject into a jar file. (Eclipse and myeclipse both come with their own, or you can display them and use a black box to check a few codes ).

C: Tom for Prince: jar> dll

Open the black box (win + r, cmd, go to the directory of % IKVM_HOME % \ bin ),

Run: ikvmc-out:DllFileNameOrPath. DllJavaFileNameOrPath. Jar

In this case,DllFileNameOrPath. Dll file, put in your. Net project, add reference, at the same time, please

% 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!

Here, the using is followed by the java class package name.

 

2. C # and Java integration. No, it should be. Net and Java integration. Why integration?

In the industry, some people said that. Net development, in addition to the service layer, is fast and efficient. Java is a backend service with high security and scalability. That's why cool people integrate the two. Currently, the application of. Net and Java integration technology is a new banner, but it has been applied to actual development.

 

3. As mentioned in 2,. Net is integrated with Java, and Java primarily undertakes DAL, that is, main interaction with DB, and other communications. And. Net mainly undertakes BLL.

 

The above is the analysis of the younger brother. If not, please pass by and correct me!

Thank you!

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.