WINSOFT components and applications

Java4Delphi

Creates Delphi .pas files from Java .class files and Java .jar archives so Java classes and libraries can be used from Delphi code.

Example

// Java code:

package test;

class Test {
	public Test() {
	}

	public String hello() {
		return "Hello, world!";
	}
}
// Generated Delphi interface:

type
  Itest_Test = interface(Ijava_lang_Object)
    function hello: string;
  end;

  Ttest_Test = class(Tjava_lang_Object, Itest_Test)
  public
    constructor Create(JavaObject: JObject); overload;
    constructor Create; overload;
  end;

  Ttest_TestClass = class(Tjava_lang_ObjectClass)
  public
    property _initID: JMethodID read F_initID;
    property helloID: JMethodID read FhelloID;
  end;

function Get_test_TestClass: Ttest_TestClass;

// Usage:

JavaBridge := TJavaBridge.Create;
ShowMessage(Ttest_Test.Create.hello);
Download Java4Delphi 2.0 trial version
Order Java4Delphi license $340 USD
Order Java4Delphi year upgrades $170 USD (registered users only)
Order Winsoft Component Package

FAQ

Why JNI_CreateJavaVM throws SEGV exception "$C0000005: read of address 0x00000000" in Delphi IDE?

Ignore this exception, it's generated intentionally in JVM to detect some HW/OS features: Exception 0xC0000005 from JNI_CreateJavaVM

Why 'The specified module cound not be found: C:\Program Files (x86)\Java\jre1.8.0_311\bin\client\jvm.dll' exception is raised?

Add JRE bin folder to PATH environment variable: C:\Program Files (x86)\Java\jre1.8.0_311\bin

Useful Links

Icon Convert Java Class Files and .jar Archive Files into Delphi Modules Using the Java4Delphi Tool

Icon JavaBridge
Icon Java Language and Virtual Machine Specifications
Icon Java Native Interface Specification Contents
Icon OpenJDK