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

2

13

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.

Revelatory answered 23/10, 2015 at 7:2 Comment(2)
Have you read https://mcmap.net/q/357252/-desktop-api-is-not-supported-on-the-current-platform and https://mcmap.net/q/357252/-desktop-api-is-not-supported-on-the-current-platform answers already? Do you need names of specific libraries or just externally opening given URL in java would solve your problem?Natiha
@TrynkiewiczMariusz I've added the text from bounty to the question, as it seems it can be easily overlooked. I need to make the browse work. I can't use workarounds that bypass it because I can't touch the code that is using it.Revelatory
N
1

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 :)

Nonfulfillment answered 27/10, 2015 at 18:22 Comment(4)
Unfortunately this didn't help. I have all these libraries on both Ubuntu (not working) and Debian (working), apart from ORBit, and ORBit is missing on both... However it might mean that packages are installed but not found or not used properly.Revelatory
Have you checked that it's not just a case of 32 bit vs. 64 bit?Nonfulfillment
Everything seems in order, 64-bit.Revelatory
Hmm. This should be the list of dependencies, since it is from the actual source – I mean, these are the libraries it needs (which answers your question even if it doesn't solve your problem). I think your next step is to try ltrace, as I suggested in a separate answer (https://mcmap.net/q/886538/-how-to-find-which-libraries-does-java-desktop-api-require-on-linux).Nonfulfillment
N
0

I just had another idea: maybe you can use ltrace instead of strace?

ltrace -e open,access -f -o browse java -jar BrowseTester.jar
Nonfulfillment answered 28/10, 2015 at 0:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.