Last reviewed: 3/23/2024 9:48:45 AM
Java Applications
Develop Java applications that manage speaker profiles using your favorite Java development tools. This includes development environments such as Eclipse, IntelliJ, JDeveloper, and NetBeans.
The following sections describe the steps for integrating GrammaKit with Java applications.
JRE Configuration
ProfileKit includes Java libraries for JDK 1.8, 11, 17, and 21 to support most applications' target runtime environments. If you need a specific target runtime, then contact Chant Product Support.
To access the ProfileKit Java classes within your application, add the class libraries to your JDK environment:
- copy the JProfileKit.DLL file to your Java JDK bin directory;
- copy the applicable 32-bit speech API DLL file(s) to your Java JDK bin directory;
- copy the profilekit.jar and chant.shared.jar libraries to your Java JDK lib; and
- append a path reference for your Java JDK lib\profilekit.jar and lib\chant.shared.jar paths as a classpath property in your system settings.
- copy the JProfileKitX64.DLL file to your Java JDK bin directory;
- copy the applicable 64-bit speech API DLL file(s) to your Java JDK bin directory;
- copy the profilekit.jar and chant.shared.jar class libraries to your Java JDK lib; and
- append a path reference for your Java JDK lib\profilekit.jar and lib\chant.shared.jar paths as a classpath property in your system settings.
To access the ProfileKit Java classes within your application, add references to the Chant shared and ProfileKit class libraries in your code:
import com.profilekit.*;
import net.chant.shared.*;
Object Instantiation
Declare a global variable for the ProfileKit class, instantiate an instance, set the credentials, and set the event handler.
public class Frame1 extends JFrame implements com.profilekit.JChantProfileKitEvents
{
private JProfileKit _ProfileKit = null;
private JSAPI5Profile _Profile = null;
private JSAPI5Recognizer _Recognizer = null;
private void jbInit() throws Exception
{
_ProfileKit = new JProfileKit();
if (_ProfileKit != null)
{
// Set credentials
_ProfileKit.setCredentials("Credentials");
_Recognizer = _ProfileKit.createSAPI5Recognizer();
if (_Recognizer != null)
{
// Optionally, set the callback object
_Recognizer.setChantProfileKitEvents(this);
// Optionally, register for callback
_Recognizer.registerCallback(ChantProfileKitCallback.CCAPIError);
}
}
}
}
ProfileKit Java applications require the profilekit.jar and chant.shared.jar in the target system Java JRE lib directory and/or ensure the classpath includes the path where the profilekit.jar and chant.shared.jar libraries are placed on your target system. The ProfileKit library (JProfileKit.dll or JProfileKitX64.dll) and the applicable ProfileKit Speech API library must be in the target system Java JRE bin directory.
Speech API | ProfileKit Speech API class | ProfileKit Speech API library |
---|---|---|
Microsoft SAPI 5 | JSAPI5Recognizer | CProfileKit.SAPI5.dll or CProfileKitX64.SAPI5.dll |
Microsoft Speech Platform | JMSPRecognizer | CProfileKit.MSP.dll or CProfileKitX64.MSP.dll |
Nuance Dragon NaturallySpeaking | JDgnRecognizer | CProfileKit.Dgn.dll or CProfileKitX64.Dgn.dll |
Event Callbacks
Event callbacks are the mechanism in which the class object sends information back to the application such as compilation is complete or there was an error.
// Event Handler
public void apiError(Object sender, ChantAPIErrorEventArgs args)
{
System.out.println(
String.format("(%d) %s %s", args->getRC(), args->getFunction(), args->getMessage())
);
}
Development and Deployment Checklist
When developing and deploying Java applications, ensure you have a valid license, bundle the correct Chant class libraries, and configure your installation properly on the target system. Review the following checklist before developing and deploying your applications:
- Develop and deploy Java applications to any system with a valid license from Chant. See the section License for more information about licensing Chant software.
- Copy profilekit.jar and chant.shared.jar to the target system Java JRE lib directory and/or ensure the classpath includes the path where the profilekit.jar and chant.shared.jar libraries are placed on your target system.
- Copy JProfileKit.dll to the target system Java JRE bin directory.
- Copy applicable 32-bit ProfileKit Speech API DLL(s) to the target system Java JRE bin directory.
- Develop and deploy Java applications to any system with a valid license from Chant. See the section License for more information about licensing Chant software.
- Copy profilekit.jar and chant.shared.jar to the target system Java JRE lib directory and/or ensure the classpath includes the path where the profilekit.jar and chant.shared.jar libraries are placed on your target system.
- Copy JProfileKitX64.dll to the target system.
- Copy applicable 64-bit ProfileKit Speech API DLL(s) to the target system Java JRE bin directory.
Sample Projects
Java sample projects are installed at the following location:
- Documents\Chant\ProfileKit 10\Java.