Sunday, April 24, 2011

Skype4Java Mavenized API released!

I'm glad to announce that I have released the first version of the mavenized skype api to the maven central repo:

http://repo2.maven.org/maven2/com/github/taksan/skype-java-api/

First version is 1.1 (err, don't wanna talk about 1.0 :P), please enjoy!

I actually thought I would have more trouble to release the project in the central repo, but it was actually quite easy. Ok, there are several requirements, but they are easy to meet. The only "tricky" one was that I needed a valid domain to use as groupId. At first, I thought I would have to pay for a domain and keep it forever, but then I found out that I could use github's domain for this purpose (as you will notice if you read the pom).

I would like to thank Koji Hisano, I got in touch with him by mail to ask whether he would be okay with this move, since I mostly copied his project, and I got full support from him.

Now, all of you who'd like to use Skype4Java / Skype Java Api, please enjoy and feel free to talk back.

This version should support:

- Windows 32 and 64 bit
- Linux 32 and 64 bit
- Mac OS 32 bit

It is possible to run under MacOS 64 bit with compatibility mode (java -d32).

See ya!

40 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. I'm using your library and it works pretty good on Windows, well done you solved some issues of old Skype4Java api.
    My problem is that when I try to use it in ubuntu linux, a JVM crash appears, here it is an excerpt:

    Could not acquire getLogger method!
    #
    #A fatal error has been detected by the Java Runtime Environment:
    #
    #SIGSEGV (0xb) at pc=0xb32c4e37, pid=10752, tid=2985261936
    #
    #JRE version: 6.0_26-b03
    #Java VM: Java HotSpot(TM) Client VM (20.1-b02 mixed mode, sharing linux-x86 )
    #Problematic frame:
    #C [libskype_x866764075729730110994.so+0x1e37] long+0xc

    with Java Result: 134

    Could please tell me how to fix it?
    Thank you very much.

    ReplyDelete
  3. Hello gurucoder,

    I'll have to check what happened in your case. I tested the library under windows, linux 64 bit and mac os, but I didn't try on linux 32bit. That't probably a problem with 32 bit native library. I'll try on 32bit and investigate it.

    Thanks

    ReplyDelete
  4. ok thak you very much! You are doing a great job man! go on! :D

    ReplyDelete
  5. Hi, I tried your library on Ubuntu 11.04 64bit version but I get same error I got on 32bit version...JVM crash... if you want I could send you the java error logs.. please let me know..
    thanks.

    ReplyDelete
  6. I just sent you a message on gitHub about a possible reason of the crash on linux... please let me know

    ReplyDelete
  7. Hi, Someone can explain how can I create a sample java program into Eclipse (using Maven or Tomcat)?

    A simple guide that contains all steps I have to efford?

    Thank you
    Giuliano

    ReplyDelete
  8. Hi

    Tried to get 1.2 running, not really successfull :(

    Using a 32bit Version I got an error because the skype_x68.dll is extracted to the directly returned by getTempDir() which is not the same that is checked in Win32Connector (it has an additional sub directory).

    When providing the dll direclty in the library path I got an UnsatisfiedLinkError at jni_init();

    Stopped testing for other versions afterwards. May you can have a look?

    Looking forward to version 1.3 ;)

    best regards

    ReplyDelete
  9. Hello BChrom,

    I already released version 1.3, maybe it fixes the problem you're having. In fact, I commited some fixes to improve windows compatibility.

    If it doesn't, please let me know. I don't do a lot of tests under windows, but I ran the suite of unit tests under my vista before the 1.3 release and everything went fine.

    ReplyDelete
  10. hi,

    wow, thanks for quick response. The 1.3 is not yet available in maven-repo - is it?

    I took a look at the source of 1.3 but it seems it's still faulty (extract path and lookup path differ). May you had the dll directly in path and not 'only' used the jar?

    Thanks anyway!

    ReplyDelete
  11. I'll check it. I thought I deployed it in the central, but since there is still this issue I'll check it. I didn't notice because the tests passed under windows.

    ReplyDelete
  12. Hi,

    great in meantime I created a workaround. Calling 'loadWinLibrary();' before 'Connector.getInstance();' fixes the library problems (also issue #7 which is caused by the fact that a library might be in path but not really loaded - to be in users working directory is not enought).


    best regards

    /**
    * Used as the current extraction/loading of native dll inside the skype library fails.
    * Should be removed when fixed in skype api.
    */
    private void loadWinLibrary() {
    try {
    if (System.getProperty("os.name", "xxx").toLowerCase().indexOf("win")>=0) {
    // Loading DLL
    try {
    System.loadLibrary("skype");
    } catch (Throwable e) {
    final String osArch = System.getProperty("os.arch");
    String LIB_FILENAME_FORMAT = "skype_%s.dll";
    String libfilename = String.format(LIB_FILENAME_FORMAT, osArch);
    // this check is wrong, if path is in library path we should use loadLibrary if false,
    // if it's in user path (checked by method) than the dll will not be found, we have to load it anyway
    //if (!ConnectorUtils.checkLibraryInPath(libfilename)) {

    File localLibFile = checkLibraryInPath(libfilename); // nice to have but not really necessary
    if (localLibFile!=null) {
    System.load(localLibFile.getAbsolutePath());
    } else {
    String tmpDir = System.getProperty("java.io.tmpdir"); // temp dir should be used but can't as win32 connector does not use it - ConnectorUtils.getTempDir();
    if (!tmpDir.endsWith("" + File.separatorChar)) {
    tmpDir = tmpDir + File.separatorChar;
    }
    ConnectorUtils.extractFromJar(libfilename, libfilename, tmpDir);
    System.load(tmpDir + libfilename);
    }
    }
    }
    } catch(Exception e) {
    logger.warn("Failed to load skype dll (workaround)", e);
    }
    }

    /**
    * @param fileName File to find
    * @return File path of existing file, null if given file name not in path
    */
    private File checkLibraryInPath(String fileName) {
    File result = null;
    String libpath = System.getProperty("java.library.path")+File.pathSeparatorChar+System.getProperty("user.dir")+File.pathSeparatorChar;
    File libfile = new File("");
    StringTokenizer st = new StringTokenizer(libpath, File.pathSeparator);
    while (st.hasMoreTokens()) {
    libfile = new File(st.nextToken()+File.separatorChar+fileName);
    if (libfile.exists()) {
    result = libfile;
    break;
    }
    }
    return result;
    }

    ReplyDelete
  13. Hi again!

    Additional hint/request: would be create if in "ConnectorUtils.extractFromJarUsingClassLoader" also the class loader of this class can be used when resource not available through the system classloader (e.g. liburl = ConnectorUtils.class.getClassLoader().getResource(libFileName);)

    In our webstart-environment where a special classloader is used to load our own packages (as they are crypted) it would not work otherwise. Maybe other people have same issues here...

    Thanks & best regards

    ReplyDelete
  14. I know, it's been a while. I'm back to fixing issues and the latest source code has the correction. I won't release it just now because I still have to fix some issues on Mac OS.

    Best regards

    ReplyDelete
  15. Hello Takeuchi,

    did you yet release your Skype4Java version 1.3 ? It would be great if you would let me know that. If you already have release 1.3 version then can you give me the link please from where i could download that ?

    I am looking forward to hearing from you.
    Thanks
    Partho Biswas.

    ReplyDelete
  16. Hello Partho

    I intend to release the 1.4 version soon. I'm still working on a few bugs reported under Mac OS. I'll let you know when I release it.

    Thanks
    Takeuchi

    ReplyDelete
  17. Really !!! It's a great news... And thank you very much for replying me.

    Did 1.3 version yet released ? It would be great if you let me know that. If it already have release then can you please give me the link from where i can download 1.3 version ? Because i didn't find out the link. I have already coded my app using Skype4Java version 1 now i want to upgrade it on Skype4Java version 1.3 or 1.4
    My final goal is to run my app on Windows 32 bit, 64 bit And MAC os X Lion.

    I am looking forward to hearing from you .
    Thank you.
    Partho Biswas

    ReplyDelete
  18. Hello Takeuchi,

    Did you actually released 1.3 version ? I searched it everywhere and all over the internet but i didn't find it. Would you please check it again ? And please don't take it otherwise if i am wrong.
    Thank you for your nice job.


    Thank you.
    Partho Biswas

    ReplyDelete
  19. Maybe there was a mistake and I forgot to stage it.
    Anyway, I'm releasing 1.4 this week (probably, tomorrow).

    Sorry for the inconvenience.

    ReplyDelete
  20. how can i use these library? at http://repo2.maven.org/maven2/com/github/taksan/skype-java-api/ link i got jar files but how to use them please help :(

    ReplyDelete
  21. Actully i need to integrate skype with my application..

    ReplyDelete
  22. HI Sumit,

    I recommend that you start by looking at the project in the following link:

    https://github.com/taksan/skype-api-samples

    There you'll find several examples using the skype-java-api. You can either use the same build model I used for this project (building with maven) or just download the jar files and putting in your classpath to build with ant or whichever mean you want.

    Best regards!

    ReplyDelete
    Replies
    1. Hi Gabriel,

      I am getting below error:
      C:\Users\Sumit\Desktop\R&D_ChatWindow\SKYPE\SourceForge-skype\skype\eclipse\plug
      ins\com.skype.examples\src>java com/skype/examples/swt/MakeCall siddha.sumit
      Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\Sumit\Deskto
      p\R&D_ChatWindow\skype_1.0\skype\release\swt-win32-3232.dll: Can't load IA 32-bi
      t .dll on a AMD 64-bit platform
      at java.lang.ClassLoader$NativeLibrary.load(Native Method)
      at java.lang.ClassLoader.loadLibrary0(Unknown Source)
      at java.lang.ClassLoader.loadLibrary(Unknown Source)
      at java.lang.Runtime.loadLibrary0(Unknown Source)
      at java.lang.System.loadLibrary(Unknown Source)
      at org.eclipse.swt.internal.Library.loadLibrary(Library.java:123)
      at org.eclipse.swt.internal.win32.OS.(OS.java:18)
      at org.eclipse.swt.internal.win32.TCHAR.(TCHAR.java:29)
      at com.skype.connector.windows.WindowsConnector.(WindowsConnecto
      r.java:120)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Unknown Source)
      at com.skype.connector.Connector.getInstance(Connector.java:108)
      at com.skype.Skype.call(Skype.java:197)
      at com.skype.examples.swt.MakeCall.main(MakeCall.java:31)

      My system is 64 bit but skype.jar i have use 32bit .dll file now i need jar for 64bit

      Delete
  23. The jar has both dlls. I believe the problem is that you're using a 32 bit java. Try using a 64 bit jdk

    ReplyDelete
  24. Hi Gabriel,
    Now i am able to call from code by running test program now can you tell me how to chat.
    In com.skype.Skype class there is static chat(String skype_id) method but when i call it does not help in making chat..could you help me!

    ReplyDelete
  25. I am using in this way :)
    public class MakeCall {
    public static void main(String[] args) throws Exception {
    if (args.length != 2) {
    System.out.println("Usage: java com.skype.sample.MakeCall 'skype_id' chat/call");
    return;
    }
    if(args[1].equals("call"))
    Skype.call(args[0]);
    else if(args[0].equals("chat"))
    {Skype.chat(args[0]);}

    }
    }

    ReplyDelete
  26. chat function is not working please help me

    ReplyDelete
  27. Hi

    The usage is incomplete. By using Skype.chat("someuserid") you are just obtaining the chat object. You still need to use the object to send a message, for example:

    Skype.chat("echo123").send("this is my message");

    Kind regards

    ReplyDelete
  28. This comment has been removed by the author.

    ReplyDelete
  29. Hi Gabriel,

    Thanks for your help, now my requirement are given:

    1)Login into skype from cmd not from skype client gui.
    2)i want to use skype api but not skype gui to chat and calling just like facebook use skype video functionality but not skype gui.

    This is main requirement please Gabriel help me.

    ReplyDelete
  30. It is not possible to login from skype api. Skype's public api framework requires skype to be running and already connected.

    It is is possible to control the chats from your program, but you won't be able to prevent the skype gui from receiving and showing the messages.

    You can make calls using Skype.call("user"). Just like the Chat API, this invocation will return a Call object that can be used to manipulate the calls, including video calls. Again, you can't get away from the skype client, you'll have to work with it.

    ReplyDelete
  31. Then how facebook use skype video functionality(but not skype GUI.) facebook use its own gui to video chat.

    ReplyDelete
  32. There's another development kit called "Skype Kit" that can be used to write skype clients. Skype Kit is not just a API to interact with skype, it allows you to write skype clients. That's probably what facebook uses.

    Skype API for java was developed way before skype kit existed and is based on "skype public api" or "skype desktop api" (http://dev.skype.com/desktop-api-reference) and this API is far more restricted than skype kit.

    It seems that what you really need is skype kit. I'll just let you know that skype kit is NOT open source and is NOT free,

    ReplyDelete
  33. I understand it not free, but is there any free trial available or any details documentation that can satisfy me as this is the one I am looking for.

    ReplyDelete
  34. Hey Gabriel,

    How are you? can you tell me how i can download skype kit.Actually i need to write my client so can be used in my application in which gui will be my own and functionality from skype will be used.

    ReplyDelete
  35. Hey Gabriel, sorry to bother. Have you been able to run this on mac os x lion? My problem is that lion is 64 bits, and I can't find a 32 bit jre or jdk of java 7 for lion, so -d32 is not working. Do you know of any workarounds?

    ReplyDelete
  36. Hi,
    I am getting bellow exception while using this API.

    java.lang.UnsatisfiedLinkError: Can't load library: C:\Users\Ramesh\AppData\Roaming\NetBeans\7.3\apache-tomcat-7.0.34.0_base\temp\skype_x86.dll

    I am using JDK 1.6 32bit and OS is Windows-7 32 bit.
    I am used bellow Maven dependency in my project

    com.github.taksan
    skype-java-api
    1.1

    ReplyDelete