Let Java and. NET Framework Coexistence

Source: Internet
Author: User
Tags continue execution soap posix requires win32 oracle database linux
. NET Framework Original author: Ashish Banerjee

Translation finishing: 51DOTNET CLUB (WWW.51DOTNET.COM) slash

Objective: To make an assessment of the possibilities of coexistence between Java and the. NET Framework

Target Audience: Java Programmers and system engineers



Feed:

The first is the Java and. NET platform to do an analysis, and then is my personal understanding of how Java formation, followed by the analysis of Microsoft and sun cooperation and disagreement, and finally Java and. NET cooperation prospects.


I personally strongly believe that Java and. NET will gradually unify in the near future. There are already a lot of project plans for consolidating Java and. NET being submitted to the Open-source organization. In Microsoft's Msdn,sun Java site, as well as standard documents from ECMA and w3c.org, you can see the content.



Brief introduction

Java and. NET continue to develop, two possible outcomes: one of them exits competition or two coexist, and the likelihood of coexistence is greater. Java survives because of its time advantage: it has developed for six of years; it works on most operating systems; it is supported by industry leaders such as Oracle, IBM, and the project plan that uses Java for development covers almost all application areas.


The advantage of. NET is that Microsoft has 90% of the desktop operating system market, and Microsoft is also starting to adopt Sun's marketing strategy, which will standardize its unique technology. For example, it submits soap to the IETF (internetengineering Task Force) and the world Wide Web Consortium in remote communications (simple OBJECT ACCESS protocle) (similar to Rfc-request forcomment), and submits the C # language and the Universal Runtime (European) to ECMA (Computer manufacturer ' s association) RUNTIME) The standard of the infrastructure.



Architecture of the Java platform

The Java platform includes the Java language, as well as a set of virtual machines-such as JVMs, KVM, CVM, etc.-that run Java bytecode on PCs, laptops, or embedded systems. The Java platform also defines a broad set of APIs that are used to coordinate or compete with Microsoft's APIs. such as JDBC on ODBC,JTAPI to tapi,jdo on ADO and so on. So, briefly, the Java platform includes languages, virtual machines, and API libraries.


Because the virtual machine mechanism is used, the Java language has only a unique version on all platforms, so it uses RMI (remote method invoke invocation) protocol for remote communication; NET Framework is gradually evolving into soap (Simple Object Access Protocol) using dcom--.


Sun initially advertised Java as "one-time code writing, running in all environments," but had to retract its initial hype after the introduction of "Java 2 Enterprise Edition" and "J2ME" (Java 2 Micro Edition), because " A size shoe fits all the feet "solution does not work well.



. NET Platform Architecture



. NET Framework includes a range of languages, such as C + +, vb.net (VB 7.x), and C #, a set of run-time environments similar to Java virtual machines, and a set of API interfaces that tend to be associated with Windows systems. The run-time environment may exist in a browser, a Web SERVER, or an operating system. You may also have such a run-time environment in SQL Server in the future. Another need to mention is the Microsoft SOAP protocol, which is developed on the basis of some of the features of DCOM, and is transmitted over HTTP in XML format. The Java version of SOAP, which you can see on the http://xml.apache.org document.



Development history



Java originally originated in Sun's set of language for set-top boxes, when the name was renamed by Oak,sun and placed on the Internet as an open source share. With the advent of Java applets specifically designed for Web pages, the Java language is quickly popular on the internet. At that time the browser was mainly Netscape. Microsoft developed its own browser IE when it found that tomorrow's market dominance could be a browser rather than a desktop system, and it started to acquire Netscape.



The internet needed a language at the time, and Java arose in due course, and many programmers turned to Java because of its many similar syntaxes to C + +. And it does have so many advantages that, in the autumn of 98, its opponents, Microsoft, declared in MSDN that Java is the best language to write COM components.


There are also Linux operating systems and Apache servers that appear along with Java. The combination of these three is powerful in server-side applications, and Windows NT is hit a lot in the enterprise server market.


The emergence of DHTML and JavaScript in the 98 led to the fading of Java applets in the field of web design, with two factors: first, most applet effects can now be done by DHTML, while DHTML requires less bandwidth. But Java continues to develop because of the market in server-side applications. This is the source of the development of the support for Java added Vitality, first is the Apache proposed Serverlet and later JSP, these in the. com web site development of the program occupies a place.


