Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Hosting .NET Controls in Java

Using JNI and some COM interop magic, you can host .NET Windows controls directly in your Java applications.


advertisement


any organizations have applications already written in Java; but applications often aren't static—they need constant attention and modifications to remain productive. When it's time to upgrade, rather than rewriting the base functionality underlying these applications, it's often more feasible to extend them by taking advantage of the rich new user interfaces and technologies present in Microsoft .NET. You can use the techniques discussed in this article to host .NET Controls in Java at the user interface level. Microsoft .NET and Java are two powerful frameworks that provide a rich set of classes. While either of these frameworks can solve many of the same problems, each has their advantages and disadvantages. When you have existing, tested components, you may find it beneficial to use both .NET and Java in your application, perhaps to support or extend legacy applications that have already been written in Java but adding value using the .NET Framework.

By using the Component Object Model (COM) interoperability services provided by the .NET Framework and the Java Native Interfaces (JNI) present in Java, you can host .NET controls in your Java application. In this article, you'll build and host a control built with Microsoft C# in a Java application. Figure 1 shows the completed control hosted in a Java app.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.