Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!
DelphiTech Partner

Delphi library for interoperability with Java using WINSOFT JavaBridge


Java Native Interface is a standard programming interface for writing Java native methods. Most JNI developers utilize C/C++ but most of the JNI header files ported to Delphi.

In a simple word: Java Native Interface (JNI) is the Java interface to non-Java code. And when you work with data types you should always convert data between Delphi and Java.

JavaBridge library WINSOFT offers you to interoperate with Java using JNI. This is a commercial library and if you wish to utilize the JavaBridge, you must register a license.


Why use Java Native Interface?

  • Legacy code wrapper
  • Low-level specifics not provided by Java
  • Performance
  • Reuse: Allow access to use native code

Through JNI interface pointer, native code can:

  • Access field
  • Operate on Classes
  • Catch and Throw exceptions
  • Call methods
  • Manipulate strings and arrays


After downloading the library you should add the library path. Here you can watch a short tutorial on how to configure them


The next step is to open the Examples folder, then Delphi, and you can select either Java4Delphi or Delphi4Java folder there you can execute build32.bat file which creates Test.exe or Test.dll file for you.

Let’s try to convert Java into Delphi.

Start build32.bat file. This batch file creates an executable file using Test.dpr file and connects Test.java source code.

Here is how we are calling the Java code and using the JavaBridge library in Delphi:

And Test.java source code:

  • As you can see we are using JClass, JObject, JMethodID to play with Test.java source code.
  • Before creating an instance you should create Java VM.
  • And here is how you can call a method

Delphi for Java demo is a bit different, it generates you to a dynamic link library. Then you can call native (DLL) code from Java using JNI.

You can check how it is creating an executable file and dynamic link library by opening the build32.bat batch file.

Head over and check out the full WINSOFT JavaBridge library.

Like what you see? You can get the JavaBridge Library and over 100 other fantastic WinSoft components with our Enterprise Component Pack. For a limited time, when you purchase RAD Studio Enterprise or Architect Edition at special Upgrade Pricing, you will also get this package of third-party software worth over $13,000, including the full WinSoft Component Library, at NO EXTRA COST! Step up to RAD Studio 10.4.1 today!

Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

About author

Software Developer | CS(CyberSec) Undergrad at APU Malaysia | Delphi/C++ Builder Enthusiast | Microsoft Learn Student Ambassador | Microsoft Azure Certified

1 Comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.