java-8-oracle (1.8.0_66) problem with PrintAssembly "Could not load hsdis-amd64.so"

First install libhsdis0-fcml as described in the other answer1:

sudo apt-get install libhsdis0-fcml

This only installs it for OpenJDK. You are, however, using java-8-oracle, so you'll need to copy it over there. Here's the exact copy command that worked for me:

sudo cp /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/hsdis-amd64.so /usr/lib/jvm/java-8-oracle/jre/lib/amd64/hsdis-amd64.so

If that's still not working, you might try an strace to see where your java is looking. I used:

strace -f java -XX:CompileCommand='print, *.*' ... |& grep hsdis

to get output like this:

[pid 10783] open("/usr/lib/jvm/java-8-oracle/jre/lib/amd64/server/libhsdis-amd64.so", O_RDONLY <unfinished ...>
[pid 10783] open("/usr/lib/jvm/java-8-oracle/jre/lib/amd64/server/libhsdis-amd64.so", O_RDONLY|O_CLOEXEC <unfinished ...>
[pid 10783] open("/usr/lib/jvm/java-8-oracle/jre/lib/amd64/server/libhsdis-amd64.so", O_RDONLY|O_NONBLOCK <unfinished ...>
[pid 10783] open("/usr/lib/jvm/java-8-oracle/jre/lib/amd64/server/hsdis-amd64.so", O_RDONLY <unfinished ...>
[pid 10783] open("/usr/lib/jvm/java-8-oracle/jre/lib/amd64/server/hsdis-amd64.so", O_RDONLY|O_CLOEXEC <unfinished ...>
[pid 10783] open("/usr/lib/jvm/java-8-oracle/jre/lib/amd64/server/hsdis-amd64.so", O_RDONLY|O_NONBLOCK <unfinished ...>
[pid 10783] open("/usr/lib/jvm/java-8-oracle/jre/lib/amd64/hsdis-amd64.so", O_RDONLY <unfinished ...>
[pid 10783] open("/usr/lib/jvm/java-8-oracle/jre/lib/amd64/hsdis-amd64.so", O_RDONLY|O_CLOEXEC) = 14

You can see that the places and names you were trying are definitely among those the JDK searches (in my case, it probably would have searched more places, but stopped since the last location above is where it found the shared object).

Note that you definitely need the -f flag to strace since the actual JVM is launched as a child process of the original java command.

Among the issues strace might reveal is a permissions issue. I only needed read perms on the library for the user launching java.

My java -version output:

java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)

1 Really, this is just a way to get a (presumably working) hsdis.so file in a package-manager friendly way. You could always just download it directly from one of the various sources as well.


Install package libhsdis0-fcml:

apt-get install libhsdis0-fcml

It should provide all necessary libraries (see http://packages.ubuntu.com/xenial/amd64/libhsdis0-fcml/filelist)