Skip to content

Instantly share code, notes, and snippets.

@kevinlynx
Last active December 23, 2015 19:39
Show Gist options
  • Save kevinlynx/6684513 to your computer and use it in GitHub Desktop.
Save kevinlynx/6684513 to your computer and use it in GitHub Desktop.
create a shell script to run jar specified some jars as class path
echo off
REM
REM Usage: put jars into lib/ext directory, put config file in ext directory
REM gen_runjar.bat
REM Kevin Lynx 09/24/2013
REM
if "%1"=="" goto usage
if not "%1"=="clear" goto dist
del /Q ext\*.*
rmdir ext
goto end
:dist
setlocal enabledelayedexpansion
set DIST=dist
mkdir %DIST%
mkdir %DIST%\jars
copy lib\*.jar %DIST%\jars\
copy ext\*.jar %DIST%\jars\
copy ext\*.cfg %DIST%\
copy ext\*.xml %DIST%\
cd %DIST%
set CP=.\
for %%i in (jars\*.jar) do (
set CP=!CP!;%%i
)
set RUN=run.bat
echo echo off > %RUN%
echo java -cp %CP% %1 >> %RUN%
goto end
:usage
echo Usage: gen_runjar.bat mainClass
:end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment