Menu

Migration from jacob 1.16 to 1.6

Help
2012-02-24
2013-05-20
  • Stanislav Spiridonov

    I want to migrate from jacob 1.16 to 1.6, but there are some differences and I have some questions about that.

    ActiveXComponent
    

    doesn't have method

    invoke(String arg0)
    

    , it has

    ivoke(String arg0, Variant[] arg2)
    

    . For what is this array of Variants?

     
  • Stanislav Spiridonov

    I open the source code and find that:

      public Variant invoke(String name, Variant[] args)
      {
        return Dispatch.callN(this, name, args);
      }
    

    That means it invokes method with name : "name" and parameters of invoked method "args" . Can anybody give an example?

     
  • Stanislav Spiridonov

    I use jacob 1.7 and create the following source code:

        public static void main(String[] args) {
    
            ActiveXComponent wmi = new ActiveXComponent("WbemScripting.SWbemLocator");
            Object wmiObject = wmi.getObject();
    
            Dispatch sWbemServices = Dispatch.call(wmiObject, "ConnectServer").toDispatch();
    
            String query = "select *"
                    + "from Win32_NtLogEvent "
                    + "where Logfile = 'osession' and TimeGenerated > '20120223000000.000000-***'";
    
            Variant vCollection = Dispatch.call(sWbemServices, "ExecQuery", new Variant(query));
            Variant numOfElementsInCollection = Dispatch.get(vCollection.toDispatch(), "Count");
            System.out.println(numOfElementsInCollection);
        }
    

    But when I compile it, it returns :
    # A fatal error has been detected by the Java Runtime Environment:
    #
    #  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x77b55345, pid=1948, tid=5748
    #
    # JRE version: 7.0_03-b05
    # Java VM: Java HotSpot(TM) Client VM (22.1-b02 mixed mode, sharing windows-x86 )
    # Problematic frame:
    # C 
    #
    # Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
    #
    # An error report file with more information is saved as:
    # C:\Users\smarinov\workspace\JacobTest17\hs_err_pid1948.log
    #
    # If you would like to submit a bug report, please visit:
    #   http://bugreport.sun.com/bugreport/crash.jsp
    # The crash happened outside the Java Virtual Machine in native code.
    # See problematic frame for where to report the bug.

    Can anybody tell me where I wrong?

     
  • clay_shooter

    clay_shooter - 2012-04-25

    Did you mean you are migrating from 1.6 to 1.16 instead of the reverse in the title?

     

Log in to post a comment.