2014-06-29 38 views
2

在Linux(Ubuntu的14.04),此代码后挂起 “得到联系人列表” 印:什么是正确的com.skype。*使用Linux?

package skype; 

import com.skype.ContactList; 
import com.skype.Friend; 
import com.skype.Skype; 
import com.skype.SkypeException; 

public class ContactLister { 

    public void getAllFriend() throws SkypeException, InterruptedException { 
     System.out.println("starting..."); 
     ContactList contactList = Skype.getContactList(); 
     System.out.println("got contact list " + contactList.toString()); 
     Friend friends[] = contactList.getAllFriends(); 
     System.out.println("got friends"); 
     System.out.println(friends.length); 
     for (Friend friend : friends) { 
      System.out.println("Friend ID :" + friend.getId()); 
      Thread.sleep(100); 
     } 
    } 

    public static void main(String[] args) throws SkypeException, InterruptedException, SkypeException { 
     new ContactLister().getAllFriend(); 
    } 
} 

检查库,com.skype.connector似乎使用JNI到与Skype连接。至少对我而言,连接似乎永远不会发生。

它甚至可以使用它来连接到Skype?我怎么知道为什么它不是(显然)连接?

[email protected]:~$ 
[email protected]:~$ java -jar NetBeansProjects/Skype/dist/Skype.jar 
starting... 
got contact list [email protected] 
^[email protected]:~$ 
[email protected]:~$ skype --version 
Skype 4.2.0.11 
Copyright (c) 2004-2013, Skype 
[email protected]:~$ 
+0

这个答案:http://stackoverflow.com/a/2945519/262852没有为我工作。 – Thufir

+0

我认为这是git repo:https://github.com/lemmy/skype4java它似乎死了,请求新的维护者。 – Thufir

回答

0

虽然这个工程:

package net.bounceme.dur.skype; 

import java.io.*; 

public class SkypeEchoTest { 

    public static void main(String args[]) throws IOException { 
     String s = null; 
     Process p = Runtime.getRuntime().exec("skype --callto echo123"); 
     BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream())); 
     System.out.println("Here is the standard output of the command:\n"); 
     while ((s = stdInput.readLine()) != null) { 
      System.out.println(s); 
     } 
     System.exit(0); 
    } 
} 

它不相当有 “哇” 的因素。此外,它只适用于Linux,不知道它如何在Windows中工作。 (你必须先让Skype运行,然后执行字节码。)

+0

请注意Skype4COM对于除通话记录和硬件设备控制以外的所有用户均已弃用。虽然这些代码目前可能有效,但我们对其使用寿命没有任何承诺 –

相关问题