Oh dear, now I've posted a bad fix. Sorry for posting this prematurely - I
thought I had this sorted.
On Monday, March 26, 2018 at 11:31:38 AM UTC-4, curts wrote:
>
> My work on Windows requires my JAVA_HOME point to a 64-bit JDK, but this
> doesn't play well with the 'vncviewer-java.bat' script, which expects
> JAVA_HOME to point to a 32-bit JDK if it is set. I would like to submit an
> enhanced launch script for consideration.
>
> <code>
> @echo off
> setlocal enableextensions enabledelayedexpansion
> rem Find the 32-bit JRE
> if defined PROGRAMFILES(x86) (set "reg=%windir%\SysWOW64\reg") else set
> "reg=reg"
> set "branch=HKLM\Software\JavaSoft\Java Runtime Environment"
>
> for /f "tokens=3" %%v in ('%reg% query "%branch%" /v "CurrentVersion" ^|
> find "REG_SZ"') do (
> for /f "tokens=2*" %%I in ('%reg% query "%branch%\%%v" /v "JavaHome"
> ^| find "REG_SZ"') do (
> set "JRE32=%%J"
> )
> )
> echo Location of 32-bit java.exe: %JRE32%\bin
>
> if DEFINED JAVA_HOME goto java_home_defined
>
> set JAVA=java
> goto java_home_undefined
>
> :java_home_defined
> if defined PROGRAMFILES(x86) goto java_home_64bit
> set JAVA_HOME=%JAVA_HOME:"=%
> if "%JAVA_HOME%"=="" (
> set JAVA=java
> ) else (
> set JAVA=%JAVA_HOME%\bin\java.exe
> set JAWT_PATH=%JAVA_HOME%\bin
> )
> if DEFINED JAWT_PATH goto jawt_path_defined
>
> :java_home_undefined
> rem This should work with Java 7 and later.
> for /f "delims== tokens=2,3*" %%i in ('"%JAVA% -XshowSettings:properties
> -version 2>&1 | findstr sun.boot.library.path"') do set _TMP=?%%i
> set _TMP2=%_TMP:? =%
> if EXIST "%_TMP2%\jawt.dll" set JAWT_PATH=%_TMP2%
> if DEFINED JAWT_PATH goto jawt_path_defined
>
> rem Maybe we're using Java 6?
> if EXIST "c:\Program Files\Java\jre6\bin\jawt.dll" set
> JAWT_PATH=c:\Program Files\Java\jre6\bin
> if DEFINED JAWT_PATH goto jawt_path_defined
>
> echo WARNING: Could not find jawt.dll. Some features may not work
> properly.
> goto start
>
> :java_home_64bit
> rem Check for 64-bit JAVA_HOME
> if "%JAVA_HOME:~0,16%"==%PROGRAMFILES% (
> rem Cannot use 64-bit Java, unset JAVA_HOME
> echo Unset 64-bit JAVA_HOME
> set JAVA_HOME=
> set JAVA=%JRE32%\bin\java.exe
> set JAWT_PATH=%JRE32%\bin
> goto jawt_path_defined
> ) else (
> rem JAVA_HOME is 32-bit Java
> set JAVA=%JAVA_HOME%\bin\java.exe
> set JAWT_PATH=%JAVA_HOME%\bin
> )
>
> :jawt_path_defined
> echo JAWT_PATH=%JAWT_PATH%
> set PATH=%JAWT_PATH%;%PATH%
> echo jawt.dll path: %JAWT_PATH%
> goto start
>
> :start
> "%JAVA%" -Dsun.java2d.d3d=false -Djava.library.path="%~d0%~p0java" -jar
> "%~d0%~p0java\VncViewer.jar" -reqarch x86 %*
> </code>
>
> Kind regards,
>
> Curt
>
--
You received this message because you are subscribed to the Google Groups
"TurboVNC User Discussion/Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/turbovnc-users/5dbac18f-9824-4988-ba45-b694aa93a135%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.