Dynamic Classpath for Batch File

From Hapi, a great way to set the classpath for a batch file:

@echo off

for %%I IN (..\lib\*.jar) DO SET CP=!CP!;%%I

java -cp %CP% com.example.Launcher

And also for shell scripts:

#! /bin/bash

CP="."
for i in ../lib/*.jar;
do
		  CP=$i:$CP;
done

java -cp $CP com.example.Launcher
Published
Categorized as Uncategorized Tagged