Revision: 5897
          http://sourceforge.net/p/jump-pilot/code/5897
Author:   michaudm
Date:     2018-06-25 07:07:07 +0000 (Mon, 25 Jun 2018)
Log Message:
-----------
Modify slightly the way the windows .bat search for java

Modified Paths:
--------------
    core/trunk/ChangeLog
    core/trunk/scripts/oj_windows.bat

Modified: core/trunk/ChangeLog
===================================================================
--- core/trunk/ChangeLog        2018-06-22 14:11:24 UTC (rev 5896)
+++ core/trunk/ChangeLog        2018-06-25 07:07:07 UTC (rev 5897)
@@ -3,6 +3,9 @@
 # 2. make sure that lines break at 80 chars for constricted display situations
 #<-------------------------------- 80 chars 
---------------------------------->#
 
+2018-06-25
+  * Modify slightly the way the windows .bat search for java
+
 2018-06-11 Giuseppe Aruta. Raster profile plugin:
   * Plugin recognizes Layer unit.
   * Absolute or relative slope output

Modified: core/trunk/scripts/oj_windows.bat
===================================================================
--- core/trunk/scripts/oj_windows.bat   2018-06-22 14:11:24 UTC (rev 5896)
+++ core/trunk/scripts/oj_windows.bat   2018-06-25 07:07:07 UTC (rev 5897)
@@ -49,7 +49,11 @@
   rem --- default to javaw ---
   if "%JAVA_BIN%"=="" set JAVA_BIN=javaw
 
-  rem --- search binary in path ---
+  rem --- if JAVA_HOME is defined and valid, use it ---
+  if NOT "%JAVA_HOME%"=="" set "JAVA=%JAVA_HOME%\bin\%JAVA_BIN%"
+  if exist "%JAVA%.exe" goto java_is_set
+
+  rem --- otherwise, search binary in path ---
   @for %%i in (%JAVA_BIN%.exe) do @if NOT "%%~$PATH:i"=="" set JAVA=%%~$PATH:i
 
   rem --- we might be on amd64 having only x86 jre installed ---
@@ -63,10 +67,17 @@
 
   rem --- if unset fall back to plain bin name, just in case ---
   if "%JAVA%"=="" set JAVA=%JAVA_BIN%
-  
-  rem --- java home definition overwrites all ---
-  if NOT "%JAVA_HOME%"=="" set "JAVA=%JAVA_HOME%\bin\%JAVA_BIN%"
 
+  rem --- if %JAVA% is still not a valid java path, print an informative 
warning ---
+  if not exist %JAVA% (
+    echo WARNING : JAVA can not be found on your system
+       echo check that you have a valid JRE or JDK accessible from the system 
PATH or from the variable environment JAVA_HOME
+       pause
+       call:end
+  )
+
+rem -- we now have a valid java executable
+:java_is_set
 rem -- show java version (for debugging) --
 for %%F in ("%JAVA%") do set "dirname=%%~dpF"
 echo Using '%JAVA_BIN%' found in '%dirname%'


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to