Why ComfyJ

Simple integration

IE automation sample

import com.jniwrapper.win32.automation.Automation;
import com.jniwrapper.win32.automation.OleContainer;
import com.jniwrapper.win32.automation.IDispatch;
import com.jniwrapper.win32.automation.types.Variant;
import com.jniwrapper.win32.ole.types.OleVerbs;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
    
/**
 * This example demonstrates the embedding of Browser component into Java.
 */

public class IEAutomationSample extends JFrame {
    private OleContainer container = new OleContainer();

    public IEAutomationSample() throws HeadlessException {
        super("Internet Explorer ");

        Container contentPane = getContentPane();
        contentPane.setLayout(new BorderLayout());
        contentPane.add(container);

        container.createObject("Shell.Explorer"); // Create Browser component by its ProgID   

        final Automation webBrowserAutomation = new Automation(container.getOleObject());  
        webBrowserAutomation.invoke("Navigate2", new Object[]{"www.teamdev.com"});   

        Variant documentVariant = webBrowserAutomation.getProperty("Document");
        IDispatch document = documentVariant.getPdispVal();
        System.out.println("document = " + document.isNull());

        this.addWindowListener(new WindowAdapter() {
            public void windowOpened(WindowEvent e) {
                // Show browser component, when parent widnow is shown
                container.doVerb(OleVerbs.SHOW);
            }

            public void windowClosing(WindowEvent e) {
                // Destroy the object when window is closed
                container.destroyObject();
            }
        });
    }

    public static void main(String[] args) throws Exception {
        final IEAutomationSample sample = new IEAutomationSample();
        sample.setSize(800, 600);
        sample.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        sample.setLocationRelativeTo(null);
        sample.setVisible(true);
    }
}

COM-to-Java integration


COM Interfaces & Data Types Wrappers

COM interfaces & data types wrappers allow working with COM types and interfaces like ordinary Java objects. For example, you can use IUnknown, IClassFactory, and IDispatch as typical Java interfaces, and Variant(VARIANT), BStr(BSTR), SafeArray etc. as regular Java types.

VTBL & COM Automation

ComfyJ allows invoking methods of a COM object via its function indexes in VTBL (Virtual Method Table), or by its names using the Automation approach. Also, Automation allows for obtaining and setting properties of a COM object, including indexed and named ones.

Support for Multiple Threading Models

ComfyJ provides a set of different concurrency models which you can use for initializing COM integration in your Java application.

DCOM Support

ComfyJ allows you to create a COM object on a remote server.

COM Memory Management

All COM and other native resources will be garbage-collected automatically, or you can release them if required by the application logic.

Embedding of OLE/OCX/ActiveX Components to Swing

ComfyJ includes the OleContainer Swing component, which allows you to:

  • Use any visual COM component (OCX/ActiveX) in Java Swing UI. Using this functionality, you can embed various ActiveX applications, such as Internet Explorer, Acrobat Reader and Microsoft Office, as well as various media components such as Windows MediaPlayer, DVD Player, QuickTime, ShockwaveFlash, etc.
  • Create an embedded object using ProgID, CLSID, or from a document file. Also, you can insert a COM object (which implements IOleObject COM interface) into container.
  • Save and load an embedded OleObject to or from a file in a special binary format.

Handling of COM Events

ComfyJ provides a standard COM technique for creating and advising COM event handlers to a COM object.

ComfyJ feature diagram

CodeGenerator utility

With this bundled application, you can generate Java COM wrappers for COM components or COM Type Libraries. These generated classes allow you to work with COM objects just like regular Java objects. Moreover, this application can compile the generated classes and pack them into a JAR file, if needed.

Java-to-COM integration

This aspect of ComfyJ allows you to create Java COM servers purely in Java. In other words, a designed Java COM server can be exposed as COM objects to other COM applications without writing a line of a native code.


Development of Java COM Servers

