Hi,

I was looking at the genius OJ start script and thinking about if the result of 
the detection of native library path is useful or not. Now the native library 
is set on Windows according to processor architecture and OS version strings. 
The resolution is better than anywhere else I have seen. Usually there are 
Windows downloads only for x86 and amd64 but OJ can resolve not only processor 
architecture but also if OS is XP, Vista, Win 7, Win 8, or Win 8.1.

For GDAL binaries there is an override that detects the jre version first and 
uses only two alternatives for native library locations:
if DEFINED JAVA_X64 (
set "GDAL_FOLDER=gdal-win-x64"
) else (
 set "GDAL_FOLDER=gdal-win-x86"

Spatialite binaries which I have been playing with are built in a similar way 
than GDAL binaries. If 32 bit jre requires 32 bit versions from the binaries 
and 64 bit jre requires 64 bit binaries.

The problem is that if I run 32-bit jre on 64 bit Win 7 then OpenJUMP is 
searching native binaries from directory \lib\native\seven64\. As a workaround 
I can place the 32 bit binaries there or into \lib\native\ which is also on the 
search path. But if I plan to plan to run sometimes OJ with 32 bit jre and 
sometimes with 64 bit jre both these options are poor and I must move some dll 
files before starting OJ with another jre.

BTW. I have experienced the dll hell: Native GDAL and Spatialite binaries can't 
be used simply together with OpenJUMP because Spatialite depends on GDAL and 
versions do not match.

How about making the search path as follows:
1:  jre specific general dll path, either win-x86 or win-amd64
2: special folder for GDAL binaries, search from gdal-win-86 or gdal-win-x64 
(Ede has used names x86 and x64; should be decided which names to use and unify 
the batch file)
3: Operating system + processor architecture based fine grained native folders

An untested modification to oj_windows.bat starting from row 142:

rem -- set general win32 / win64 vars --
rem -- set GDAL vars --
if DEFINED JAVA_X64 (
  set "WIN_DLL_FOLDER=win-amd64"
  set "GDAL_FOLDER=gdal-win-x64"
) else (
  set "WIN_DLL_FOLDER=win-x86"
 set "GDAL_FOLDER=gdal-win-86"
)
set "GDAL_FOLDER=lib\native\%GDAL_FOLDER%"
set "WIN_DLL_FOLDER=lib\native\%WIN_DLL_FOLDER%"
if EXIST "%GDAL_FOLDER%" (
  set "GDAL_DATA=%GDAL_FOLDER%\bin\gdal-data"
  set "GDAL_DRIVER_PATH=%GDAL_FOLDER%\bin\gdal\plugins"
  rem --- prioritize jre version specific binaries in the path ---
  set "PATH=% WIN_DLL_PATH 
%;%GDAL_FOLDER%\bin;%GDAL_FOLDER%\bin\gdal\java;%PATH%"
  rem --- gdal binding is version specific, prioritize the one delivered with 
native libs ---
  set "CLASSPATH=%GDAL_FOLDER%\bin\gdal\java\gdal.jar;%CLASSPATH%"
)

-Jukka-

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to