Proxyman icon indicating copy to clipboard operation
Proxyman copied to clipboard

install-certificates-java.sh Doesn't work with JVMs installed via SDKMAN

Open jeremyross opened this issue 4 years ago • 11 comments

Proxyman version? 2.15.0 (21500)

macOS Version? 10.15.7 (

Steps to reproduce

  1. Run install-certificates-java.sh

Expected behavior

Installs cert into JVM

/usr/libexec/java_home only returns JVMs installed by Mac OS. SDKMAN is a popular alternative way of installing and managing JVMs. I was able to modify install-certificates-java.sh and get this working:

home=/Users/jeremyross/.sdkman/candidates/java/current

A better solution would be to take into account /usr/libexec/java_home, SDKMAN, and probably homebrew installs as well.

jeremyross avatar Dec 22 '20 14:12 jeremyross

Thanks for the solution. I will checkout the SDKMAN and support it 🙌

NghiaTranUIT avatar Dec 22 '20 14:12 NghiaTranUIT

It's fixed with this beta build: https://proxyman.s3.us-east-2.amazonaws.com/beta/Proxyman_2.15.1_Support_SDKMAN_JAVA.dmg

Thank you for opening the ticket 🎉

NghiaTranUIT avatar Dec 24 '20 10:12 NghiaTranUIT

This is not working. The script fails on this line:

HOME=$(/usr/libexec/java_home)

with this message:

Unable to find any JVMs matching version "(null)". No Java runtime present, try --request to install.

So, the script never gets to the part where it checks JAVA_HOME and SDKMAN.

jeremyross avatar Aug 18 '21 19:08 jeremyross

Thanks for getting back @jeremyross. I will revisit the script to see how to fix it 👍

If you don't mind, you can manually fix the script at

/Applications/Proxyman.app/Contents/Frameworks/ProxymanCore.framework/Versions/A/Resources/install-certificates-java.sh

By removing the part:

# Default directory
HOME=/usr/libexec/java_home
if [ -f "$HOME" ]; then
    HOME=$(/usr/libexec/java_home)
    if [[ -z "$HOME" ]]; then
        echo "Could not find /usr/libexec/java_home!"
    elif [[ -n "$HOME" ]]; then
        echo "=> Found $HOME"
        install_certificate $HOME
    fi
fi

It will work with the SDKMAN

NghiaTranUIT avatar Aug 19 '21 01:08 NghiaTranUIT

Pinging this issue to remind someone that it's still an issue. SDKMAN is a very popular tool among Java developers for installing modern JDK's.

jamesdh avatar Aug 28 '22 14:08 jamesdh

Thanks @jamesdh for reminder. I will look on it and send a beta soon 👍

Just wondering:

  • Which SDKMan version you're using?
  • And the path? echo $SDKMAN_DIR

NghiaTranUIT avatar Aug 29 '22 00:08 NghiaTranUIT

@NghiaTranUIT SDKMAN 5.16.0. It's worth mentioning that SDKMAN automatically keeps itself up to date, so most people that use it will be on either the newest version or maybe one version back.

Via the SDKMAN setup script, SDKMAN_DIR="$HOME/.sdkman", hence in my case on macOS it's /Users/jamesdh/.sdkman

jamesdh avatar Aug 29 '22 13:08 jamesdh

Hey @jamesdh let's try this beta build: https://proxyman.s3.us-east-2.amazonaws.com/beta/Proxyman_3.8.0_Fix_sdkman.dmg

It works fine with sdkman 👍

Screen Shot 2022-08-30 at 15 52 50

NghiaTranUIT avatar Aug 30 '22 08:08 NghiaTranUIT

@NghiaTranUIT if I do brew uninstall proximal will that sufficiently remove any previously installed certificates so that I can retry the install w/ your beta build?

jamesdh avatar Sep 01 '22 16:09 jamesdh

Yes, it's sufficient. It will delete all Proxyman data, certificate in the disk + Keychain (Ref: https://github.com/Homebrew/homebrew-cask/blob/212b287c3e8775f2bf320d2be09087ba7e713e6f/Casks/proxyman.rb#L20)

You can simply do it by the GUI: Visit Help Menu -> Advanced -> Factory Reset.


Note: It's brew uninstall proxyman, not proximal

NghiaTranUIT avatar Sep 01 '22 16:09 NghiaTranUIT

@NghiaTranUIT can confirm it appears fixed!

jamesdh avatar Sep 01 '22 16:09 jamesdh