java - Execute performExecute() using public static main(String args) -


 public class xgetprogramguidedirecttestcontrollercmdimpl extends controllercommandimpl implements xgetprogramguidedirecttestcontrollercmd {     public final string classname = this.getclass().getname();     public void performexecute() throws ecexception { /* code here*/ }      private void callusinterface() throws ecexception { /* code here*/ }      private void calldeinterface() throws ecexception { /* code here*/ }      private void callukinterface() throws ecexception { /* code here*/ }      public void setrequestproperties(typedproperty req) throws ecexception { /* code here*/ }      private void displayresponse(stringbuffer testresult) { /* code here*/ }      public static void main(string[] args) {         xgetprogramguidedirecttestcontrollercmdimpl pgdirtestcontroller = new xgetprogramguidedirecttestcontrollercmdimpl();         pgdirtestcontroller.performexecute();     }  } 

i'm trying run application java application in eclipse-rad using public static void main(string[] args) giving me error of:

exception in thread "main" java.lang.error: unresolved compilation problem:      unhandled exception type ecexception  

on:

pgdirtestcontroller.performexecute(); 

please go easy on me, i'm pretty new java still.

since declared:

public void performexecute() throws ecexception  

then forced deal ecexception.

so when call it, should surround try-catch or declare method in call throw exception:

public static void main(string[] args) {       xgetprogramguidedirecttestcontrollercmdimpl pgdirtestcontroller = new                 xgetprogramguidedirecttestcontrollercmdimpl();       try {           pgdirtestcontroller.performexecute();       } catch(ecexception e) {              e.printstacktrace();             //handle exception!         } } 

or

public static void main(string[] args) throws ecexception {      xgetprogramguidedirecttestcontrollercmdimpl pgdirtestcontroller = new                xgetprogramguidedirecttestcontrollercmdimpl();      pgdirtestcontroller.performexecute(); } 

Comments