How do I develop Java applications that manage conversations?
Last reviewed: 3/4/2013
HOW Article ID: H031303
The information in this article applies to:
- VoiceXMLKit
Summary
You can develop Java applications that manage conversations using your favorite Java development tools. This includes development environments such as Eclipse, IntelliJ, JBuilder, JDeveloper, and NetBeans.
More Information
VoiceXMLKit includes Java classes compiled with JDK 1.5, 1.6, and 1.7 to support your application's target runtime environments.
To access the VoiceXMLKit Java classes within your application, add the component libraries to your JDK environment:
- copy the JVoiceXMLKit.DLL file to your Java JDK bin directory;
- copy the voicexmlkit.jar and chant-shared.jar libraries to your Java JDK lib; and
- append a path reference for your Java JDK lib\voicexmlkit.jar and lib\chant-shared.jar paths as a classpath property in your system settings.
- copy the JVoiceXMLKitX64.DLL file to your Java JDK bin directory;
- copy the voicexmlkit.jar and chant-shared.jar class libraries to your Java JDK lib; and
- append a path reference for your Java JDK lib\voicexmlkit.jar and lib\chant-shared.jar paths as a classpath property in your system settings.
To access the VoiceXMLKit Java classes within your application, add references to the VoiceXMLKit class libraries in your code:
import com.voicexmlkit.*;
import net.chant.shared.*;
Object Instantiation
Declare a global variable for the ChantXM class, instantiate an instance, set the license and serial properties, and set the event handler.
public class Frame1 extends JFrame implements com.voicexmlkit.JChantXMEvents
{
private JChantXM JChantXM1;
private void jInit() throws Exception
{
// Create ChantXM object
JChantXM1 = new JChantXM();
// Set license properties
JChantXM1.setStringProperty(ChantStringProperty.CSPLicense, "LicenseRegistrationNumber");
JChantXM1.setStringProperty(ChantStringProperty.CSPSerials, "LicenseSerialNumber");
// Set the callback
JChantXM1.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 = JChantXM1.getResourceCount(ChantSpeechResource.CSREvent, 0, 0);
for (int i = 0; i < numberOfEvents; i++)
{
// Get the event
JChantXMEvent jevent = JChantXM1.getChantXMEvent(0);
if (jevent != null)
{
int callback = jevent.getChantCallback();
switch(callback)
{
default :
break;
case ChantCallback.CCXMCompileDone :
...
break;
case ChantCallback.CCXMCompileError :
...
break;
}
}
JChantXM1.removeResource(ChantSpeechResource.CSREvent, 0, 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 voicexmlkit.jar and chant-shared.jar to the target system Java JRE lib directory and/or ensure the classpath includes the path where the voicexmlkit.jar and chant-shared.jar libraries are placed on your target system.
- Copy JVoiceXMLKit.dll to the target system Java JRE bin directory.
- You may deploy your Java application to any system with a valid license from the Chant.
- Copy voicexmlkit.jar and chant-shared.jar to the target system Java JRE lib directory and/or ensure the classpath includes the path where the voicexmlkit.jar and chant-shared.jar libraries are placed on your target system.
- Copy JVoiceXMLKitX64.dll to the target system.
Sample Projects
Java sample projects are installed at the following location:
- My Documents\Chant VoiceXMLKit\Win32\Java\JDK.
- My Documents\Chant VoiceXMLKit\Win64\Java\JDK.
For additional help with VoiceXMLKit, contact Chant Support via or web.