2014-06-29 34 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對於除通話記錄和硬件設備控制以外的所有用戶均已棄用。雖然這些代碼目前可能有效,但我們對其使用壽命沒有任何承諾 –

相關問題