Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

how to use microsoft speech sdk 5.1 in java application?

843805Mar 8 2006 — edited Mar 8 2006
I download the speech sdk 5.1 from microsoft site,and want to use it in my java application,the following are the codes of the application(it uses boot.jar,swt.jar,jface.jar,runtime.jar,swt-win32-3101.dll) ,but gives me the exception,how should i do?it it is not supported by java,what others can i use?

import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTException;
import org.eclipse.swt.internal.ole.win32.TYPEATTR;
import org.eclipse.swt.ole.win32.OLE;
import org.eclipse.swt.ole.win32.OleAutomation;
import org.eclipse.swt.ole.win32.OleControlSite;
import org.eclipse.swt.ole.win32.OleFrame;
import org.eclipse.swt.ole.win32.OleFunctionDescription;
import org.eclipse.swt.ole.win32.OlePropertyDescription;
import org.eclipse.swt.widgets.Shell;

public class Main
{
    public static void main(String[] args)
    {
    	args = new String[1];
    	args[0] = "Sapi.SpVoice";
        if (args.length == 0)
        {
            System.out.println("Usage: java Main <program id>");

            return;
        }

        String progID = args[0];
        //progID = "word.Document.8";

        Shell shell = new Shell();

        OleFrame frame = new OleFrame(shell, SWT.NONE);
        OleControlSite site = null;
        OleAutomation auto = null;

        try
        {
            site = new OleControlSite(frame, SWT.NONE, progID);
            auto = new OleAutomation(site);
        }
        catch (SWTException ex)
        {
            System.out.println("Unable to open type library for " + progID);
            
            return;
        }
      TYPEATTR typeattr = auto.getTypeInfoAttributes();

}
it gives me the error:
org.eclipse.swt.SWTException: Failed to create Ole Client. result = -2147221164
Unable to open type library for Sapi.SpVoice
at org.eclipse.swt.ole.win32.OLE.error(OLE.java:302)
at org.eclipse.swt.ole.win32.OleControlSite.<init>(OleControlSite.java:100)
Main.main(Main.java:43)
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 5 2006
Added on Mar 8 2006
1 comment
780 views