Skip to content

Commit 0880026

Browse files
committed
improved logging for JAVA_HOME detection // refs tofi86#100
1 parent d83b501 commit 0880026

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88

99
## [Unreleased]
10+
### Changed
11+
- Improved logging for JAVA_HOME detection (#100)
12+
1013
### Fixed
1114
- Fixed a crash when `/usr/libexec/java_home` returns no JVMs (#93)
1215

src/universalJavaApplicationStub

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,19 +527,27 @@ if [ -n "$JAVA_HOME" ] ; then
527527
if [[ $JAVA_HOME == /* ]] ; then
528528
# if "$JAVA_HOME" starts with a Slash it's an absolute path
529529
JAVACMD="$JAVA_HOME/bin/java"
530+
stub_logger "[JavaSearch] ... parsing JAVA_HOME as absolute path to the executable '$JAVACMD'"
530531
else
531532
# otherwise it's a relative path to "$AppPackageFolder"
532533
JAVACMD="$AppPackageFolder/$JAVA_HOME/bin/java"
534+
stub_logger "[JavaSearch] ... parsing JAVA_HOME as relative path inside the App bundle to the executable '$JAVACMD'"
533535
fi
534536
JAVACMD_version=$(get_comparable_java_version $(get_java_version_from_cmd "${JAVACMD}"))
535537
else
536-
stub_logger "[JavaSearch] ... didn't found JAVA_HOME"
538+
stub_logger "[JavaSearch] ... haven't found JAVA_HOME"
537539
fi
538540

539541

540542
# check for any other or a specific Java version
541543
# also if $JAVA_HOME exists but isn't executable
542544
if [ -z "${JAVACMD}" ] || [ ! -x "${JAVACMD}" ] ; then
545+
546+
# add a warning in the syslog if JAVA_HOME is not executable or not found (#100)
547+
if [ -n "$JAVA_HOME" ] ; then
548+
stub_logger "[JavaSearch] ... but no 'java' executable was found at the JAVA_HOME location!"
549+
fi
550+
543551
stub_logger "[JavaSearch] Searching for JavaVirtualMachines on the system ..."
544552
# reset variables
545553
JAVACMD=""

0 commit comments

Comments
 (0)