Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find which libraries does Java Desktop API require on Linux?

I am trying to find a way how to determine which libraries does Java require for Desktop API to work, specifically the BROWSE function. I read a few guides, bug reports and workarounds, but none of them work.

I was able to make it work on Debian by installing libgnome2-0 and gvfs-backends packages. The first one is typically recommended (by people solving the same problem), the second one was a lucky guess because it seems that the Desktop API required the vfs. However I can't make this work on Ubuntu 14.04, even with installing these two packages.

So my question is: How can I find which libraries does Java Desktop API require on Linux? Specifically Oracle JDK 8 on Ubuntu 14.04. Is it possible to somehow capture which libraries is the desktop API using or get some error output from the native code?

EDIT: I've created a one line code that is trying to use the browse:

public class Main {
    public static void main(String[] args) throws URISyntaxException, IOException {
        Desktop.getDesktop().browse(new URI("http://www.google.com"));
    }
}

I've tried to run a command to trace all files that have been requested during the execution of the test:

strace -e open,access -f -o browse java -jar BrowseTester.jar

I get a lot of output indicating both java native and linux native libraries are being looked for, found and accessed, but I am not sure how to detect what is actually missing.

Example of the output:

30171 open("/usr/lib/x86_64-linux-gnu/gvfs/tls/x86_64/libgvfscommon.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
30171 open("/usr/lib/x86_64-linux-gnu/gvfs/tls/libgvfscommon.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
30171 open("/usr/lib/x86_64-linux-gnu/gvfs/x86_64/libgvfscommon.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
30171 open("/usr/lib/x86_64-linux-gnu/gvfs/libgvfscommon.so", O_RDONLY|O_CLOEXEC) = 11

I need a way how to detect which native libraries are needed for the Java Desktop API browse functionality. I can't touch the code that is calling the browse.

EDIT2: I've tried to install a new Ubuntu 14.04 with complete Gnome environment on a different machine and it works. However I would really like to avoid this because it adds 1.5GB of (mostly) unused libraries. Still looking for a way how to find what Java requires exactly or at least some kind of output from the place where it fails.

like image 515
MartinTeeVarga Avatar asked Oct 23 '15 07:10

MartinTeeVarga


1 Answers

Going to the source might help here. Digging through the Makefile, I find these includes:

EXTRA_INCLUDES = `pkg-config --cflags glib-2.0` \
                 `pkg-config --cflags libgnome-2.0` \
                 `pkg-config --cflags gnome-vfs-2.0`\
                 `pkg-config --cflags gnome-vfs-module-2.0` \
                 `pkg-config --cflags bonobo-activation-2.0` \
                 `pkg-config --cflags libbonobo-2.0` \
                 `pkg-config --cflags ORBit-2.0` \
                 `pkg-config --cflags gconf-2.0`

And there you have it :)

like image 171
Tomas Avatar answered Sep 28 '22 16:09

Tomas