private void initJavaCompiler ( ) throws JasperException { boolean disablejsr199 = Boolean . TRUE . toString ( ) . equals ( System . getProperty ( "org.apache.jasper.compiler.disablejsr199" ) ) ; Double version = Double . valueOf ( System . getProperty ( "java.specification.version" ) ) ; if ( ! disablejsr199 && ( version >= 1.6 || getClassFor ( "javax.tools.Tool" ) != null ) ) { // JDK 6 or bundled with jsr199 compiler javaCompiler = new Jsr199JavaCompiler ( ) ; } else { Class c = getClassFor ( "org.eclipse.jdt.internal.compiler.Compiler" ) ; if ( c != null ) { c = getClassFor ( "org.apache.jasper.compiler.JDTJavaCompiler" ) ; if ( c != null ) { try { javaCompiler = ( JavaCompiler ) c . newInstance ( ) ; } catch ( Exception ex ) { } } } } if ( javaCompiler == null ) { Class c = getClassFor ( "org.apache.tools.ant.taskdefs.Javac" ) ; if ( c != null ) { c = getClassFor ( "org.apache.jasper.compiler.AntJavaCompiler" ) ; if ( c != null ) { try { javaCompiler = ( JavaCompiler ) c . newInstance ( ) ; } catch ( Exception ex ) { } } } } if ( javaCompiler == null ) { errDispatcher . jspError ( "jsp.error.nojavac" ) ; } javaCompiler . init ( ctxt , errDispatcher , jspcMode ) ; }
Get an instance of JavaCompiler . If Running with JDK 6 use a Jsr199JavaCompiler that supports JSR199 else if eclipse s JDT compiler is available use that . The default is to use javac from ant .