Developing Java applications that manage movement

Last reviewed: 10/4/2012

HOW Article ID: H101203

The information in this article applies to:

  • KinectKit

Summary

You can develop Java applications that manage Kinect sensors using your favorite Java development tools. This includes development environments such as Eclipse, IntelliJ, JBuilder, JDeveloper, and NetBeans.

More Information

KinectKit includes Java classes compiled with JDK 1.5, 1.6, and 1.7 to support your application's target runtime environments.

To access the KinectKit Java classes within your application, add the component libraries to your JDK environment:

  1. copy the JKinectKit.DLL file to your Java JDK bin directory;
  2. copy the kinectkit.jar and chant-shared.jar libraries to your Java JDK lib; and
  3. append a path reference for your Java JDK lib\kinectkit.jar and lib\chant-shared.jar paths as a classpath property in your system settings.

To access the KinectKit Java classes within your application, add references to the KinectKit class libraries in your code:


import com.kinectkit.*;
import net.chant.shared.*;

Object Instantiation

Declare a global variable for the ChantKM class, instantiate an instance, set the license and serial properties, and set the event handler.


public class Frame1 extends JFrame implements com.kinectkit.JChantKMEvents
{
    private JChantKM JChantKM1;

    private void jInit() throws Exception
    {
        // Create ChantKM object
        JChantKM1 = new JChantKM();

        // Set license properties
        JChantKM1.setStringProperty(ChantStringProperty.CSPLicense, "LicenseRegistrationNumber");
        JChantKM1.setStringProperty(ChantStringProperty.CSPSerials, "LicenseSerialNumber");

        // Set the callback
        JChantKM1.setCallbackFunction(this,null,null);
    }
}

Event Callbacks

Event callbacks are the mechanism in which the component library communications information back to the application such as compilation is complete or there was an error.


public void hasEvent(Object obj1, Object obj2)
{
    int numberOfEvents = JChantKM1.getResourceCount(ChantSpeechResource.CSREvent, 0, 0);
    for (int i = 0; i < numberOfEvents; i++)
    {
        // Get the event
        JChantKMEvent jevent = JChantKM1.getChantKMEvent(0);
        if (jevent != null) 
        {
            int callback = jevent.getChantCallback();
            switch(callback)
            {
                default :
                    break;
                case ChantCallback.CCKSStatusChanged :
                    ...
                    break;
            }
        }
        JChantKM1.removeResource(ChantSpeechResource.CSREvent, 0);
    }
}

Deployment Checklist

When you are ready to deploy your application, you need to ensure you have a valid license, bundle the correct Chant component libraries, and configure your installation properly on the target system. Review the following checklist before deploying your applications:

  • You may deploy your Java application to any system with a valid license from the Chant.
  • Copy kinectkit.jar and chant-shared.jar to the target system Java JRE lib directory and/or ensure the classpath includes the path where the kinectkit.jar and chant-shared.jar libraries are placed on your target system.
  • Copy JKinectKit.dll to the target system Java JRE bin directory.

Sample Projects

Java sample projects are installed at the following location:

  • My Documents\Chant KinectKit\Win32\Java\JDK.

For additional help with KinectKit, contact Chant Support via Chant Support Contacts or web.