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


  • Clustering Non-Numeric Data Using C#

    Clustering non-numeric -- or categorial -- data is surprisingly difficult, but it's explained here by resident data scientist Dr. James McCaffrey of Microsoft Research, who provides all the code you need for a complete system using an algorithm based on a metric called category utility (CU), a measure how much information you gain by clustering.

  • So What's Up with Microsoft's (and Everyone Else's) Love of Rust?

    Microsoft already stewards several popular programming languages -- C#, TypeScript, F# -- so what's up with its love of Rust, along with the rest of the world?

  • C# Steps Up Programming Language Popularity Ladder

    Microsoft's C# programming language climbed a year-over-year notch on the TIOBE Index, which measures popularity among developers.

  • VS Code Java Tool Updates Debugging, Refactoring

    The monthly update to the tooling that boosts Java development in the open source, cross-platform Visual Studio Code editor highlights debugging, refactoring and more.

  • Microsoft Plugs Away at Blazor for Mobile in Preview 3

    Microsoft is furthering its work to target mobile app development with Blazor, the ASP.NET Core offering that originally was developed to allow for C#-based web development instead of JavaScript through the use of WebAssembly for the client side.

.NET Insight

Sign up for our newsletter.

Terms and Privacy Policy consent

I agree to this site's Privacy Policy.

Upcoming Events