• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

new to jsapi

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
please help how completly run jsapi in netbeans . i tried the example for speech recognition but error is displayed. Some one who try it and get expected out put help .And also how to load the grammer file. i appriciet your help. thanks
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

error is displayed.


What error is that? Is there a stack trace to go along with it?
 
Kebede Abdi
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks alot! it is really amessing to get a reply soon.
the error is :
rec deallocate is unreported exception javax.speech.EngineException;mustbe caught or declared to be thrown
 
Sheriff
Posts: 22850
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's a compiler error. javax.speech.EngineException is a checked exception, so you should follow the instructions in the error message: catch it (try-catch block) or add it to the throws clause of your method.
 
Kebede Abdi
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks friends !

i fix that error with try-catch block.like this
try{
rec.deallocate();
System.exit(0);
catch(Exception ex){ex.fillInstackTrace();}

but what happened to this

public void resultAccepted(ResultEvent e)

there is red underline on resultAccepted
i ignore it and run the program but there is error on line 35 as

java.lang.NullPointerException
at javaapplication19.HelloWorld.main(HelloWorld.java:35)

My final question: before the HelloWorld example 0n the site
http://java.sun.com/products/java-media/speech/forDevelopers/jsapi-guide/Recognition.html#7408
there is a grammar and it says Place this grammar into a file
is that important if so how can i do that? i'm really new to it. If there is another information which i must know about JSAPI please help friends thanks!

 
Rob Spoor
Sheriff
Posts: 22850
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Although the problem occurs when calling jsapi, the real problem is basic Java - exception handling, missing methods, etc. Moving to JiGb
 
Marshal
Posts: 80754
486
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please tell us exactly where you get the NullPointerException, and then go through the line and see which object references might be null.
 
author
Posts: 9050
21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
consider making this an intermediate thread...
 
Campbell Ritchie
Marshal
Posts: 80754
486
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree with Rob that finding the location of an NPE is a beginner's topic.
 
Kebede Abdi
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For what Campbell asks the NullPointerException is at a line rec.allocate();
 
Campbell Ritchie
Marshal
Posts: 80754
486
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Assuming there is nothing else on the line, this suggests the rec object was null at that point.
  • Have you instantiated rec correctly? Probably in the constructor.
  • Has rec been reassigned to null?
  • Has anything been serialised and rec been lost on the way?
  • Has rec somehow been passed as null?
  • There is a good chance that you will know how to sort out the NPE when you have answered those questions.

    Then let's see whether any problems remain; if it is a JSAPI problem still, it might then be necessary to move this thread again.
     
    Kebede Abdi
    Greenhorn
    Posts: 11
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Ok! friends i will fix it
    But please tell me how to work with JSGF and JSAPI on netbeans
    to load the grammar thanks for help!
     
    Kebede Abdi
    Greenhorn
    Posts: 11
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    hi!!
    please tell me about them!
     
    Bartender
    Posts: 11497
    19
    Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Dawit,
    We have lots of forums here, arranged by category.
    To get the most of the ranch, always remember to choose a proper forum.

    Since your new question is related more to IDEs I suggest you post it here to get a better response
    Also please start a new thread for a new question.
     
    Kebede Abdi
    Greenhorn
    Posts: 11
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    THANKS Maneesh and thankyou all!
    i try my best but...
    Any one who run the HelloWorld example in netbeans
    the example is on the site
    http://java.sun.com/products/java-media/speech/for...pi-guide/Recognition.html#7408
    please show me. I badly need it, after i know it well i'm going to use jsapi for another appliction .
    please from the scratch.
    Thanks for bighearted help that is why i feel free!!!
     
    Kebede Abdi
    Greenhorn
    Posts: 11
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    hello friends !!!
    i fix the NPE error by running my program on diffirent PC .

    i use You may be an all the neccerary steps for file reader

    FileReader reader = new FileReader("C:/Documents and Settings/dawi2137/Desktop/hello.gram");
    RuleGrammar gram = rec.loadJSGF(reader);

    Now i get problem on FileReader like this
    java.io.FileNotFoundException: C:\Documents and Settings\dawi2137\Desktop\hello.gram (The system cannot find the file specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:106)
    at java.io.FileInputStream.<init>(FileInputStream.java:66)
    at java.io.FileReader.<init>(FileReader.java:41)
    at javaapplication1.HelloWorld.main(HelloWorld.java:31)
    how can i fix it?
     
    Maneesh Godbole
    Bartender
    Posts: 11497
    19
    Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    The problem is here

    java.io.FileNotFoundException: C:\Documents and Settings\dawi2137\Desktop\hello.gram (The system cannot find the file specified)



    Make sure the file exists.
     
    Kebede Abdi
    Greenhorn
    Posts: 11
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I create the file and save in the path mentioned as hello.gram!

    And i'm sure that the file is regular file not a directory.
     
    Kebede Abdi
    Greenhorn
    Posts: 11
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    now the file is allready read but nowthe error is
    the grammar name is not specified at public what is happing
    i follow all the procedure
     
    Campbell Ritchie
    Marshal
    Posts: 80754
    486
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    No longer a beginner's topic.

    Moving.
     
    Kebede Abdi
    Greenhorn
    Posts: 11
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Sorry for disterbance and THANKS A lot for being with me!
    I done it all what i need before i recieve your message . No More Biginner men just i begin it.!!!'''''''''''But........
     
    With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    reply
      Bookmark Topic Watch Topic
    • New Topic