@echo off setlocal ENABLEDELAYEDEXPANSION set JAVA_HOME=location_of_your_jvm set PLEX_FUNCTION=package_and_name_of_the_function_to_call set HOME_DIR=%~dp0 set JARS_DIR=.\jars set LOGS_DIR=.\logs pushd %HOME_DIR% if "%JAVA_HOME%"=="" goto error if "%PLEX_FUNCTION%"=="" goto error rem ---------- Setup Classpath (BEGIN) set CLASSPATH= dir /B "%JARS_DIR%\*.jar" >%JARS_DIR%\dir.lst for /F "delims=," %%i IN (%JARS_DIR%\dir.lst) do set CLASSPATH=!CLASSPATH!%JARS_DIR%\%%i; if exist "%JARS_DIR%\dir.lst" del "%JARS_DIR%\dir.lst" rem ---------- Setup Classpath (END) rem ---------- Run Plex java program echo Running Plex Java program - %PLEX_FUNCTION% rem echo Using the classpath - %CLASSPATH% "%JAVA_HOME%\bin\java" -cp "%CLASSPATH%" ObRun.ObPanel.ObLaunch %PLEX_FUNCTION% Path="." Default >>%LOGS_DIR%\stdout.txt 2>>%LOGS_DIR%\stderr.txt goto end :error echo Make sure that you set the JAVA_HOME environment variable echo Make sure that you set the PLEX_FUNCTION to be called pause goto end :end popd endlocal