LP1743604: Try to find Java automatically
authorJason Boyer <JBoyer@library.in.gov>
Fri, 26 Jan 2018 04:20:17 +0000 (23:20 -0500)
committerGalen Charlton <gmc@equinoxinitiative.org>
Tue, 6 Feb 2018 22:15:45 +0000 (17:15 -0500)
Starting sometime in the 1.8 timeframe Java
installations on Windows are making use of unix-
style symlinks available in NTFS to keep the
most reecnt version installed available at a
known location. We may as well look there if
the path isn't set correctly for some reason.

Signed-off-by: Jason Boyer <JBoyer@library.in.gov>
Signed-off-by: Chris Sharp <csharp@georgialibraries.org>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
extension/app/manifest.json
hatch.bat
installer/windows/defines.nsh

index a54b37b..e953e35 100644 (file)
@@ -1,6 +1,6 @@
 {
   "name": "Hatch Native Messenger",
-  "version": "0.1.4",
+  "version": "0.1.5",
   "manifest_version": 2,
   "description": "Relays messages to/from Hatch.",
   "icons": { 
index 9e38151..cb3cc6b 100755 (executable)
--- a/hatch.bat
+++ b/hatch.bat
@@ -2,6 +2,11 @@
 REM Windows Hatch Execution Script
 REM @echo off required for STDIO to work with the browser.
 
+REM NOTE: Do not EVER set ERRORLEVEL for any reason; it's a passthrough variable that takes on the current value
+REM of the errorlevel return status but if you assign to it that magic passthrough is broken and it's just set to that value.
+REM This is necessary to do sensible comparisons against it. (such as EQU) The 'if errorlevel' construct is completely bananas.
+REM Also: automatic path testing only looks for 'java' - if you don't have the JDK in your path you'll need to fix that yourself.
+
 REM Assume java executables are in our path
 SET JAVA=java
 SET JAVAC=javac
@@ -13,6 +18,22 @@ REM SET JAVA=%JAVA_HOME%\bin\java
 REM SET JAVAC=%JAVA_HOME%\bin\javac
 REM SET JAR=%JAVA_HOME%\bin\jar
 
+REM Is anyone there?
+%JAVA% --dry-run -cp "lib\*" org.evergreen_ils.hatch.Hatch 2>nul
+
+IF %ERRORLEVEL% EQU 0 GOTO Huzzah
+
+REM Are you still there?
+SET JAVA=%PROGRAMDATA%\Oracle\Java\javapath\java
+%JAVA% --dry-run -cp "lib\*" org.evergreen_ils.hatch.Hatch 2>nul
+
+IF %ERRORLEVEL% EQU 0 GOTO Huzzah
+
+REM I don't blame you
+EXIT %ERRORLEVEL%
+
+REM There you are.
+:Huzzah
 
 IF "%1" == "compile" (
 
@@ -42,4 +63,3 @@ IF "%1" == "compile" (
 
     )
 )
-
index 5de6a28..8afcac3 100644 (file)
@@ -14,7 +14,7 @@
 ; Version numbers should be integers
 !define VERSIONMAJOR 0
 !define VERSIONMINOR 1
-!define VERSIONBUILD 4
+!define VERSIONBUILD 5
 !define FULLVERSION "${VERSIONMAJOR}.${VERSIONMINOR}.${VERSIONBUILD}"
 ;---------------------------
 ; Add Remove info