Closed canalet0 closed 3 years ago
Paging @halcyon and @joschi. In another computer running macOS I had the same problem as @canalet0 when trying to installing a java version using the latest version with "java_macos_integration_enable = yes"
I think is a good idea to put coreutils as a dependency for macOS. What do you think?
I think is a good idea to put coreutils as a dependency for macOS. What do you think?
IMHO it would be great if we could keep coreutils
as an optional dependency, i. e. use realpath
(or grealpath
) if it exists and have fallback otherwise.
Maybe this could work:
# DIR="$( cd -P "$( dirname "../../Users/./joschi/.asdf/installs/java/adoptopenjdk-15.0.1+9/bin/java" )" && pwd )"
# echo $DIR
/Users/joschi/.asdf/installs/java/adoptopenjdk-15.0.1+9/bin
Yep, this looks like a better approach. I was not aware of that cd
command flag.
Would then realpath
or grealpath
be of any use? Wouldn't be better to stick with your proposed solution in all cases?
Would then
realpath
orgrealpath
be of any use? Wouldn't be better to stick with your proposed solution in all cases?
It should work on macOS, *BSD, and Linux with bash and zsh. @halcyon Any opinion on which one to prefer?
For completeness:
Syntax
cd [-L|-P] [dir]
Key
-P Use the physical directory structure instead of following symbolic links
(see also the -P option to the set builtin command)
-L Force symbolic links to be followed
@joschi I prefer your approach. I like that it helps increase our ability to run on other platforms.
Do you want me to open a PR making those changes?
That would be great, thank you!
On Wed, Nov 18, 2020 at 4:43 PM Fernando Crespo notifications@github.com wrote:
Do you want me to open a PR making those changes?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/halcyon/asdf-java/issues/109#issuecomment-729974382, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAABMPCJ5XHMSIEQXAOXDW3SQQ5WLANCNFSM4SB43Q7Q .
Until that is merged, I've updated my zshrc
to include
# TODO can be removed once https://github.com/halcyon/asdf-java/pull/114/files is merged
function absolute_dir_path {
local absolute_path
absolute_path="$( cd -P "$( dirname "$1" )" && pwd )"
echo "$absolute_path"
}
alias realpath=absolute_dir_path
# rest of .zshrc ...
. $HOME/.asdf/asdf.sh
# append completions to fpath
fpath=(${ASDF_DIR}/completions $fpath)
# java/android SDK tools
# . ~/.asdf/plugins/java/set-java-home.zsh
export JAVA_HOME="$( cd -P "$(dirname $(dirname $(asdf which java) ))" && pwd )"
... rest of compinit etc...
I did this for the moment to get it working, I couldn't get the realpath substitution command to work on zsh/ohmyzsh on catalina via iterm2. This works for me and my flutter/android buildchain is now seeing the JAVA_HOME correctly.
when i put the script to change JAVA_HOME the console output this: asdf_update_java_home:5: command not found: realpath
There are some similar issues about the use of realpath on Mac OS, in workaround i have installed coreutils with: brew install coreutils