Newer versions of the JDK do not include binaries for the HotSpot Disassembler. This is required if you're looking to make use of some JMH profilers, such as the Linux perfasm profiler, or just want to review the assembly generated for a given Java application using -XX:+PrintAssembly or jitwatch. These instructions have been tested with the OpenJDK 16 GA release on Ubuntu 20.04 and macOS Big Sur.
The initial prep varies by operating system
First, ensure you have build essential tools installed.
sudo apt updatesudo apt install build-essential
First, ensure you have xcode command line tools installed.
sudo xcode-select --install
If you don't already have wget installed, this can be installed with Homebrew
brew install wget
Next, clone the JDK repo:
git clone firstname.lastname@example.org:openjdk/jdk.git
Next, move into the JDK source folder, and then checkout the JDK 16-ga tag:
cd jdkgit checkout jdk-16-ga
Next, move into the hsdis folder:
Next, get a copy of the GNU binutils from gnu.org:
wget https://ftp.gnu.org/gnu/binutils/binutils-2.35.tar.gztar xvf binutils-2.35.tar.gz
Finally, build hsdis:
make BINUTILS=binutils-2.35 ARCH=amd64
The remaining steps are going to vary by operating system. If you're making use of something like SDK Man, ensure that the correct JDK is set to current - given we're building hsdis for JDK 16, it'd need to be OpenJDK 16 (or equivalent from Azul etc.).
sudo cp build/linux-amd64/hsdis-amd64.so $JAVA_HOME/lib/server
sudo cp build/macosx-amd64/hsdis-amd64.dylib $JAVA_HOME/lib/server
- Added 10 March 2021
- Updated 16 March 2021 for JDK 16
- 🌳reading time
2 min readpublished