To simplify creation of custom Java COM servers, ComfyJ provides the base classes such as IUnknownServer and IDispatchServer so any custom Java COM objects can inherit these classes, depending on application requirements. Such Java COM servers can implement as many COM interfaces as required—from standard COM interfaces and COM interfaces generated by ComfyJ's Code Generator application, to custom ones.

Registration of Java COM Servers

ComfyJ also provides convenient ways for registering created Java COM servers. Such registration can be performed at runtime, i.e., for COM event handlers, or in COM Registry using a bundled ServerManager application. Also, you have the ability to register Java COM servers at runtime without using the ServerManager application. Such registered Java COM servers can be used by other COM applications.

Try the demo

ComfyJ Demo

Run the demo comfyjdemo.jnlp

Runs on Microsoft Windows XP or later with:

  • JDK (JRE): 1.4 or later;
  • Java™ WebStart;
  • To see COM/OLE integration features, Adobe Acrobat Reader version 5.0 or higher is required.

Examples of apps our customers build

Getting help

Contact Support

During evaluation period please use the email address, provided to you in the evaluation email.

If you have an active support subscription, please use the email address, provided to you in the email confirming the license purchase.

Ask a Question

You can ask a question on our product forum. In order to do it, you will need a Google ID.

links.teamdev.com/comfyj-forum

Send email: comfyj-forum@teamdev.com
Your message will be automatically posted on the web.

Evaluation SupportProvided for 30 days

Support Evaluation

Standard SupportProvided for one year with 25% discount for renewal

Support Standard

Premium SupportContract-based time and materials service

Support Premium
Help with the product use Help with the product use Help with the product use
Response within one business day Response within one business day Response within one business day
Provided by email Provided by email Provided by email
Product updates Product updates
Phone, chat and remote desktop
Feature development
Priority issue resolution
Evaluate for Free Request Renewal Request Premium
Keep up the great work, we are existing customers of TeamDev and are very happy with the products supplied! Jeremy Dixon, Thales Australia
We are very happy with ComfyJ, and we are also very happy with the quick responses on the technical forums when we have questions. Jeremy Dixon, Thales Australia

Licensing and pricing

License use is governed by the product license agreement

  • Perpetual Licence Perpetual license
  • Free Distribution Free distribution within your application
  • Support Updates 1 year Support and updates
  • 25% Discount Support renewal with 25% discount
  • 15% Discount 15% discount on TeamDev products

Per Developer $1,149

  • Developer 1 developer
  • Unlimited Projects Unlimited projects
  • Support 55 hours of support for 1 year
Buy Now

Project $3,399

  • Developers Unlimited developers
  • Project 1 project
  • Support 75 hours of support for 1 year
Request License

Company-wide $10,699

  • Developers Unlimited developers
  • Unlimited Projects Unlimited projects
  • Support 300 hours of support for 1 year
Request License

The prices on this page are exclusive of any taxes.

Frequently asked questions

Technical Questions

Is it possible to integrate with a .NET component using ComfyJ?

It is possible only if that .NET component is built with enabled COM interop.

What does the AutoDelete property of the IUknown interface mean?

This property instructs ComfyJ's NativeResourceCollector (NRC) whether to release the COM object automatically or not. By default, this property is set to true for all resources that implement AutoDeleteParameter interface. When this property is set to false, the .release() method should not be called.

How to query a required COM interface from a COM object in ComfyJ?

A required COM interface can be queried using the IUnknown.queryInterface() method, for example:

                            IOleObjectImpl oleObject = new IOleObjectImpl();
                            comObject.queryInterface(oleObject.getIID(), oleObject);
                        

Or
                            IOleObjectImpl oleObject = new IOleObjectImpl(comObject);
                        

Can I use ComfyJ in Java applet?

Yes, ComfyJ can be used in Java applets. There are several examples in ComfyJ distribution archive, in its samples\Applets\src\ subfolder, which demonstrate using of ComfyJ in Java applets.

Can I release a COM object?

Yes, every COM object can be released using its IUnknown#release() method. Make sure to set its AutoDelete property to false before releasing the object.

Does ComfyJ provide the ability to embed an ActiveX component to a Java window?

