Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

[b]Is it possible to set a Sleep Timer like this?[/b]

Hello,

I'm trying to set a timer in a Java application that connect to SAP every 10 minutes. But I got some trouble doing this. Could any one help me out? BELOW IS THE CODE:

import com.sap.mw.jco.*;


public class TutorialConnect1 extends Object {
	JCO.Client mConnection;
	
	long timeout = (1000*60)*10; // 1000ms = 1sec*60 = 1min*10 = 10min
	   
	 for(int i=0;i<1000;i++)
	 {
		
	public TutorialConnect1() {
		try{
			mConnection = JCO.createClient("900",//SAP Cleint
				"test",//userid
				"test",//password
				"EN",//language
				"test",//host name
				"00");// system number
				mConnection.connect();
			System.out.println(mConnection.getAttributes());
			mConnection.disconnect();
		}
		catch (Exception ex){
			ex.printStackTrace();
			System.exit(1);
		}
	}
	
//	 start of the Sleep Timeout
    try
    {
  Thread.sleep(timeout);
    }catch(InterruptedException e)
    {
     System.out.println("main thread interrupted");
    } 
 }// for

	public static void main(String args[]) {
		TutorialConnect1 app = new TutorialConnect1();
	}
}

THIS IS THE ERROR MESSAGE:

java.lang.Error: Unresolved compilation problem:

at TutorialConnect1.main(TutorialConnect1.java:19)

Exception in thread "main"

Line 19 correspond to this "mConnection = JCO.createClient( )"

Former Member
Not what you were looking for? View more on this topic or Ask a question