#!/usr/bin/env bash
#################################################
#					author:lzh					#
#	usage:used for compile single java file		#
#################################################

if test -z $1;then
	read -p "Please input your java file name:" file
else
	file=$1
fi
while test -z ${file}
do
	echo -e "\033[31mYou input nothing!!!!!!\033[037m"
	read -p "Please input your java file name:" file
done
files=`find -name "${file}.java"`
echo ${files}
if test -z ${files};then
	echo -e "\033[31mDo not find java file\033[37m"
	exit 1
fi
javac -g -source 1.8 -target 1.8 -d ./out/ ${files} -encoding UTF-8 &&
echo -e "\033[32mCompile finish *_*\033[0m \033[37m" ||
echo -e "\033[31mCompile error \033[0m \033[37m"
