How do I develop and test with Java 21?

Last reviewed: 11/12/2023

HowTo Article ID: H032317

The information in this article applies to:

  • AudioSearch 4
  • GrammarKit 9
  • KinesicsKit 7
  • LexiconKit 9
  • ProfileKit 9
  • SpeechKit 12
  • SpeechManager 3
  • Talk&Listen 4
  • VoiceMarkupKit 9
  • VoiceXMLKit 6

Summary

Oracle recently released Java 21 as an LTS (long term support) release that provides an extended runway for application development and deployment with this runtime.

More Information

Every new Java release introduces new features and deprecations. The Chant libraries are not affected by Java 21 deprecations and applications can be built with the new runtime.

It is real easy to develop Java apps that speak and listen. Configure the Java environment:

  • Download and install the latest Java JDK from Oracle.
  • Copy the Chant Java .jars from the product installation Java/libvXX folders to the Java JDK lib folder.
  • Add entries for the .jar paths (Java JDK lib) to the classpath system environment variables.
  • Copy the Chant Java runtime .DLLs from the product installation Java/bin folder to the Java JDK bin folder.
  • Copy the Chant Java Speech API .DLLs from the product installation Java/api folder to the Java JDK bin folder.

Configure the samples to build and run:

  • For each sample application, open the frame1.java file in notepad and paste evaluation or licensed credentials in the setCredentials statement.
  • Copy the sample folder to the Java JDK bin folder

Build and run samples:

  • Open command window with Administrator privileges.
  • Compile the sample: javac sample-folder-name/*.java
  • Run the sample: java sample-folder-name.Application1

For SpeechKit Command, Dictation, and Grammar samples, open a separate command window without Administrator privileges and run the samples from there. The reason is that WindowsMedia is the default speech API and WindowsMedia does not run with Administrator privileges.

There are two Synthesis and Transcribe samples illustrated in different product. Be sure to rename folders before copying to prevent overwrite.

The documentation references provide integration steps for Chant class libraries with Java as follows: