【问题标题】:JSkype error sending messageJSkype 错误发送消息
【发布时间】:2010-09-28 10:53:50
【问题描述】:

我正在尝试运行以下代码,但不幸遇到错误问题

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);
   }

 }

但是当我评论以下几行时,它运行良好。

 msgr.initialize(); 
 msgr.sendMessage("Message seanmwhite Hello from UI Student");
 msgr.sendMessage("SEARCH FRIENDS");

但我必须发送命令才能接收响应。实际上我使用的是 JSkype Api(来自 java 的开源 api)。

【问题讨论】:

    标签: java api skype


    【解决方案1】:

    您必须设置您的布尔值,使您的 initilaze 函数返回 true,或者如果它为 false,则捕获该 execpetion。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-15
      • 2020-02-26
      • 2015-12-18
      • 2021-08-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多