@echo off :: :: Opens modeling tool bin folder :: cd ..\..\bin\ :: :: Sets PROPERTIES_FILE property by modeling tool :: if exist magicdraw.properties ( set PROPERTIES_FILE=magicdraw.properties ) if exist cameoea.properties ( set PROPERTIES_FILE=cameoea.properties ) if exist cbm.properties ( set PROPERTIES_FILE=cbm.properties ) if exist csm.properties ( set PROPERTIES_FILE=csm.properties ) if exist msa.properties ( set PROPERTIES_FILE=msa.properties ) if exist mcse.properties ( set PROPERTIES_FILE=mcse.properties ) if exist msosa.properties ( set PROPERTIES_FILE=msosa.properties ) :: :: Opens modeling tool lib folder :: cd ..\lib\ :: :: Resolves launcher jar full file names by part of the name. :: for /F %%a in ('dir /b com.nomagic.osgi.launcher-*.jar') do set OSGI_LAUNCHER=%%~na.jar for /F %%a in ('dir /b bundles\org.eclipse.osgi_*.jar') do set ECLIPSE_OSGI=%%~na.jar for /F %%a in ('dir /b bundles\com.nomagic.magicdraw.osgi.fragment_*.jar') do set MD_OSGI=%%~na.jar ::echo Launcher file names: ::echo %OSGI_LAUNCHER% ::echo %ECLIPSE_OSGI% ::echo %MD_OSGI% :: :: Returns to updater directory for further execution :: cd ..\plugins\com.nomagic.magicdraw.twcusageupdater\ :: :: Creates class path for launching modeling tool. :: set CLASS_PATH=..\..\lib\%OSGI_LAUNCHER%;^ ..\..\lib\bundles\%ECLIPSE_OSGI%;^ ..\..\lib\bundles\%MD_OSGI%;^ ..\..\lib\md_api.jar;..\..\lib\md_common_api.jar;..\..\lib\md.jar;..\..\lib\md_common.jar;..\..\lib\jna.jar ^ -Dmd.class.path=file:../../bin/%PROPERTIES_FILE%?base=../..#CLASSPATH ^ -Dcom.nomagic.osgi.config.dir=..\..\configuration ^ -Desi.system.config=..\..\data\application.conf ^ -Dlogback.configurationFile=..\..\data\logback.xml ^ -Dcom.nomagic.magicdraw.launcher=com.nomagic.magicdraw.commandline.CommandLineActionLauncher ^ -Dcom.nomagic.magicdraw.commandline.action=com.nomagic.magicdraw.twcusageupdater.UpdateProjectUsageCommandLineAction ^ com.nomagic.osgi.launcher.ProductionFrameworkLauncher :: :: Reads JAVA_HOME path from properties file and creates full path to java executable. :: @echo off For /F "tokens=1* delims==" %%A IN (../../bin/%PROPERTIES_FILE%) DO ( IF "%%A"=="JAVA_HOME" set fullPath=%%B ) :: If fullPath does not contain : it means it is a relative path, not a full path. Append it to installation directory. if "%fullPath::=%" == "%fullPath%" ( set fullPath=../../%fullPath% ) set fullPath=%fullPath:\:=:% set fullPath=%fullPath:\\=/% echo Java path is %fullPath% :: :: Launches modeling tool and executes command line action. :: "%fullPath%/bin/java" -Xmx4000M -Xss1024K -cp %CLASS_PATH% %*