Find the answer to your Linux question:
Results 1 to 7 of 7
can I make a .dll file to .so files without compiling source code? I have a java library file in .dll format. So I can't run the program in linux. ...
  1. #1
    Just Joined!
    Join Date
    Mar 2010
    Posts
    2

    Post .dll to .so



    can I make a .dll file to .so files without compiling source code?
    I have a java library file in .dll format. So I can't run the program in linux.
    There is no way to get the source code of the file. I have to run the program in linux.
    Please help me its important.

  2. #2
    Linux Guru coopstah13's Avatar
    Join Date
    Nov 2007
    Location
    NH, USA
    Posts
    3,149
    a java library as a dll? doesn't sound right to me, java is compiled to .class files, which are then bundled inside of a jar, war, ear, etc.

    Anyway, you can't convert a dll to a so without the source, so you are SOL.

  3. #3
    Just Joined!
    Join Date
    Mar 2010
    Posts
    2

    Post

    thanks
    But I can run my java program in windows but can't run in linux. Compiling is successful.

  4. #4
    Linux Guru coopstah13's Avatar
    Join Date
    Nov 2007
    Location
    NH, USA
    Posts
    3,149
    are you sure you are talking about a dll then? as I said, dll is for C/C++ libraries, not java. Java is cross platform, it runs on the JVM and most things should work perfectly across any platform and you don't need to compile on the target platform either

    if you are talking about a dll truly, you have to understand that linux is not windows, and that you have compiled a DLL to be understood by windows kernel, it can never and will never be able to run on linux without compiling it for linux

  5. #5
    Just Joined!
    Join Date
    Oct 2006
    Posts
    1

    Does it involve JNI?

    Some s/w packages provide a .dll with native code accessed via JNI. The reasons vary - speed, access to OS or other non-Java APIs. Java3D is one such, I seem to recall (low level video hardware access) - you'd get a separate dll/so for each platform. Strictly speaking it isn't java in there, but it's used by the JVM.

    As to converting it from a .dll to a .so, that's beyond my meagre abilities. I *suppose* it's possible, but it'd be awfully complex. You'd have to map any Windows-specific calls in the dll to their corresponding calls in Linux, map function call and argument passing - a lot like what WINE has to do.

    It'd probably be a lot easier to get the corresponding .so from the source. Or if they don't support Linux, find a different package.

  6. #6
    Just Joined!
    Join Date
    Nov 2008
    Posts
    2
    It is theoretically possible to do so, but it might well be easier to rewrite the program from scratch yourself. More common is to create a "wrapper" around the dll to interpret and translate what it is doing. Such wrappers are, however, usually very limited in scope. For example, there is one which can be used to make Windows wireless card drivers work under Linux.

    Were I you, the first thing I would try would be to install the Windows version of Java via Wine. Last I heard, it mostly worked. There are issues however revolving around the difference in case-sensitivity between Linux and Windows, so no promises about your particular app.

    Second thing to try would be a virtual machine. Not as nice usually, but it depends on what you're trying to do.

    Finally, are you certain that there is no Linux alternative to the application in question? You may be spending hours making this work when there is another, possibly free program available that does the same thing.

  7. #7
    Just Joined!
    Join Date
    Jan 2010
    Posts
    27

    Winelib

    you may have some success using Wine and Winelib:
    old.nabble.com/WineLib-and-Java-Native-Interface-%28JNI%29---UNIX-td21007867.html

    But for DLL to be loaded, all Wine system is required to be running. So you are to writes some IPC between Java and your custom Winelib application.

    Or you could try installing win32 Java in Wine and run your program here (suggestion from the same thread). JRE 1.6.x seems to run OK in latest Wine releases:
    appdb.winehq.org/objectManager.php?sClass=application&iId=1372

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •