Hi Andrea,
You have changed the script so is tests if java is installed with
java –version
If this test finds java you set RUN_JAVA to directory which is found with
“where java”.
if %ERRORLEVEL% GEQ 1 goto noJava
for /f %%i in ('where java') do set RUN_JAVA=%%i
I can see two glitches:
- “where” is scanning first the default directory and then all directories from
PATH. If several java versions exist along the path the variable RUN_JAVA will
be overwritten and the last found directory will be used when the script
continues. The result may be a surprise but I guess that we must tolerate it
and perhaps mention the behaviour in RUNNING.txt.
- More severe problem is that script does not find jre if the only installed
version is 32-bit jre on 64-bit Windows. Script tries to find java from the
path which includes \windows\system32, but for some reason this directory is
somehow virtual and different when command shell is launched in 64-bit mode or
in 32-bit mode. For finding 32-bit java the command shell must be launched
through SysWOW64 system.
Here is a modified :trySystemJava that tries first to find installed 64-bit
java and if it fails, and computer is a 64-bit one it restarts the script in
32-bit mode with SysWOW64 and tries to find installed 32-bit java.
:trySystemJava
for /f %%i in ('where java') do set RUN_JAVA=%%i
rem --- we might be on amd64 having only x86 jre installed ---
if "%RUN_JAVA%"=="" if DEFINED ProgramFiles(x86) if NOT
"%PROCESSOR_ARCHITECTURE%"=="x86" (
rem --- restart the batch in x86 mode---
echo Warning: No java interpreter found in path.
echo Retry using Wow64 filesystem [32bit environment] redirection.
%SystemRoot%\SysWOW64\cmd.exe /c %0 %*
exit /b %ERRORLEVEL%
)
if "RUN_JAVA%"=="" goto noJava
goto checkGeoServerHome
I am not sure if error handling is still good after my edits.
-Jukka-
Andrea Aime wrote:
Hi Jukka,
I've hacked my enviroment so that at least JAVA_HOME is not set, removed
GeoServer, removed GEOSERVER_DATA_DIR, and tried at least to have
the startup.bat work.
Since I believe antiviruses/antispam will stop a mail containing a batch file,
I've pasted the result of my changes here:
http://justpaste.it/gn2z
Jukka, do you have time to have a look/try it out?
Anyone else has time to review it?
Cheers
Andrea
--
==
GeoServer Professional Services from the experts! Visit
http://goo.gl/NWWaa2 for more information.
==
Ing. Andrea Aime
@geowolf
Technical Lead
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
-------------------------------------------------------
------------------------------------------------------------------------------
_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel