You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 17, 2022. It is now read-only.
[x] Wrong documentation
[x] Improvement of existing article
Please, tell us more details
Currently the docs are telling to set the JAVA_HOME variable this way:
export JAVA_HOME=$(update-alternatives --query javac | sed -n -e 's/Best: *\(.*\)\/bin\/javac/\1/p')
This can work, but not always: in a system where Java 14 is installed, then it will be reported as the "best" option, which in turn will not be compatible with Nativescript as it supports Java >= 8 and <= 13. "Best" is the most recent version .
I've found a good script, which is working fine, it depends on which version the user selects from update-alternatives:
#!/bin/bash
if [ -z "${JAVA_HOME}" ]
then
JAVA_HOME=$(readlink -nf $(which java) | xargs dirname | xargs dirname | xargs dirname)
if [ ! -e "$JAVA_HOME" ]
then
JAVA_HOME=""
fi
export JAVA_HOME=$JAVA_HOME
fi
Please, tell us what's the problem?
[x] Wrong documentation
[x] Improvement of existing article
Please, tell us more details
Currently the docs are telling to set the JAVA_HOME variable this way:
export JAVA_HOME=$(update-alternatives --query javac | sed -n -e 's/Best: *\(.*\)\/bin\/javac/\1/p')
This can work, but not always: in a system where Java 14 is installed, then it will be reported as the "best" option, which in turn will not be compatible with Nativescript as it supports Java >= 8 and <= 13. "Best" is the most recent version .
I've found a good script, which is working fine, it depends on which version the user selects from
update-alternatives
:To switch the default java version to be used:
The text was updated successfully, but these errors were encountered: