Wednesday, September 08, 2010
Search Blogs Minimize
Print  
All Blog's Minimize
There are no categories in this blog.
Print  
Archive Minimize
Print  
Travsys Blogs Minimize
Sep17

Written by:lex
9/17/2007 

Today I have experimented a bit with a java to com bridge. The aim was to make the CCP accesable from a Java application.

After some webseach I found various free and comercial tools. Eventually I choose to experiment with com4j which is a opensource toolset to create wrappers between Java and com.

https://com4j.dev.java.net/

Look a the tutorial is looked like exactly what we needed, so first I started of trying one of the included samples. This was not very successfull as I got none of them to work. Later I tried to create a wrapper for the CCP using there include tool. This worked fine, so now I have a wrapper..

I wrote the following small text applicatio:

import com4j.COM4J;
//import ICCPApp;
//import ISession;
//import ClassFactory;
 
public class Main {
  public static void main(String[] args) {
    com4j.Com4jObject obj = ClassFactory.createCCPApplication();
    ICCPApp app = obj.queryInterface(ICCPApp.class);
    app.showWindow((short)7);
    app.openSession("test");
  }
}

 

And tried to run it. Unfortunately whatever I did it always throwded an exception. Aftler long and frustation debug sessions I found the included com4j.dll needed to be regsvr32'd, I am still not sure why this is but this was one of the last things I did before its started working.

Now there is one issue left, It works when I run it under eclipse but when I start it standalone it still does not work. This is problly a missing classpath or other command line option I have to pass. Anyway I left this as an excercise for the reader.

 

Conclusion: It is possible to create I Java to CCP bridge.

Other comment I like to make, the same experiment but then to bridge C# .NET to the CCP took me less than 5 minutes!

Tags:
Copyright 2009 by Travsys BV Terms Of UsePrivacy Statement