Skip to content

Commit

Permalink
#1137 Added embedded JRE for Win and Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
fernandinand committed Feb 3, 2017
1 parent b59d422 commit 18b8d98
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 45 deletions.
8 changes: 8 additions & 0 deletions release/bin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@
<include>mapstore.war</include>
</includes>
</fileSet>
<fileSet>
<!-- JRE's -->
<directory>target/jre</directory>
<outputDirectory>mapstore2/jre</outputDirectory>
<includes>
<include>**/*</include>
</includes>
</fileSet>
<fileSet>
<!-- the libs needed to run tomcat -->
<directory>target/dependency</directory>
Expand Down
45 changes: 13 additions & 32 deletions release/bin/mapstore2-shutdown.bat
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,20 @@ set CMD_LINE_ARGS=
set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1

rem JAVA_HOME not defined
if "%JAVA_HOME%" == "" goto noJava
if "%JAVA_HOME%" == "" goto nativeJava

rem JAVA_HOME defined incorrectly
if not exist "%JAVA_HOME%\bin\java.exe" goto badJava
echo JAVA_HOME: %JAVA_HOME%
echo.

rem No errors
goto shutdown

:noJava
echo The JAVA_HOME environment variable is not defined.
goto JavaFail
:nativeJava
set "JAVA_HOME=%CURRENT_DIR%\jre\win"

rem JAVA_HOME defined incorrectly
:checkJava
if not exist "%JAVA_HOME%\bin\java.exe" goto badJava

:badJava
echo The JAVA_HOME environment variable is not defined correctly.
Expand All @@ -44,35 +47,13 @@ goto end

:shutdown
echo Shutting down MapStore2...
echo.
call "%EXECUTABLE%" stop %CMD_LINE_ARGS%
echo.
echo Thank you for using MapStore2!
goto end

:end
if %error% == 1 echo Shutting down MapStore2 was unsuccessful.
if %error% == 1 echo Shutting down MapStore2 was unsuccessful.
echo.
pause
























pause
22 changes: 12 additions & 10 deletions release/bin/mapstore2-startup.bat
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,20 @@ set CMD_LINE_ARGS=
set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1

rem JAVA_HOME not defined
if "%JAVA_HOME%" == "" goto noJava

rem JAVA_HOME defined incorrectly
if not exist "%JAVA_HOME%\bin\java.exe" goto badJava
if "%JAVA_HOME%" == "" goto nativeJava

echo JAVA_HOME: %JAVA_HOME%
echo.

rem No errors
goto run

:noJava
echo The JAVA_HOME environment variable is not defined.
goto JavaFail
:nativeJava
set "JAVA_HOME=%CURRENT_DIR%\jre\win"

rem JAVA_HOME defined incorrectly
:checkJava
if not exist "%JAVA_HOME%\bin\java.exe" goto badJava

:badJava
echo The JAVA_HOME environment variable is not defined correctly.
Expand All @@ -45,15 +46,16 @@ goto end


:run
if "%JAVA_OPTS%" == "" (set JAVA_OPTS="-XX:MaxPermSize=128m")
echo Please wait while loading MapStore2...
echo.
call "%EXECUTABLE%" start %CMD_LINE_ARGS%
echo Point you browser to: http://localhost:8800/mapstore
echo.
echo Enjoy MapStore2!
goto end


:end
if %error% == 1 echo Startup of MapStore2 was unsuccessful.
if %error% == 1 echo Startup of MapStore2 was unsuccessful.
echo.
pause
pause
11 changes: 9 additions & 2 deletions release/bin/mapstore2-startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,21 @@
# Make sure catalina scripts are executable
chmod +x bin/*.sh

echo "Welcome to MapStore2 demo package!"
# Set local JAVA_HOME
PRGDIR=`pwd`
if [ -z "$JAVA_HOME" ]; then
export JAVA_HOME="$PRGDIR/jre/linux"
export JRE_HOME="$PRGDIR/jre/linux"
chmod +x jre/linux/bin/*
fi

echo "Welcome to MapStore2!"

# if not told otherwise pump up the permgen
if [ -z "$JAVA_OPTS" ]; then
export JAVA_OPTS="-XX:MaxPermSize=128m"
fi

PRGDIR=`pwd`
EXECUTABLE=startup.sh
CATALINA_HOME="$PRGDIR"

Expand Down
Binary file added release/jre/jre.tar.gz
Binary file not shown.
14 changes: 14 additions & 0 deletions release/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,20 @@
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>untar-jre</id>
<phase>package</phase>
<configuration>
<tasks>
<echo message="Untar JRE" />
<gunzip src="jre/jre.tar.gz" dest="${project.build.directory}/jre.tar" />
<untar src="${project.build.directory}/jre.tar" dest="${project.build.directory}/jre" />
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
<execution>
<phase>package</phase>
<configuration>
Expand Down
1 change: 0 additions & 1 deletion release/tomcat/bin/setclasspath.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
# -----------------------------------------------------------------------------

# Make sure prerequisite environment variables are set
JAVA_HOME="/opt/Softw/JAVA/jdk1.8.0_102"

if [ -z "$JAVA_HOME" -a -z "$JRE_HOME" ]; then
if $darwin; then
Expand Down

0 comments on commit 18b8d98

Please sign in to comment.