Using a java class from Delphi

后端 未结 5 586
南旧
南旧 2020-12-03 11:35

I need to use the logic contained in some java classes. I found JNI, but that project seems not updated recently.

Is there a way to use it in a Delphi native applica

相关标签:
5条回答
  • 2020-12-03 11:52

    A newer solution than JNI is JNA, which also supports callbacks from (Delphi) DLLs. I found it easy to use.

    0 讨论(0)
  • 2020-12-03 11:53

    With Java 6, it takes only a few lines of code to write a standalone web service server which then can be invoked from Delphi.

    small step-by-step tutorial, using the free NetBeans IDE and Delphi:

    • Delphi and Java Integration using Web Services

    more xamples:

    • http://www.theserverside.de/webservice-in-java/
    • http://www.torsten-horn.de/techdocs/jee-jax-ws.htm#Minimaler-Webservice
    0 讨论(0)
  • 2020-12-03 12:09

    Embed the VM in the native code. This worked for me. An example with c can be found here. http://java.sun.com/docs/books/jni/html/invoke.html

    0 讨论(0)
  • 2020-12-03 12:12

    I very much doubt it. Delphi Code gets compiled into an executable while Java code is executed by a Virtual Machine. So unless you launch a complete Virtual Machine inside Delphi code I see no way to easily include the logics.

    0 讨论(0)
  • 2020-12-03 12:13

    You could try j-interop. The technique I should adopt is to build a COM wrapper of java business logic, and using this COM server from delphi throught interoperability.

    Delphi can build a type library of a COM server, and you could istantiate the com server using this typelibrary. Type library is simply a wrapper of the server, exposing its interface to be used by delphi code.

    The key to communicating with different platform softwares is called "interoperability".

    You can find this also in .net versus win32. Tipically delphi code is win32 (exe or dll), and you can build communication protocol between delphi objects and .net assemblies or java bytecode using interoperability solutions.

    0 讨论(0)
提交回复
热议问题