Skip to content

Commit

Permalink
Fixed two issues:
Browse files Browse the repository at this point in the history
- jawi#125: add 'jna.nosys=true' as system property will prevent JNA
  from using any system-installed JNA libraries;
- jawi#140: add more advanced search for Java binaries on Windows
  (should work on Windows8 as well).
  • Loading branch information
Jan Willem Janssen committed Jan 20, 2013
1 parent c844c25 commit ddea7f6
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 12 deletions.
34 changes: 24 additions & 10 deletions ols.distribution/src/main/resources/run.bat
Original file line number Diff line number Diff line change
@@ -1,25 +1,39 @@
@echo off

rem Check whether the "magic" Java binary is available...
java -version > NUL 2> NUL
:findJavaSimple
rem Simple check to see whether the "magic" Java binary is available on our path;
rem based on <http://stackoverflow.com/questions/4681090/how-to-find-where-is-jdk-installed-on-my-windows-machine>
for %i in (java.exe) do set JavaPath=%~$PATH:i
%JavaPath% -version > NUL 2> NUL
if errorlevel 1 goto findJavaAdvanced
goto setup

:findJavaAdvanced
rem See <https://github.com/jawi/ols/issues/140>
for /F "tokens=2*" %%A in ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TypeLib\{5852F5E0-8BF4-11D4-A245-0080C6F74284}\1.0\HELPDIR" /ve') do set JavaPath="%%B\javaw.exe"
%JavaPath% -version > NUL 2> NUL
if errorlevel 1 goto noJVM
goto setup

:noJVM
echo It appears that Java is not installed on this computer. You
echo should download and install the latest JRE.
prompt
exit 1

:setup
rem determine the location this script is run in...
set BASEDIR=%~dp0
rem all paths are used relatively from the base dir...
set PLUGINDIR=%BASEDIR%\plugins
set CLASSPATH=.;%BASEDIR%\bin\*
rem give the client roughly 1gigabyte of memory
set MEMSETTINGS=-Xmx1024m
rem <https://github.com/jawi/ols/issues/125>
set SYSPROPS=-Djna.nosys=true -Dnl.lxtreme.ols.bundle.dir="%PLUGINDIR%" -DPlastic.defaultTheme=SkyBluer

rem For now, use the "console enabled" java for Windows...
java %MEMSETTINGS% -Dnl.lxtreme.ols.bundle.dir="%PLUGINDIR%" -DPlastic.defaultTheme=SkyBluer -cp "%CLASSPATH%" nl.lxtreme.ols.runner.Runner
goto end

:noJVM
echo It appears that Java is not installed on this computer. You
echo should download and install the latest JDK.
prompt
exit 1
java %MEMSETTINGS% %SYSPROPS% -cp "%CLASSPATH%" nl.lxtreme.ols.runner.Runner

:end
exit 0
7 changes: 5 additions & 2 deletions ols.distribution/src/main/resources/run.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

# Check whether the "magic" Java binary is available...
rem Simple check to see whether the "magic" Java binary is available on our path;
java -version 1>/dev/null 2>&1
if [ "$?" -ne "0" ]; then
echo It appears that Java is not installed on this computer. You
Expand All @@ -13,6 +13,9 @@ BASEDIR=$(dirname -- "${0}")
# all paths are used relatively from the base dir...
PLUGINDIR=$BASEDIR/plugins
CLASSPATH=$BASEDIR/bin/*
rem give the client roughly 1gigabyte of memory
MEMSETTINGS=-Xmx1024m
rem <https://github.com/jawi/ols/issues/125>
SYSPROPS=-Djna.nosys=true -Dnl.lxtreme.ols.bundle.dir="$PLUGINDIR" -DPlastic.defaultTheme=SkyBluer

java $MEMSETTINGS -Dnl.lxtreme.ols.bundle.dir="$PLUGINDIR" -DPlastic.defaultTheme=SkyBluer -cp "$CLASSPATH" nl.lxtreme.ols.runner.Runner
java $MEMSETTINGS $SYSPROPS -cp "$CLASSPATH" nl.lxtreme.ols.runner.Runner

0 comments on commit ddea7f6

Please sign in to comment.