@echo off
setlocal enableextensions

@REM relative path to library directory holding JAR files
set LIB_DIR=lib

@REM set non-optional system properties here
set SAMPLE_PROPERTIES= -Dhttps.protocols=TLSv1.1,TLSv1.2 -Dsample.properties.files=connection.properties  -Djava.util.logging.config.file=logging.properties

:CALCJAVAHOME
@REM calculate the JAVA_HOME
if NOT DEFINED JAVA_HOME (
   if NOT DEFINED JAVAHOME (
       @echo JAVA_HOME not defined. Must be defined to run java apps.
       goto END
   )
   else (
       set JAVA_HOME=%JAVAHOME%
   )
)
:SETENV
set PATH=%JAVA_HOME%\bin;%PATH%

:CALCLOCALCLASSPATH
set LOCALCLASSPATH=
for %%i in ("%LIB_DIR%\*.jar") do  call lcp.bat %CD%\%%i
set LOCALCLASSPATH=%LOCALCLASSPATH%;%CLASSPATH%

setlocal
:next
if [%1]==[] goto argend
   set ARG=%ARG% %1
   shift
   goto next
:argend

:DORUN

"%JAVA_HOME%"\bin\java %SAMPLE_PROPERTIES% -cp "%LOCALCLASSPATH%" -Xmx1024M com.vmware.common.Main %ARG%

endlocal

:END
echo Done.
