zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fang...@apache.org
Subject [zookeeper] branch master updated: ZOOKEEPER-3291: Improve error message when JAVA_HOME is set to the wrong value
Date Fri, 15 Mar 2019 05:35:18 GMT
This is an automated email from the ASF dual-hosted git repository.

fangmin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zookeeper.git


The following commit(s) were added to refs/heads/master by this push:
     new 7256d01  ZOOKEEPER-3291: Improve error message when JAVA_HOME is set to the wrong
value
7256d01 is described below

commit 7256d01a26412cd35a46edab6de9ac8c5adf5bb3
Author: Mogens Heller Grabe <mookid8000@gmail.com>
AuthorDate: Thu Mar 14 22:35:07 2019 -0700

    ZOOKEEPER-3291: Improve error message when JAVA_HOME is set to the wrong value
    
    This is small (Windows-based) developer usability improvement.
    
    When the `JAVA_HOME` environment variable is set, but the value is wrong (so that `JAVA_HOME`
+ `/bin/java.exe` does not point correctly to `java.exe`), the startup script will simply
fail with the message
    ```dos
    Error: JAVA_HOME is incorrectly set.
    ```
    which is a bummer. 😞
    
    With this tiny change, the error message will be much friendlier:
    ```dos
    Error: JAVA_HOME is incorrectly set: C:\Program Files\Java\jre1.8.0_201\bin
    Expected to find java.exe here: C:\Program Files\Java\jre1.8.0_201\bin\bin\java.exe
    ```
    (in this case showing a situation where one has inadvertently included `/bin` in the `JAVA_HOME`
environment variable).
    
    This will also give a nicer error message in situations, where the JRE has been updated,
and the one pointed to by `JAVA_HOME` has been uninstalled.
    
    Author: Mogens Heller Grabe <mookid8000@gmail.com>
    
    Reviewers: andor@apache.org, eolivelli@apache.org, fangmin@apache.org
    
    Closes #834 from mookid8000/master
---
 bin/zkEnv.cmd | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/bin/zkEnv.cmd b/bin/zkEnv.cmd
index 9497582..68e231d 100644
--- a/bin/zkEnv.cmd
+++ b/bin/zkEnv.cmd
@@ -42,7 +42,8 @@ if not defined JAVA_HOME (
 set JAVA_HOME=%JAVA_HOME:"=%
 
 if not exist "%JAVA_HOME%"\bin\java.exe (
-  echo Error: JAVA_HOME is incorrectly set.
+  echo Error: JAVA_HOME is incorrectly set: %JAVA_HOME%
+  echo Expected to find java.exe here: %JAVA_HOME%\bin\java.exe
   goto :eof
 )
 


Mime
View raw message