[英]JSkype error sending message
I'm trying to run the following code but unfortunately facing Error problems 我正在尝试运行以下代码,但不幸的是遇到错误问题
package jskypeexample;
// import the JSkype packages
import net.lamot.java.jskype.general.AbstractMessenger;
import net.lamot.java.jskype.general.MessageListenerInterface;
import net.lamot.java.jskype.windows.Messenger;
import java.lang.Thread;
import java.lang.Exception;
/**
*
* @author swhite
*/
public class JSkypeExample implements MessageListenerInterface {
// create a messenger which we'll use for sending messages
private AbstractMessenger msgr = null;
/** Creates a new instance of JSkypeExample */
public JSkypeExample() {
msgr = new Messenger();
msgr.addListener(this);
msgr.initialize();
try {
// This number may vary on your system depending on the amount
// of time required to initialize the msgr.
Thread.sleep(1000);
// send the Skype API text command
msgr.sendMessage("Message seanmwhite Hello from UI Student");
msgr.sendMessage("SEARCH FRIENDS");
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
new JSkypeExample();
}
public void onMessageReceived(String str) {
// This is where you will handle all strings that are returned.
System.out.println(str);
}
}
But when I comment the following lines then it runs well. 但是,当我评论以下几行时,它将运行良好。
msgr.initialize();
msgr.sendMessage("Message seanmwhite Hello from UI Student");
msgr.sendMessage("SEARCH FRIENDS");
But I have to send commands to receive the response. 但是我必须发送命令来接收响应。 Actually I'm using JSkype Api (open source api from java ).
实际上,我正在使用JSkype Api(来自Java的开源api)。
您必须将您的初始化函数返回的布尔值设置为true,或者如果执行为false则捕获该执行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.