About Me

My photo
Working as Technical Lead in CollabNET software private limited.

Thursday 21 February, 2008

Needed shell script to compile and run java files.

#Let's start building the classpath with existing jars & libs.
THE_CLASSPATH=
for i in `ls *.jar`
do
THE_CLASSPATH=${THE_CLASSPATH}:${i}
done

# Let's compile all the java file.

for i in `find . -name '*.java'`
do
echo "Compiling $i"
javac -cp $THE_CLASSPATH $i
done

# invoke the main function.

java -cp .:$THE_CLASSPATH $CLASSNAME$
unset THE_CLASSPATH

No comments: