Calling Java from .NET Made Easy with JNBridgePro and Claude Code

JNBridgePro — the fastest, easiest way to bridge Java and .NET in production. Generate proxies in minutes, call Java from C# (or C# from Java) with native syntax — trusted by enterprises worldwide. Learn more · Download free trial

JNBridgePro lets your .NET code call Java classes as if they were native .NET types. But setting up a project from scratch can be daunting — proxy generation, classpath wiring, transport configuration — there are a lot of moving parts to get right.

So we used Claude Code to build a reference project that handles all of that, and then documented the entire thing in a CLAUDE.md file that Claude Code can read. The result: you can point Claude Code at the project, tell it what Java library you want to call from .NET, and it has enough context to walk you through every change.

What’s in the Box

A .NET Framework console app that calls Java’s log4j logging library and a custom Java class through JNBridge-generated proxy DLLs. The project is organized into three folders — Java source, proxy generation tooling, and the .NET project — with orchestrator scripts that build and run everything in one step.

The CLAUDE.md documents every file, every build step, and every configuration flag. This means Claude Code understands the full project structure — when you ask it to swap in a different Java library or change the transport mode, it knows exactly which files to touch and why.

Two Ways to Run: Shared Memory vs. TCP

The demo ships with two build scripts, each demonstrating a different JNBridge transport mode.

buildAndRunSharedMem.bat — Shared Memory Mode

This embeds the JVM directly inside the .NET process. No separate Java process to manage.

  1. Compiles Java source and packages it into a JAR
  2. Generates .NET proxy DLLs — JNBridge scans your JARs and creates C# wrapper classes for each Java class you want to call
  3. Builds the C# project with dotnet build
  4. Generates the runtime config — injects your JVM paths from env.bat into the output config file
  5. Runs the demo

buildAndRunTCP.bat — TCP Mode

This runs Java as a separate process and connects over TCP (port 8085). Useful for debugging the Java side independently or running Java on a different machine.

  1. Compiles Java and generates proxies (same as above)
  2. Builds the C# project
  3. Swaps in the TCP config instead of the shared-memory config
  4. Launches the Java side in a separate console window
  5. Runs the .NET app, which connects to the Java side over TCP
  6. Cleans up the Java process when the demo exits

Getting Started with JNBridgePro

1. Install JNBridgePro and Download Demo

Download JNBridgePro v12.0 from jnbridge.com and run the installer.

Download Demo with claude.md

2. Request a License

After installation, run the JNBridge registration tool to request a license. Go to Registration Key → copy registration key → select “request license” to complete the online license request. We’ll email you a license.

Then, add the license to the build directory or JNBridge install directory.

3. Edit env.bat

This is the only file you need to customize. Open env.bat at the project root and set JAVA_HOME to point to your Java 8 JDK:

set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_202

That’s it. All the build scripts read their Java paths from this one file.

4. Run It

Double-click buildAndRunSharedMem.bat. If everything is set up correctly, you’ll see .NET calling Java.

Adapting It with Claude Code

This is where the CLAUDE.md pays off. Open Claude Code in the project directory and tell it what you want — “swap log4j for my JDBC driver,” “add a new Java class to the proxies,” “switch to TCP mode.” Claude Code reads the documentation and knows the full build pipeline, so it can make the right changes across all the files without you having to trace through the wiring yourself.

Ready to try it? Download JNBridgePro and the Demo to get started. Or check out the Developer Center for more guides and documentation.


Related Articles

Learn more about JNBridgePro: