Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

Commit

Permalink
improved logging for JAVA_HOME detection // refs #100
Browse files Browse the repository at this point in the history
  • Loading branch information
tofi86 committed Feb 3, 2021
1 parent d83b501 commit 0880026
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0


## [Unreleased]
### Changed
- Improved logging for JAVA_HOME detection (#100)

### Fixed
- Fixed a crash when `/usr/libexec/java_home` returns no JVMs (#93)

Expand Down
10 changes: 9 additions & 1 deletion src/universalJavaApplicationStub
Original file line number Diff line number Diff line change
Expand Up @@ -527,19 +527,27 @@ if [ -n "$JAVA_HOME" ] ; then
if [[ $JAVA_HOME == /* ]] ; then
# if "$JAVA_HOME" starts with a Slash it's an absolute path
JAVACMD="$JAVA_HOME/bin/java"
stub_logger "[JavaSearch] ... parsing JAVA_HOME as absolute path to the executable '$JAVACMD'"
else
# otherwise it's a relative path to "$AppPackageFolder"
JAVACMD="$AppPackageFolder/$JAVA_HOME/bin/java"
stub_logger "[JavaSearch] ... parsing JAVA_HOME as relative path inside the App bundle to the executable '$JAVACMD'"
fi
JAVACMD_version=$(get_comparable_java_version $(get_java_version_from_cmd "${JAVACMD}"))
else
stub_logger "[JavaSearch] ... didn't found JAVA_HOME"
stub_logger "[JavaSearch] ... haven't found JAVA_HOME"
fi


# check for any other or a specific Java version
# also if $JAVA_HOME exists but isn't executable
if [ -z "${JAVACMD}" ] || [ ! -x "${JAVACMD}" ] ; then

# add a warning in the syslog if JAVA_HOME is not executable or not found (#100)
if [ -n "$JAVA_HOME" ] ; then
stub_logger "[JavaSearch] ... but no 'java' executable was found at the JAVA_HOME location!"
fi

stub_logger "[JavaSearch] Searching for JavaVirtualMachines on the system ..."
# reset variables
JAVACMD=""
Expand Down

0 comments on commit 0880026

Please sign in to comment.