This blog post is about how to solve a problem when you try to execute a Jupyter Notebook on a macOS.
When you get the following error during the execution of your Jupyter Notebook it is maybe related to your Java version.
JVMJ9VM015W Initialization error for library j9gc29(2): Failed to instantiate compressed references metadata. 200M requested
Steps how to configure Java on your macOS
Step 1: Download an OpenJDK version
Step 2: Open a terminal and navigate to the download folder
cd ~/Downloads
Step 3: Verify the downloaded file
ls -la | grep openjdk
-rw-r--r--@ 1 thomassuedbroecker staff 185375922 1 Jul XX:XX openjdk-18_macos-x64_bin.tar.gz
Step 4: Extract the file to a folder
tar -xf openjdk-18_macos-x64_bin.tar.gz
Step 5: Verify the extraction
ls -la | grep jdk
drwxr-xr-x@ 3 thomassuedbroecker staff 96 15 Feb 13:08 jdk-18.jdk
-rw-r--r--@ 1 thomassuedbroecker staff 185375922 1 Jul XX:XX openjdk-18_macos-x64_bin.tar.gz
Step 6: Move the jdk folder to the java virtual machines
sudo mv jdk-18.jdk /Library/Java/JavaVirtualMachines/
Step 7: Verify the installed Java virtual machines
/usr/libexec/java_home -V
- Example output:
Matching Java Virtual Machines (3):
18 (x86_64) "Oracle Corporation" - "OpenJDK 18" /Library/Java/JavaVirtualMachines/jdk-18.jdk/Contents/Home
11.0.11 (x86_64) "AdoptOpenJDK" - "AdoptOpenJDK (OpenJ9) 11" /Library/Java/JavaVirtualMachines/adoptopenjdk-11-openj9.jdk/Contents/Home
1.8.0_322 (x86_64) "Homebrew" - "OpenJDK 8" /usr/local/Cellar/openjdk@8/1.8.0+322/libexec/openjdk.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/jdk-18.jdk/Contents/Home
Step 8: Open your shell profile with a editor¶
nano ~/.zshrc
- Example configuration:
Change the text to your newly installed virtual machine
export JAVA_HOME=/usr/libexec/java_home -v 18
#-------------------
# Java settings
#-------------------
# SWITCH TO JAVA VERSION 8
# export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
# SWITCH TO JAVA VERSION 11
# export JAVA_HOME=`/usr/libexec/java_home -v 11`
# SWITCH TO JAVA VERSION 18
export JAVA_HOME=`/usr/libexec/java_home -v 18`
Step 9: Close the terminal and start a new terminal¶
Now verify the newly configured Java runtime usage
java -version
- Example output:
openjdk version "18" 2022-03-22
OpenJDK Runtime Environment (build 18+36-2087)
OpenJDK 64-Bit Server VM (build 18+36-2087, mixed mode, sharing)
Step 10: Start the Jupyter notebook again
jupyter notebook
The following image shows an extract of an example notebook.

Summary¶
The problem was fixed by using a newer Java version and restart the Jupyter Notebook.
Additional useful links¶
I hope this was useful to you and let’s see what’s next?
Greetings,
Thomas
#java, #jupyternotebook
Leave a Reply