How to resolve JIExceptionorg.jinterop.dcom.common.JIException, Error code 0x00000002

Charan
2013-12-03
2013-12-03
  • Charan
    Charan
    2013-12-03

    Hi folks,

    I am trying to call .exe remotely from my java code. But, I ended up with the following exception.


    JIExceptionorg.jinterop.dcom.common.JIException: The system cannot find the file specified. Please check the path provided as parameter. If this exception is being thrown from the WinReg package, please check if the library is registered properly or do so using regsvr32. [0x00000002]
    at org.jinterop.winreg.smb.JIWinRegStub.winreg_OpenKey(JIWinRegStub.java:195)
    at org.jinterop.dcom.core.JIProgId.getIdFromWinReg(JIProgId.java:129)
    at org.jinterop.dcom.core.JIProgId.getCorrespondingCLSID(JIProgId.java:160)
    at org.jinterop.dcom.core.JIComServer.(JIComServer.java:428)
    at com.jinterop.SampleJinterop.main(SampleJinterop.java:36)

    I didn't get how to register WinReg. Could anyone please help me to get out of this problem.

    Here is my code snippet.

    try {

    JISession session = JISession.createSession(domainName, userName,
    password);
    JISystem.setAutoRegisteration(true);

    JIComServer comServer = new JIComServer(
    JIProgId.valueOf("E://soft//Eclipse3.7//eclipse.exe"),
    "localhost", session);
    // Instantiate the COM Server
    IJIComObject comObject = comServer.createInstance();
    // Get a handle to it's IDispatch
    IJIDispatch dispatch = (IJIDispatch) JIObjectFactory
    .narrowObject((IJIComObject) comObject
    .queryInterface(IJIDispatch.IID));
    Object results[] = dispatch.callMethodA("GetComplexType",
    new Object[] { 1 });

    System.out.println(results[0]);

    JISession.destroySession(session);

    } catch (JIException e) {
    System.out.println("JIException");
    e.printStackTrace();
    } catch (java.net.UnknownHostException e) {
    System.out.println("UnknownHostException");
    e.printStackTrace();
    }

    And also I have one more doubt, is it possible to access executable of Linux machine using the above code.

    Thanks in advance.