MacOS M1 users may encounter an error when trying to run Apache Directory Studio, a powerful and easy-to-use LDAP (Lightweight Directory Access Protocol) server and client management tool. The error message reads:

The JVM shared library "path/to/libjvm.dylib" does not contain the JNI_CreateJavaVM symbol.

Initially, attempts were made to run Apache Directory Studio using Java 20, but it appears that the application requires Java 11 for compatibility. However, even after installing Java 11 using Homebrew with the ARM architecture, the error persisted. This issue occurs due to incompatibility between the ARM version of the JDK installed on the M1 Mac and Apache Directory Studio.

To resolve this problem, it is necessary to install Homebrew for the Intel (x86_64) architecture, and then use it to install the x86_64 version of OpenJDK 11. Configuring Apache Directory Studio to use the x86_64 version of OpenJDK 11 will fix the missing JNI_CreateJavaVM symbol issue.

The guide below provides a step-by-step solution to install the x86_64 version of OpenJDK 11 and configure Apache Directory Studio to use it, allowing you to run the application on your MacOS M1 machine seamlessly.

Step 1: Install Rosetta 2

If you haven’t already installed Rosetta 2, open Terminal and enter:

softwareupdate --install-rosetta

Step 2: Install x86_64 Homebrew

Install a separate x86_64 instance of Homebrew in the /usr/local prefix:

arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Step 3: Add x86_64 Homebrew to your PATH

If you’re using Zsh (default shell in recent MacOS versions), run:

echo 'if [[ $(arch) == "i386" ]]; then eval "$(/usr/local/bin/brew shellenv)"; fi' >> ~/.zshrc

source ~/.zshrc

If you’re using Bash, run:

echo 'if [[ $(arch) == "i386" ]]; then eval "$(/usr/local/bin/brew shellenv)"; fi' >> ~/.bash_profile

source ~/.bash_profile

Step 4: Install x86_64 OpenJDK 11

Install the x86_64 version of OpenJDK 11 using the x86_64 Homebrew:

arch -x86_64 brew install openjdk@11

Step 5: Link OpenJDK 11

Link the x86 OpenJDK 11 installation:

sudo ln -sfn /usr/local/opt/openjdk@11/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-11.jdk

Step 6: Update Apache Directory Studio Info.plist

  • Locate the Apache Directory Studio app in the Applications folder.
  • Right-click on the app and choose “Show Package Contents”.
  • Navigate to Contents > Info.plist and open it in a text editor.

Look for the following section:

<key>Eclipse</key>
<array>
    <string>-vm</string>
    <string>/path/to/your/jdk/bin/java</string>
</array>

If this section is not present, add it just before the <key>CFBundleExecutable</key> line.

Replace /path/to/your/jdk/bin/java with the path to your x86_64 JDK 11 installation:

<string>/usr/local/Cellar/openjdk@11/11.0.18/libexec/openjdk.jdk/Contents/Home/bin/java</string>

Save the changes and close the Info.plist file.

Step 7: Run Apache Directory Studio

Open Apache Directory Studio. The issue with the missing JNI_CreateJavaVM symbol should now be resolved, and you can use the application on your MacOS M1 machine.

LEAVE A REPLY

Please enter your comment!
Please enter your name here