#!/bin/bash
# 
#         Configuration File
#

echo "Hello $LOGNAME 
Let us move ahead with installation process.
First your path must contain java, appletviewer,javac/jikes etc."
echo "Enter the name of your favourite java compiler.(default javac) "
read compiler
if [ "$compiler" = "" ] ; then
	compiler=javac
fi
echo "Testing whether $compiler is in your path....."

echo "
public class _Test{
	public static void main(String args[]){
	}
}"  > _Test.java

$($compiler  _Test.java) > /dev/null 2> /dev/null

if [ -f _Test.class ]; then
	echo "You have$compiler in path"
	else
	echo "Please set your path properly ($compiler not in path)
		Configure aborted"
	rm -f _Test.*
	exit
fi
echo "Testing for proper classpath(java classes and swing)... "
rm -f _Test.*;
echo "
import java.awt.*;
import javax.servlet.*;

public class _Test{
	public static void main(String args[]){
	}
}" > _Test.java

$($compiler  _Test.java) 2> /dev/null > /dev/null
if [ -f _Test.class ]; then
	echo "You have proper class path"
	else
	echo "Set your classpath properly and include servlet also
		Configure aborted"
	rm -f _Test.*
	exit
fi
rm -f _Test.*
echo "Configuration Done :)"
echo "Generating runservlet..."
echo "
# This file runs the servlets!
servletrunner -d $PWD/DBIS/bin/Servlets  -p 5003 & 
" > runservlet

echo " Now use the following command to start the servlets :: runservlet " 