Yes, ComfyJ provides OleContainer Java component that allows embedding of any ActiveX component.

Where should I put my ComfyJ license files (jniwrap.lic, comfyj.lic)?

The simplest way is to package these files to the \META-INF\ subdirectory of an application JAR file.

How I can redistribute native JNIWrapper library (jniwrap.dll, jniwrap64.dll, etc.) with my application?

The simplest way is to package all required JNIWrapper library files to root folder of an application JAR file.

When I invoke method of a COM object, it throws COM exception: COM object method returns error code: 0x800401F0; CO_E_NOTINITIALIZED

COM should be initialized using ComFunctions.coInitialize() method in each Java thread (except OleMessageLoop) before working with COM objects.

Is it possible to expose Java object to COM using ComfyJ?

Yes, ComfyJ provides the ability to create Java COM servers and register them in COM.

How do I configure the license?

Licensing Questions

What is your licensing based on?

Our licensing is based on versions of ComfyJ. Having purchased the license for our product you get the right to use the current major version of the product.

Can I receive a free upgrade?

Major and minor version upgrades issued during your active Standard Support subscription period are free of charge. Upon expiration of the Standard Support subscription you can renew it with a 25% discount from the actual license price.

What are the terms for using ComfyJ?

Please take a look at the Product License Agreement.

There are 6 people on our team, and 2 of them need to use ComfyJ. How many licenses do we need to purchase?

You only need to purchase 2 licenses. We license our library by the number of people who write code using our library.

If we take a developer, working with ComfyJ, off the project, can we reassign the license to another developer?

This is possible with the Per Developer License.

How many copies of my product can I distribute with ComfyJ included?

You can distribute unlimited number of copies of your product with our library enclosed.

We have 5 people, who work with ComfyJ on one product.

You may want to purchase a Project License, which is cost-effective in case there are 3 and more developers on the team. The Project License is bound to a single project you do, but it allows any number of developers in your company to work with our library.

How is a Project License bound to my project?

Project License is bound to your project via a fully-qualified class name. A fully-qualified name for a class is the package name followed by the class name, separated by a period (.). For example: com.mycompany.myproduct.MyClass

Which class can be used for binding the license?

This can be any class of your application. The only requirement is that it should be included into your Java application class path.

What’s the definition of “project” in terms of the Project License?

When we say “project” we have in mind one product of your company including your future product versions or potential derivative works based on your product.

Will we be able to use the Project License in another project we do?

The Project License is tied to one project only.

We’d like a license for multiple projects for a team of developers, what would you offer?

The best solution would be to purchase the Company–wide License, which covers any number developers and projects in one company.

How do I find the license file?

Upon the license purchase you will receive an archive with two types of license files: development and runtime. Development licenses are intended to be used in the development process. Runtime licenses are to be used for distribution of your software with ComfyJ enclosed.

We need to look at the Source Code of ComfyJ, do you provide it?

Yes, you can purchase ComfyJ Source Code License; it is provided on a per developer basis. Please contact our sales team if you are interested in this option.

Thank you!

Start your free trial in few simple steps

1
Email

Check Your Email

Links to download your evaluation license and distribution archive will arrive at your inbox in a few minutes.

If the message gets lost in your mailbox, try searching for an email from ComfyJ Evaluation Support with “Your Free 30 Days Trial” subject.

2
Licence

Install the License

To start using ComfyJ

  • download your evaluation license,
  • download and extract the distribution archive,
  • include all the JAR files from the lib directory and evaluation license licence.jar in your application class path.
3
Start

Get Started

Take a look at the tutorial to get ComfyJ up and running in no time.

See Support Documentation for more information on using ComfyJ.

Examples

Check out the ready-made examples for instructions and ideas on what you can do with your newly gotten ComfyJ.

Free 30-day trial

We will email you your trial key and a quick start guide.

  • I have read and agreed to the terms of the product license agreement.
  • I agree with the processing of my personal information. We collect your personal information to identify you as our customer and provide you with our products and services. Check out our privacy statement.