Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(bundle): build path to java binary with JAVA_HOME if set #438

Merged
merged 3 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion bundle/src/assembly/resources/bin/mosaic.bat
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ set javaMemorySizeXmx=2G
REM uncomment to activate remote debugging
REM set javaRemoteDebugging=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=10000

REM check if JAVA_HOME is set and define path to java binary accordingly (variable: java_bin)
if "%JAVA_HOME%"=="" (
set java_bin=java
) else (
set java_bin=%JAVA_HOME%\bin\java
)

set libs=

rem core components
Expand All @@ -25,7 +32,7 @@ if not "!libs!" == "" set libs=!libs!;

set libs=!libs!;

java -Xmx%javaMemorySizeXmx% %javaRemoteDebugging% -cp !libs! org.eclipse.mosaic.starter.MosaicStarter %*
%java_bin% -Xmx%javaMemorySizeXmx% %javaRemoteDebugging% -cp !libs! org.eclipse.mosaic.starter.MosaicStarter %*

EndLocal

Expand Down
9 changes: 8 additions & 1 deletion bundle/src/assembly/resources/bin/mosaic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ javaMemorySizeXmx="2g"
# uncomment to activate remote debugging
# javaRemoteDebugging="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=10000"

# check if JAVA_HOME is set and define path to java binary accordingly (variable: java_bin)
if [ -z "${JAVA_HOME}" ]; then
java_bin=java
else
java_bin=${JAVA_HOME}/bin/java
kschrab marked this conversation as resolved.
Show resolved Hide resolved
fi

# mosaic
dir_mosaic=./lib/mosaic
tmp=`ls ${dir_mosaic} | grep jar`
Expand All @@ -18,5 +25,5 @@ tmp=`ls ${dir_libs} | grep jar`
libs=${dir_libs}/${tmp//[^A-Za-z0-9\-\.]/:${dir_libs}/}

# create and run command
cmd="java -Xmx${javaMemorySizeXmx} ${javaRemoteDebugging} -cp .:${mosaic}:${libs} org.eclipse.mosaic.starter.MosaicStarter $*"
cmd="${java_bin} -Xmx${javaMemorySizeXmx} ${javaRemoteDebugging} -cp .:${mosaic}:${libs} org.eclipse.mosaic.starter.MosaicStarter $*"
$cmd