Issues with capabilities and OpenJDK linking

Andrew John Hughes ahughes at
Wed May 5 13:15:05 PDT 2010

There is an issue with the linking of the libraries in the JVM due to
its use of $ORIGIN in the runtime path:

$ readelf -d /usr/lib/jvm/icedtea6/bin/java -V

Dynamic section at offset 0x9ed0 contains 31 entries:
  Tag        Type                         Name/Value
 0x00000001 (NEEDED)                     Shared library: []
 0x00000001 (NEEDED)                     Shared library: []
 0x00000001 (NEEDED)                     Shared library: []
 0x00000001 (NEEDED)                     Shared library: []
 0x00000001 (NEEDED)                     Shared library: []
 0x0000000e (SONAME)                     Library soname: []
 0x0000000f (RPATH)                      Library rpath:
 0x0000001d (RUNPATH)                    Library runpath:

When capabilities are added to the java binary:

setcap cap_net_bind_service=+epi java

glibc no longer allows relative paths and the expansion of $ORIGIN
when the binary is run as a normal user
(  So we

/usr/lib/jvm/icedtea6/bin/java: error while loading shared libraries: cannot open shared object file: No such file or directory

due to:

13919 open("$ORIGIN/../lib/ppc/jli/", O_RDONLY) = -1 ENOENT
(No such file or directory)

Such a capability needs to be added to allow Java to bind ports below
1024 as an unprivileged user.

A number of possible solutions exist:

1.  Statically link java
2.  Hardcode the install path of the libraries into the runtime path
3.  Add the install path to (which would require the
libraries to be properly versioned to avoid conflicts)
4.  Move the libraries onto the existing library path (again, requires

I don't think any of these solutions are ideal.  Does anyone have any
suggestions or better solutions?

Note that this seems unrelated to the use (or not) of LD_LIBRARY_PATH
( as it
occurs in both 6 and 7.
Andrew :-)

Free Java Software Engineer
Red Hat, Inc. (

Support Free Java!
Contribute to GNU Classpath and the OpenJDK

PGP Key: 94EFD9D8 (
Fingerprint: F8EF F1EA 401E 2E60 15FA  7927 142C 2591 94EF D9D8

More information about the distro-pkg-dev mailing list