karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hkes...@apache.org
Subject svn commit: r1483043 - /karaf/branches/karaf-2.3.x/assemblies/apache-karaf/src/main/distribution/windows-text/bin/karaf.bat
Date Wed, 15 May 2013 19:37:41 GMT
Author: hkesler
Date: Wed May 15 19:37:41 2013
New Revision: 1483043

URL: http://svn.apache.org/r1483043
Log:
KARAF-1799: added in new checks for JAVA_HOME using Reg Query

Modified:
    karaf/branches/karaf-2.3.x/assemblies/apache-karaf/src/main/distribution/windows-text/bin/karaf.bat

Modified: karaf/branches/karaf-2.3.x/assemblies/apache-karaf/src/main/distribution/windows-text/bin/karaf.bat
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.3.x/assemblies/apache-karaf/src/main/distribution/windows-text/bin/karaf.bat?rev=1483043&r1=1483042&r2=1483043&view=diff
==============================================================================
--- karaf/branches/karaf-2.3.x/assemblies/apache-karaf/src/main/distribution/windows-text/bin/karaf.bat
(original)
+++ karaf/branches/karaf-2.3.x/assemblies/apache-karaf/src/main/distribution/windows-text/bin/karaf.bat
Wed May 15 19:37:41 2013
@@ -154,18 +154,15 @@ if not "%JAVA%" == "" goto :Check_JAVA_E
 :TryJDK
     start /w regedit /e __reg1.txt "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development
Kit"
     if not exist __reg1.txt (
-        call :warn Unable to retrieve JAVA_HOME
-        goto END
+        goto TryRegJRE
     )
     type __reg1.txt | find "CurrentVersion" > __reg2.txt
     if errorlevel 1 (
-        call :warn Unable to retrieve JAVA_HOME
-        goto END
+        goto TryRegJRE
     )
     for /f "tokens=2 delims==" %%x in (__reg2.txt) do set JavaTemp=%%~x
     if errorlevel 1 (
-        call :warn Unable to retrieve JAVA_HOME
-        goto END
+        goto TryRegJRE
     )
     set JavaTemp=%JavaTemp%##
     set JavaTemp=%JavaTemp:                ##=##%
@@ -193,6 +190,30 @@ if not "%JAVA%" == "" goto :Check_JAVA_E
     )
     del __reg1.txt
     del __reg2.txt
+:TryRegJRE
+    rem try getting the JAVA_HOME from registry
+    FOR /F "usebackq tokens=3*" %%A IN (`REG QUERY "HKLM\Software\JavaSoft\Java Runtime Environment"
/v CurrentVersion`) DO (
+       set JAVA_VERSION=%%A
+    )
+    FOR /F "usebackq tokens=3*" %%A IN (`REG QUERY "HKLM\Software\JavaSoft\Java Runtime Environment\%JAVA_VERSION%"
/v JavaHome`) DO (
+       set JAVA_HOME=%%A %%B
+    )
+    if not exist "%JAVA_HOME%" (
+       goto TryRegJDK
+	)
+	goto TryJDKEnd
+:TryRegJDK
+    rem try getting the JAVA_HOME from registry
+    FOR /F "usebackq tokens=3*" %%A IN (`REG QUERY "HKLM\Software\JavaSoft\Java Development
Kit" /v CurrentVersion`) DO (
+       set JAVA_VERSION=%%A
+    )
+    FOR /F "usebackq tokens=3*" %%A IN (`REG QUERY "HKLM\Software\JavaSoft\Java Development
Kit\%JAVA_VERSION%" /v JavaHome`) DO (
+       set JAVA_HOME=%%A %%B
+    )
+    if not exist "%JAVA_HOME%" (
+       call :warn Unable to retrieve JAVA_HOME from Registry
+    )
+	goto TryJDKEnd
 :TryJDKEnd
     if not exist "%JAVA_HOME%" (
         call :warn JAVA_HOME is not valid: "%JAVA_HOME%"



Mime
View raw message