The Java platform is first Serverlet, then JSP, and finally EJB (Enterprise Java Beans), gradually extending to enterprise-level applications. EJB is an object-oriented transaction process system, some similar to Microsoft's MTS (Microsoft Transaction Server). In fact MTS and EJB are not very successful because they are not up to the size of Internet applications.


From my point of view, Java's most failed moment was when sun, by legal means, claims to Microsoft for $2000 and succeeds. Since then, Microsoft has been developing its own. NET plan, but also announced the end of Java's status as a unique Internet platform.



Prospect


Now, we can see that it's just a very confusing situation. And in the future, we will see. NET's maturity, and its integration with Java.


Java will continue to maintain its features: Cross-platform server-side applications, such as WAP servers, or the telecommunications domain such as Jain (Java API for intelligent Networks), which will continue to maintain its advantages in embedded systems, such as smart cards, mobile phones, PDA and so on. And we're going to see. NET mature, of course, this kind of maturity needs time, may be quite a long time, as if Java grew up like that.


Oracle 8i and older versions, acting as a carrier of the Java runtime, enable Java to work closely with the Oracle database engine; NET system will also be closely integrated with the new version of SQL SERVER, which will include a VES (virtual execution System) execution engine. This will allow program developers to embed C # and vb.net components in SQL statements and stored procedures. Currently, you can use extended stored procedures by calling DLL functions, but the database itself does not have an object-oriented Run-time engine to match.



The mark of the future. NET Maturity Milestones



Non-Microsoft products, including servers, desktops, or portable devices operating systems such as Solaris, Linux, and Palm OS. NET interfaces. Integration with the Java core. For example, the Java compiler for the CLI (Common Language infrastructure), the C # compiler for Java virtual machines. The VES engine that is consolidated in database products such as SQL SERVER or ORACLE. Developed by neutral third party open source, perfect. NET platform.


It can be foreseen that Microsoft will sponsor open source projects to extend. NET to the UNIX platform, which will help some open source organizations reduce their preference for Java.



The fate of Java



One of the main goals of Java is a communications device provider, such as Nokia, which uses Java in its WAP SERVER. Similar to the 70 and early 80, when PCs were sold, hardware vendors bundled the final application into the operating system, and Java is now being sold in communications devices.


Another major direction of it is Jain (Java API for Advanced Intelligent Network), which primarily defines a set of APIs unrelated to protocol (such as cdma,gsm,imt2000) to facilitate the development of components based on open markets. This allows ISVs (independent software vendors) to provide communication services in the form of plug-ins, such as 800 toll-free calls that can be automatically transferred to the nearest, accessible international call center. Of course, Jain also met opponents, and wanted the parlay plan that Microsoft and Britain had put forward--and it was supported by the industry.


In addition, Java in embedded devices also maintain a leading position, such as smart 3G and GPRS, where the mobile phone system is J2ME (Java 2 Micro Edition), but if it does not solve some of the inherent problems, such as load-time delay, perhaps, soon , it will be replaced by C # if. NET can provide a fast operating environment and extensive industry support.



. Integration of NET and Java



From the perspective of business, or developer, or even the open source organization. NET and Java integration are necessary, the following to make an early estimate of the integration of the two (all the relevant projects are divided into a, B, c three groups, so as to see the relationship between them, of course, these items can also be completely independent operation):

JVM to CIL compiler (Group A)

Java API Bridge for. NET APIs and Lib. (Group A)

Java Compiler for CLI (Group A)

CLI ports for Palm OS, Linux and Solaris (Group B)

. NET APIs and Lib. Bridge for Palm OS API (Group B)

. NET APIs and Lib. Bridge for POSIX (Group B)

CIL compiler to JVM (Group C)

. NET APIs and Lib. Bridge for Java API (Group C)

C # Compiler for JVM (Group C)



A group of projects


The main purpose of the group project is to enable existing Java binaries to be executed on the. NET platform. This means that the Java binary code (the suffix class file) can run on the. NET platform without recompiling from the source code. Of course, these class files will be compiled or executed, just as Microsoft's runtime and JIT have done for Microsoft's intermediate language.

JVM to CIL compiler

A compiler, input Java bytecode, output MSIL code--it will be compiled into executable files (such as Exe,dll,msi, etc.)



Java API Bridge for. NET API and Lib


Here, a mapping between the Java API and each corresponding. NET API is established, such as the Java.io.File in the Java API will be mapped to. NET's System.IO.File class. Some mappings are more complex than the simpler IO class mappings, such as the system.net mapping of java.net packets to. NET. One problem here is that it is easier to develop this work in C #. If implemented in Java, you need a compiler that points directly to the CLI (Common Language Interface), which generates CIL that conforms to the CLS (Common Language specification) standard (Common Intermediate Language) code.


