ProxymanApp / Proxyman

Modern. Native. Delightful Web Debugging Proxy for macOS, iOS, and Android ⚡️
https://proxyman.io
5.51k stars 181 forks source link

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

Open jeremyross opened 3 years ago

jeremyross commented 3 years ago

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.

NghiaTranUIT commented 3 years ago

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

NghiaTranUIT commented 3 years ago

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 🎉

jeremyross commented 3 years ago

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.

NghiaTranUIT commented 3 years ago

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

jamesdh commented 2 years ago

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.

NghiaTranUIT commented 2 years ago

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

Just wondering:

jamesdh commented 2 years ago

@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

NghiaTranUIT commented 2 years ago

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
jamesdh commented 2 years ago

@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?

NghiaTranUIT commented 2 years ago

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

jamesdh commented 2 years ago

@NghiaTranUIT can confirm it appears fixed!