B4J Question COM Server integration

Discussion in 'B4J Questions' started by StarinschiAndrei, Jul 12, 2018.

Tags:
  1. StarinschiAndrei

    StarinschiAndrei Active Member Licensed User

    Hello,
    I would like to interface my app with a COM server(ActiveX object) is anybody tell me if is possible or how can i do that ? upload_2018-7-12_17-26-3.png
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    I don't think that it is possible.
     
  3. keirS

    keirS Well-Known Member Licensed User

    In theory it is. There are several Java libraries that use JNI to call COM objects. The free ones are all quite old though and the commercial ones are expensive.
     
  4. StarinschiAndrei

    StarinschiAndrei Active Member Licensed User

    I tried to google it but no result. I will digging .... it should be nice to have a solution to use directly from my app. Thank you for your advice.
     
  5. keirS

    keirS Well-Known Member Licensed User

    DonManfred likes this.
  6. StarinschiAndrei

    StarinschiAndrei Active Member Licensed User

  7. Don Oso

    Don Oso Member Licensed User

    You can integrate that with JACOB i do a simple Test using Excel its necessary extend this in order to use all the methods and property of the Activex object.

    Code:
    #Region Project Attributes
        
    #MainFormWidth: 600
        
    #MainFormHeight: 600
    #End Region

    #MergeLibraries: True
    #AdditionalJar: jacob.jar
    #AdditionalJar: commons-collections4-4.1

    Sub Process_Globals
        
    Private fx As JFX
        
    Private MainForm As Form
        
    Private ocx As activeXComponent
        
    Private Button1 As Button
        
    Private Label1 As Label
    End Sub

    Sub AppStart (Form1 As Form, Args() As String)
      
      
        MainForm = Form1
        MainForm.RootPane.LoadLayout(
    "1"'Load the layout file.
        MainForm.Show
      
      
        ocx.Initialize(
    "Excel.Application")
      

      
    End Sub

    'Return true to allow the default exceptions handler to handle the uncaught exception.
    Sub Application_Error (Error As Exception, StackTrace As StringAs Boolean
        
    Return True
    End Sub

    Sub Button1_Click
      
        Label1.Text=ocx.getProperty(
    "Version")
      
    End Sub
     

    Attached Files:

    keirS, Erel and rboeck like this.
  8. rboeck

    rboeck Well-Known Member Licensed User

    Hi from austria,

    i tried your sample, but i didnt find the right place for jacob-1.19-x64; i get this message:
    java.lang.UnsatisfiedLinkError: no jacob-1.19-x64 in java.library.path; i tried to copy this dll file to the external libraries path, to the java jdk/lib path and to windows\system32; where is the correct path for java dll libraries?

    Solved: The correct path in my situation is: c:\program files\Java\Jdk 1.8.xxxx\jre\lib\jacobxxx.dll
     
    Last edited: Aug 16, 2018
  9. Don Oso

    Don Oso Member Licensed User

    Hi rboeck , you must put the .dll in the same directory of your compiled .jar, in your case put the .dll in Objects directory .

    regards
     
    rboeck likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice