Java call C Dll DTJCB Bridge2Java Java2COM

Java call C Dll

 

The java2com Project: A Java to COM Bridge


This is development tool for bridging the communication gap between Java and COM applications. It enables the integration of both COM and Java based components in one application and allow these components to communicate bi-directionally through Java Native Interface technology.

The Situation
Many organisations use Microsoft Excel as a mode of information exchange, as most non-programmers, business analysts, and project/program managers are comfortable with that technology and in most cases, these people build complex calculations and business rules in Excel spreadsheets to help determine and deliver this important information. The ability to use Java to parse, gather, and consolidate data from Excel documents proves useful. The Java-To-COM bridge allows programmers to quickly complete those tasks. It can be used to complete pure Java ports of file formats based on Microsoft's OLE (Object Linking and Embedding) 2 compound document format (used by Microsoft Excel, Microsoft Word, and so on).
The Challenge
Many developers are quick to realize the importance of using a company"s spreadsheet model to drive the business logic in their applications. However, most of these same developers, struggle with automating or incorporating the traditionally manual manipulation of spreadsheets in their projects because of Excel"s desktop-bound application architecture. In fact, most Java developers avoid the issue altogether and translate the Excel functions and formulas provided by their spreadsheet experts into Java code.
 The Solution
The Java-To-COM Bridge provides the proper Pure Java library for effectively integrating spreadsheet models into Java applications and provides a robust API that includes the ability to:

  • Read in Excel spreadsheets,

  • Update data values and formulas at the cell level,

  • Force recalculations,

  • And export data as Excel workbooks, individual values from cells, XML, or to a database.


Choose a link below to download base package (JNI library, Java Proxy Class Generator):

  • The download size of the core package: java2com.zip (79.1 KB).
    It contains java2com.dll (has to be on system path) and set of classes to call COM API IDispatch interface methods (via java naitive interface).

  • If you wants to generate java wrapper classes for ActiveX library you have to download Proxy Class Generator:
    java2comGenerator.zip = 225 KB (231,288 bytes).
    It contains java2comGen.dll (has to be on system path), set of classes to call ITypeLib API (via java naitive interface) and Oracle 10g XDK JAXP implementation xml.jar, xmlparserv2.jar place anywhere in your classpath (see java2comGenerator.jar manifest file).
    Workflow: ITypeLib data exported as xml and then xslt generates Java proxy/wrapper classes.
    If size of selected type library is more than 50 types, I do not recommend using Xerces parser (too slow).
    I have found that Oracle 10g XDK (download free from Oracle OTN) is 5 to 10 times faster (and its is also XSLT 2.0 compliant).

License Purchase Information

Sample AxtiveX Libraries (more can be generated on request)

Sample ActiveX library

Download proxy package

Examples/Utilities

Launch/B>

MS Internet Explorer

ie6.jar

IETest.java, IEWindowTest.java

Windows Media Player

wmp.jar

WMPWindowTest.java

MS Office 2000

word9.jar, excel9.jar, ppt9.jar

Excel9Runner.java, WordReportTest.java, WordTest.java

MS Office XP

word10.jar, excel10.jar, ppt10.jar

Excel10Runner.java, PowerPointTest.java

MS Office 2005

 

 

MS Agent

msagent20.jar

MSAgentTest.java

 

N.B.Some providers do not offer modifications to the current apache installation (/conf/mime.types needs extra line application/x-java-jnlp-file jnlp) web server can not send application type: application/x-java-jnlp-file, that will instruct browser to launch JavaWebStart application on user computer rather then displaying this as a text file. So, Please save jnlp file on your computer and run it as application.

List of changes

Version

Date

Change

1.4.0 (See more..)

31 Aug 06

Embed ActiveX controls inside Java GUI ( IEWindowTest.java WMPWindowTest.java):

  • Get the HWND of a Java Heavy Weight component (DispatchUtils.getHWND(canvasComponent)).

  • Attach an activex control as a child of the HWND above.

See http://www.codeproject.com/java/javacom.asp

1.3.0

11 Jun 05

Proxy Class Generator for Java2COM transformation fixed for getter/setter.

1.2.0

11 Jun 05

Proxy Class Generator for Java2COM tool released.

1.1.0

14 Mar 05

COM Objects created as COMConstants.CLSCTX_SERVER (in-process or out-of-process local or remote).
Remove COMConstants interface from Dispatch implements list.

1.0.0

1 Feb 05

java.util.Date can be used where Variant VT_DATE required (String used before)

0.9.9

18 Jan 05

Bug fixed (Terminating OLE Server caused JVM termination)

0.9.8

10 Jan 05

Same as 0.9.7 (minor bug fixed in java2com.dll)

0.9.7

Dec-04

Utility methods (isServerRunning(String clsid/progid), getActiveObject(String clsid/progid)) moved from Dispatch to DispatchUtils class. OleEnvironment::Initialize() automatically called inside Dispatch, DispatchUtils methods (once per current thread).

0.9.6

Oct-04

All JNI calls made exception safe (OleEnvironment.cpp, Dispatch.cpp and Variant.cpp)

0.9.5

Sep-04

Added capability to connect to the running instance of ActiveX server (eg MS Word, Excel, etc) via Dispatch::getActiveObject(String clsid/progid)

0.9

Feb-04

Core package and selected ActiveX libraries published

Some known Java-COM projects

Project

License

Development Tool for Java-COM Bridge from IBM alphaWorks.

USD 2,000

Interface Tool for Java is available from IBM alphaWorks.

USD 2,000

Java2COM NevaObject Technology http://www.nevaobject.com/_docs/_java2com/java2com.htm

USD ?

jacoZoom is a java class library which allows you to use ActiveX Controls and ActiveX Servers (COM/DCOM/Automation) with java.

Developer license EUR 199

Java2COM Bridge http://argussoftware.net

Developer license USD 100

Steve Lewis' Web Page http://www.lordjoe.com/Java2Com

Free

The JACOB project http://danadler.com/jacob/

Free



Differences between DTJCB and Interface Tool for Java
A similar tool to DTJCB Interface Tool for Java (also known as Bridge2Java) -- is also available on the IBM alphaWorks site (see Resources). The following table summarizes the differences between the two technologies. It's intended to provide some general information for purposes of comparison. If you need to put the tool(s) to production use, you should perform a more-detailed analysis before making your selection.

Feature

DTJCB

Bridge2Java

Java2COM

Java-to-COM calls supported.

Yes

Yes

Yes

Java-to-COM calls made via IDispatch interface

No

Yes

Yes

Java-to-COM vtable calls directly to specific interface

Yes

No

No

COM-to-Java calls supported (that is, Java implementations of COM interfaces)

Yes

No

No

COM servers can be instantiated from Java client

?

No

Yes

Java servers can be instantiated from COM client

Yes

No

No

Java servers can be dynamically registered in COM Running Object Table

Yes

No

No

Multiple Java servers can be loaded in separate independent class loaders (that is, each with its own classpath)

Yes

No

No

Programmatic access to APIs of running Java application via VBScript (without generating any bridge)

Yes

No

No

Safe type conversion support (that is, type conversion via QueryInterface)

Yes

No

No

Scalable. Supports generating bridges for type libraries that import other type libraries (that is, Java code references types defined in bridges generated for imported type libraries)

Yes

No

No

COM _NewEnum properties accessible via java.util.Enumeration interface.

Yes

No

No

Supports creating a COM object using a ProgId instead of a CLSID

Yes

No

Yes

Embed ActiveX controls inside Java GUI

?

Up to Java1.3

Yes

Multithreading support.

Yes

?

Same as JNI

 

posted on 2009-12-15 11:25  cy163  阅读(1267)  评论(1编辑  收藏  举报

导航