Developer Product Briefs

Use Java Classes in .NET Apps

NBridgePro helps developers bridge the gap.

Many companies have both Java and .NET developers on code projects, but there’s often a significant communication gap between the two camps.

JNBridgePro helps developers bridge that gap. It generates wrappers (or proxies) for Java binaries, so you can call Java classes (running on a Java Virtual Machine) from your .NET code. (The product also generates code to call .NET classes from Java, but that’s not reviewed here.) The platform intercommunication can be through shared memory on the same server, binary transfer (remoting) over TCP, or SOAP. I chose shared memory as the fastest option, while recognizing it isn’t always practical to run two platforms on one machine.

My previous experiences with Java have been mixed, but limited, so I was curious how well this tool could help analyze and take advantage of the functionality of Java projects. The short answer: It helps a lot, and even .NET developers with a severe case of Javaphobia can probably benefit significantly from its functionality.

Setting up proved uneventful, but I should note that the product itself doesn’t ship with a Java runtime. The instructions for the brand-new Visual Studio plug-in also assume knowledge of the older JNBridge standalone utility. In turn, the standalone’s instructions assume you’re familiar with Java-specific terminology. For example, it’s critical to configure various “classpath” values for JAR files.

Figure 1
[Click on image for larger view.]
Build a Bridge to Java Classes. JNBridgePro 4.0 offers Visual Studio 2008 integration so you can generate wrappers for Java classes within the Microsoft IDE. As a .NET developer, it can be hard to figure out the Java dependencies when selecting classes.

With a basic knowledge of the standalone utility, the VS 2008 plug-in made more sense. Installing the product adds a JNBridge project type, DotNetToJavaProxies template, and a JNBridgePro menu to the VS IDE. When you open the generated DotNetToJavaProxies.jnb file, you see a list of eligible Java classes in the Environment column. You click on Add and use the checkboxes to select the Java properties and methods that you want to expose to .NET. This is another area where it helps to know Java and the specific classes you intend to use.

Less than three hours after cracking open the software, I was able to build and reference the required assemblies and run the sample .NET console executable. JNBridge uses a Java class to produce logging info. My exploration to convert the logging sample to a Web application using ASP.NET worked, but it would have been easier with a little more handholding.

For VS 2008 users, I’d like to see the vendor rewrite the Getting Started guide to avoid side-trips to separate manuals, include numbered steps in the procedures, and define Java terms.

JNBridge licenses its products per desktop, per server, and per developer. As such, hooking up an ASP.NET application to Java-based business logic on the back-end would start at $1,390 for the Web server plus $995 for one developer using the Standard Edition. The project I converted worked well, and it hinted at the much larger potential possible for a product like this in enterprise shops. JNBridge’s suitability in that role is beyond the scope of this review, but look for a follow-up review in a future issue of VSM that addresses that particular issue.

At A Glance JNBridgePro 4.0
JNBridge LLC
Web:
www.jnbridge.com
Phone: 877-584-6082
Price: $995 per developer, $1,395 per server, $95 per desktop deployment
Quick Facts: Bridges Java classes and .NET assemblies to allow one to call methods and use properties from the other.
Pros: Offers a quick solution to the Java/.NET divide; uses shared memory, remoting, or SOAP; good integration with Visual Studio environment.
Cons: Documentation needs organization and assumes an understanding of Java; no royalty-free runtimes.

About the Author

Ken Cox is a Canadian .NET programming writer and the author of "ASP.NET 3.5 for Dummies" (Wiley).

comments powered by Disqus

Featured

  • VS Code 1.127 Further Integrates Advanced Browser-AI Tech

    Microsoft's July 1 Visual Studio Code update continues a recent push to make the editor's integrated browser a more capable development surface -- and a more useful tool for AI agents.

  • Support Vector Regression with SGD Training Using C#

    Support vector regression can predict numeric values effectively, and this article shows how to implement and train a kernel SVR model in C# using stochastic sub-gradient descent.

  • New GitHub Switch Limits Repo Issue Creation to Collaborators Only

    After publicly touting pull request limits as a way to cut maintainer noise, GitHub is taking the same idea further with a new setting that lets repository admins restrict issue creation to collaborators only.

  • Uno Platform Helps Ship First Stable SkiaSharp 4.0 Release for 2D .NET Graphics

    SkiaSharp 4.148.0 is the first stable v4 release, bringing a newer Skia engine, API cleanup, performance work and a Microsoft-Uno co-maintenance model.

Subscribe on YouTube