Quantcast

/hg/icedtea-web: added support for reading java home from regsitry

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

/hg/icedtea-web: added support for reading java home from regsitry

jvanek
changeset ecc6ddd954aa in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=ecc6ddd954aa
author: Jiri Vanek <[hidden email]>
date: Fri May 19 13:34:31 2017 +0200

        added support for reading java home from regsitry

        * launcher/launchers.bat.in: registry support(Alex), fixed issue with ITW_WIN_SPECIALS, fixed issue with returnvlaue, user-in-file java path proffered over all.


diffstat:

 ChangeLog                 |   8 +++++++
 launcher/launchers.bat.in |  51 +++++++++++++++++++++++++++++++++++-----------
 2 files changed, 46 insertions(+), 13 deletions(-)

diffs (95 lines):

diff -r 30e002f01f8e -r ecc6ddd954aa ChangeLog
--- a/ChangeLog Fri May 19 10:49:05 2017 +0200
+++ b/ChangeLog Fri May 19 13:34:31 2017 +0200
@@ -1,3 +1,11 @@
+2017-05-19  Jiri Vanek <[hidden email]>
+            Alex Kashchenko <[hidden email]>
+
+ added support for reading java home from regsitry
+ * launcher/launchers.bat.in: registry support(Alex),
+ fixed issue with ITW_WIN_SPECIALS, fixed issue with returnvlaue,
+ user-in-file java path proffered over all.
+
 2017-12-19  Alex Kashchenko <[hidden email]>
 
  Aligned msi and netx icons
diff -r 30e002f01f8e -r ecc6ddd954aa launcher/launchers.bat.in
--- a/launcher/launchers.bat.in Fri May 19 10:49:05 2017 +0200
+++ b/launcher/launchers.bat.in Fri May 19 13:34:31 2017 +0200
@@ -3,32 +3,53 @@
 rem use JAVA_HOME to set path to JRE
 rem any redistribution/installer can replace INST_ITW_HOME and INST_JAVA_HOME to create better defaults
 rem if not set, following defaults are used
-set NASHORN=lib/ext/nashorn.jar
-set LAUNCHER_FLAGS=-Xms8m
-set ITW_WIN_SPECIALS=-Xnofork
-
 set CLASSNAME=@MAIN_CLASS@
 set PROGRAM_NAME=@PROGRAM_NAME@
 
+set NASHORN=lib/ext/nashorn.jar
+set LAUNCHER_FLAGS=-Xms8m
+if "%PROGRAM_NAME%" == "javaws"  (
+  set ITW_WIN_SPECIALS=-Xnofork
+) else (
+ set ITW_WIN_SPECIALS=
+)
+
+
 rem warning for linux users: when you put VAR="value" also quotes are stored in VAR!
 rem maybe set "VAR=value" is working better?
-set INST_ITW_HOME=%~dp0/../
+
 set INST_JAVA_HOME=
+set BAD_SLASH_SCRIPT_DIR=%~dp0
+set SCRIPT_DIR=%BAD_SLASH_SCRIPT_DIR:\=/%
+set ITW_HOME=%SCRIPT_DIR%../
 
-if "%JAVA_HOME%" == ""  (
-  if not "%INST_JAVA_HOME%" == ""  (
-  set CP=%INST_JAVA_HOME%/lib/rt.jar;%INST_JAVA_HOME%/lib/jfxrt.jar
-  set NASHORN=%INST_JAVA_HOME%/%NASHORN%
-  set JAVA=%INST_JAVA_HOME%/bin/java
+rem the following is for testing-only and not intended to be robust
+rem will not work from 32-bit firefox
+for /f "tokens=*" %%a in ('%windir%\System32\reg query "HKLM\SOFTWARE\JavaSoft\Java Development Kit"') do set "version_key=%%a"
+set "version=%version_key:~58%"
+for /f "tokens=*" %%a in ('%windir%\System32\reg query "HKLM\SOFTWARE\JavaSoft\Java Development Kit\%version%" /v JavaHome') do set "jh_key=%%a"
+set BAD_SLASH_JAVA_HOME=%jh_key:~22%
+set REG_JAVA_HOME=%BAD_SLASH_JAVA_HOME:\=/%
+"%REG_JAVA_HOME%/bin/java.exe" -version
+if errorlevel 0 if not errorlevel 1 (
+    set JAVA_HOME=%REG_JAVA_HOME%
+)
+
+
+if "%INST_JAVA_HOME%" == ""  (
+  if not "%JAVA_HOME%" == ""  (
+  set CP=%JAVA_HOME%/lib/rt.jar;%JAVA_HOME%/lib/jfxrt.jar
+  set NASHORN=%JAVA_HOME%/%NASHORN%
+  set JAVA=%JAVA_HOME%/bin/java
   ) else (
     set CP=@JRE@/lib/rt.jar;@JRE@/lib/jfxrt.jar
     set NASHORN=@JRE@/%NASHORN%
     set JAVA=@JAVA@
   )
 ) else (
-  set CP=%JAVA_HOME%/lib/rt.jar;%JAVA_HOME%/lib/jfxrt.jar
-  set NASHORN=%JAVA_HOME%/%NASHORN%
-  set JAVA=%JAVA_HOME%/bin/java
+  set CP=%INST_JAVA_HOME%/lib/rt.jar;%INST_JAVA_HOME%/lib/jfxrt.jar
+  set NASHORN=%INST_JAVA_HOME%/%NASHORN%
+  set JAVA=%INST_JAVA_HOME%/bin/java
 )
 
 if "%ITW_HOME%" == ""  (
@@ -52,5 +73,9 @@
 rem TODO use "exec -a %PROGRAM_NAME% ..." idiom
 "%JAVA%" "-splash:%SPLASH_LOCATION%" "%LAUNCHER_BOOTCLASSPATH%" %LAUNCHER_FLAGS% %JAVAWS_J_OPTIONS% "-classpath" "%CP%" "-Dicedtea-web.bin.name=%PROGRAM_NAME%" "-Dicedtea-web.bin.location=%BINARY_LOCATION%" "%CLASSNAME%" %ITW_WIN_SPECIALS% %*
 
+SET errno=%ERRORLEVEL%
+
+
 echo Please press any key to close this window/get back prompt
 pause > nul
+EXIT /B %errno%
Loading...