You can avoid tedious work by writing a wizard-style tool, for example, you can use C # or Java to write an Xml-based object description, use it to generate a skeleton code, and then add other code to it as needed. If you really want to do this, you can find a lot of useful information at the http://xml.apache.org site. Similar tools are available in Microsoft's outdated Java SDK-a tool used to generate JDirect (JDirect was the Microsoft's hack for implementing native interfaces) code, It enables access to the local WIN32 API. The source code for the tool is available in the SDK. By the way, sun and Microsoft have been working on this issue because of Microsoft's unique Java extension tag.



Java Compiler for CLI

It compiles Java source code (using the. NET Framework API) into executable format, such as Exe,dll, which consolidates the Java and. NET frameworks at the highest level. This will lay the groundwork for future direct use of Java to create applications under the. NET Framework.


Rewriting the code generation portion of an existing Java compiler will be a relatively convenient solution for this work. In my personal opinion, Sun will develop such a set of compilers according to the standards of open source code. Of course, some of these transformation plans require adjustments to some Java classes.



Items in Group B

The group's projects will focus on developing the port for the. NET framework for other platforms such as Palm OS, Solaris, and Linux platforms. These ports should be written in c to accommodate speed and control requirements, and C to develop and retain system-level programming related to operating systems.


CLI ports for Palm OS, Linux and Solaris.

This section is in fact divided into two separate sections: one for Palm OS and two for UNIX systems.


For Palm OS, the solution is simple, the development can be done in PC environment, and then use the data cable or Bluetooth to transfer to the Palm device. The related. NET framework API for the Palm OS design is detailed in the next section.

The UNIX section will take advantage of Java development, finally compiling the PE (portable executeable) file into the COFF (Common Object file format) format, a UNIX executable file format. Compilation will take place when installed or loaded.



. NET APIs and Lib. Bridge for Palm OS API.

this. NET API bridge should be mapped to the Palm OS API in an optimized way. The mapping table for connectors and Mount devices resides on the PC's gateway. The executable code for the Palm OS is transmitted via a data cable or Bluetooth. Its implementation will depend on the hosting of the Palm OS resident virtual machine KVM (the Java 2 Micro Edition) runtime, and it should also avoid the bug that the Java runtime in the KVM design is too slow to load. In addition, this set of APIs differs from the design for Windwos CE, and it should not discard those resource-intensive APIs like System.Xml. NET relies on SOAP for remote method calls. SOAP is based on XML format, so it requires system.xml support. If not, a distributed application based on SOAP will not work. You can implement remote operations on PDAs such as Windows CE and PALM OS applications or some server-side applications by invoking the System.Xml API. You can even use the Wbxml (WAP Binary XML) standard designed for WAP (Wireless Access Protocol) to communicate with WAP gateways based on soap.



. NET APIs and Lib. Bridge for POSIX.

This section will map to the. NET API and the UNIX API, and a lot of C programming will be a difficult task, but the greater difficulty will come from processing GUI elements. These UNIX platforms have many GUI frameworks, and it is safer to provide them with a WIN32 API port as a medium. If you can map the operations of the Microsoft JAVA SDK described previously, you will save a lot of programming work.



Items in Group C



The content of this section is devoted to applying the. NET framework to Java. It will be a hard job. Of course, if Microsoft submits a standard specification to ECMA, the work will become more practical.



CIL compiler to JVM

The project will be put. NET executor (PE) to a file in the. class format. However, if there are some unmanaged code in the execution program, the JVM will not accept them. The implementation of this project depends on the implementation of the. NET API for Java that will be described below.



. NET APIs and Lib. Bridge for Java API.



A fully compatible. NET API Bridge is almost impossible, and it relies on some of the parameters that Microsoft has submitted to ECMA. This work will be implemented by Java, but as mentioned in the Java API to. NET Bridge, there will be a lot of tedious work.



C # compiler for JVM

This work can be done in either Java or any of C #. It is easier to make use of Java, because many of the code with Sun's Java compilers can be recycled. But I recommend using C # to do this, and there are many basic compilers available to use in the. NET framework. This project relies on the implementation of the. NET API Bridge for Java.



Summarize

The last thing I want to say is that integrating. NET with Java is not just Microsoft and Sun's work. All programmers probably should be concerned about it.


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.