This week's book giveaway is in the Testing forum.
We're giving away four copies of Data Structures the Fun Way: An Amusing Adventure with Coffee-Filled Examples and have Jeremy Kubica on-line!
See this thread for details.
  • 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 ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

Exception Problem

Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have Java code as below:

package expertvoice;

* @author Oyelami
//import jess.*;
import jess.JessException;
//import java.util.Iterator;
public class expertvoice {

* @param args the command line arguments
public static void main(String[] args) {
// TODO code application logic here
Symptoms s=new Symptoms("sweating", "headache", "diarrhea");
DiagnosingEngine engine = new DiagnosingEngine("sweating", "headache", "diarrhea");
Disease diseaseobject=engine.execute();
String result=diseaseobject.diagnosis;

}catch (JessException e){}


But I am having the error below:

Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - exception jess.JessException is never thrown in body of corresponding try statement
at expertvoice.expertvoice.main(

Please, what can I do to remove this error?
Posts: 22700
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Always fix all your compiler errors before you execute your class (through an IDE I'm guessing).

The compiler error is clear enough; you try to catch checked exception JessException but there is no method call that actually can throw it.

And next time please use code tags.
Dinner will be steamed monkey heads with a side of tiny ads.
the value of filler advertising in 2021
    Bookmark Topic Watch Topic
  • New Topic