Index: CompilerAdapterFactory.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java,v
retrieving revision 1.5
diff -u -r1.5 CompilerAdapterFactory.java
--- CompilerAdapterFactory.java	7 Aug 2001 11:53:43 -0000	1.5
+++ CompilerAdapterFactory.java	27 Mar 2002 06:11:21 -0000
@@ -65,7 +65,7 @@
  */
 public class CompilerAdapterFactory {
 
-    /** This is a singlton -- can't create instances!! */
+    /** This is a singleton -- can't create instances!! */
     private CompilerAdapterFactory() {
     }
 
@@ -94,6 +94,11 @@
      */
     public static CompilerAdapter getCompiler( String compilerType, Task task ) 
         throws BuildException {
+            boolean isClassicCompilerSupported=true;
+             if(Project.getJavaVersion()==Project.JAVA_1_4) {
+                 isClassicCompilerSupported=false;
+             }
+
             /* If I've done things right, this should be the extent of the
              * conditional statements required.
              */
@@ -106,7 +111,14 @@
             if ( compilerType.equalsIgnoreCase("classic") ||
                     compilerType.equalsIgnoreCase("javac1.1") ||
                     compilerType.equalsIgnoreCase("javac1.2")) {
-                return new Javac12();
+                if(isClassicCompilerSupported) {
+                    return new Javac12();
+                }
+                else {
+                    throw new BuildException("This version of java does "
+                                             +"not support the classic compiler");
+                }
+
             }
             if ( compilerType.equalsIgnoreCase("modern") ||
                     compilerType.equalsIgnoreCase("javac1.3") ||
@@ -115,9 +127,16 @@
                 try {
                     Class.forName("com.sun.tools.javac.Main");
                 } catch (ClassNotFoundException cnfe) {
-                    task.log("Modern compiler is not available - using "
-                            + "classic compiler", Project.MSG_WARN);
-                    return new Javac12();
+                    if(isClassicCompilerSupported) {
+                        task.log("Modern compiler not found - looking for "
+                                + "classic compiler", Project.MSG_WARN);
+                        return new Javac12();
+                    }
+                    else {
+                        throw new BuildException("Unable to find a javac compiler; "
+                                                 +"com.sun.tools.javac.Main is not on the classpath.\n"
+                                                 +"Perhaps JAVA_HOME does not point to the JDK");
+                    }
                 }
                 return new Javac13();
             }

