Skip to Main Content

Java Programming

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!

Class name cannot be resolved to a type

800271Feb 1 2011 — edited Feb 4 2011
Dear All,
I have one main class calling another class but I keep getting this error "
SMSClient cannot be resolved to a type". Before this I tried on other pc it was ok. Below is part of the codes. What could have been wrong? Can it be a missing library but how to trace that?
public class callSMSClient{   public static void main(String[] args)  {  	
          SMSClient t1 = new SMSClient(0);  	
          t1.sendMessage("+6065544223","testing one two");  }}public class callSMSClient
          {

          public static void main(String[] args)
          {
  	SMSClient t1 = new SMSClient(0);
  	t1.sendMessage("+6065544223","testing one two");
         }
}
public class SMSClient implements Runnable{   
public final static int SYNCHRONOUS=0;  
public final static int ASYNCHRONOUS=1;  
private Thread myThread=null;   
private int mode=-1;  
private String recipient=null;  
private String message=null;   
public int status=-1;  
public long messageNo=-1;    
public SMSClient(int mode) {      
this.mode=mode;    
}  
 public int sendMessage (String recipient, String message)
 {    
      this.recipient=recipient;    
      this.message=message;   
      myThread = new Thread(this);    
      myThread.start();
      //    run();    
      return status;    
}    
public void run()
{     
Sender aSender = new Sender(recipient,message);     
try{      
//send message          
aSender.send ();          
// System.out.println("sending ... ");       
//in SYNCHRONOUS mode wait for return : 0 for OK, -2 for timeout, -1 for other errors      
if (mode==SYNCHRONOUS)
{          
while (aSender.status == -1)
{            myThread.sleep (1000);          
}      
}      
if (aSender.status == 0) 
messageNo=aSender.messageNo ;    
}
catch (Exception e)
{         e.printStackTrace();     
}     
this.status=aSender.status ;     
aSender=null;    
}
}public class SMSClient implements Runnable{

  public final static int SYNCHRONOUS=0;
  public final static int ASYNCHRONOUS=1;
  private Thread myThread=null;

  private int mode=-1;
  private String recipient=null;
  private String message=null;

  public int status=-1;
  public long messageNo=-1;


  public SMSClient(int mode) {
      this.mode=mode;
    }

  public int sendMessage (String recipient, String message){
    this.recipient=recipient;
    this.message=message;
    //System.out.println("recipient: " + recipient + " message: " + message);
    myThread = new Thread(this);
    myThread.start();
//    run();
    return status;
    }
    public void run(){

    Sender aSender = new Sender(recipient,message);

    try{
      //send message
          aSender.send ();

         // System.out.println("sending ... ");

      //in SYNCHRONOUS mode wait for return : 0 for OK, -2 for timeout, -1 for other errors
      if (mode==SYNCHRONOUS) {
          while (aSender.status == -1){
            myThread.sleep (1000);
          }
      }
      if (aSender.status == 0) 
         messageNo=aSender.messageNo ;

    }catch (Exception e){

        e.printStackTrace();

    }

    this.status=aSender.status ;

    aSender=null;


  }
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 4 2011
Added on Feb 1 2011
10 comments
1,249 views