Package sun.tools.javac

Examples of sun.tools.javac.Main


    public void setOut(OutputStream out) {
        this.out = out;
    }
   
    public boolean compile(String source) {
        Main compiler = new Main(out, "jsp->javac");

        String[] args = new String[]
        {
            "-encoding", encoding,
            "-classpath", classpath,
            "-d", outdir,
            source
        };

        return compiler.compile(args);
    }
View Full Code Here


                /************************************/
                category.debug("javac " + jFile );
                // Process proc = rt.exec( "javac " + jFile );
                // proc.waitFor();
                FileOutputStream  out      = new FileOutputStream( errFile );
                Main              compiler = new Main( out, "javac" );
                String            outdir   = f1.getParent();
                String[]          args     = null ;

                if (outdir == null) outdir=".";

                args = new String[] { "-d", outdir,
                          "-classpath",
                          getDefaultClasspath(msgContext),
                          jFile };

                boolean           result   = compiler.compile( args );

                /* Delete the temporary *.java file and check return code */
                /**********************************************************/
                (new File(jFile)).delete();

View Full Code Here

    public void setClassDebugInfo(boolean classDebugInfo) {
        this.classDebugInfo = classDebugInfo;
    }

    public boolean compile(String source) {
        Main compiler = new Main(out, "jsp->javac");
        String[] args;

        if (classDebugInfo) {
            args = new String[]
            {
                "-g",
                "-encoding", encoding,
                "-classpath", classpath,
                "-d", outdir,
                source
            };
  } else {
            args = new String[]
            {
                "-encoding", encoding,
                "-classpath", classpath,
                "-d", outdir,
                source
            };
        }

        return compiler.compile(args);
    }
View Full Code Here

   
    // FIXME: we should make this reflection based and also allow other
    // compilers to be plugged in. Maybe we can steal... ehmmm, borrow.. some
    // Tomcat code for this :) (SM)
   
    Main compiler = new Main(err, "javac");

    boolean compilationResult = compiler.compile(compilerArgs);

    if (!compilationResult) {
      // Massage message
      int pos = fullFilename.length() + 1;
      StringBuffer buffer = new StringBuffer();
View Full Code Here

  int len = args.length;
  String newargs[] = new String[len+2];
  System.arraycopy(args, 0, newargs, 0, len);
  newargs[len] = "-classpath";
  newargs[len+1] = System.getProperty("java.class.path");
  return (new Main(out, "compiler")).compile(newargs);
    }
View Full Code Here

    public void setOut(OutputStream out) {
        this.out = out;
    }
   
    public boolean compile(String[] args) {
        Main compiler = new Main(out, "jsp->javac");
        return compiler.compile(args);
    }
View Full Code Here

   
    // FIXME: we should make this reflection based and also allow other
    // compilers to be plugged in. Maybe we can steal... ehmmm, borrow.. some
    // Tomcat code for this :) (SM)
   
    Main compiler = new Main(err, "javac");

    if (!compiler.compile(compilerArgs)) {
      // Massage message
      int pos = fullFilename.length() + 1;
      StringBuffer buffer = new StringBuffer();
      String[] errorLines = XSPUtil.split(err.toString(), "\r\n");
      for (int i = 0; i < errorLines.length; i++) {
View Full Code Here

                /************************************/
                Debug.Print(2, "javac " + jFile );
                // Process proc = rt.exec( "javac " + jFile );
                // proc.waitFor();
                FileOutputStream  out      = new FileOutputStream( errFile );
                Main              compiler = new Main( out, "javac" );
                String            outdir   = f1.getParent();
                String[]          args     = null ;
               
                if (outdir == null) outdir=".";

                args = new String[] { "-d", outdir,
                          "-classpath",
                          System.getProperty("java.class.path" ),
                          jFile };
                boolean           result   = compiler.compile( args );

                /* Delete the temporary *.java file and check the return code */
                /**************************************************************/
                (new File(jFile)).delete();

View Full Code Here

    String compilerPath;
    String outdir;
    OutputStream out;

    public boolean compile(String source) {
        Main compiler = new Main(out, "javac");
        String args[];
        if (this.encoding == null) {
            args = new String[] {
                "-classpath", classpath,
                "-d", outdir,
                "-O",
                source
            };
        } else {
            args = new String[] {
                "-encoding", encoding,
                "-classpath", classpath,
                "-d", outdir,
                "-O",
                source
            };
        }
        return compiler.compile(args);
    }
View Full Code Here

    public void setClassDebugInfo(boolean classDebugInfo) {
        this.classDebugInfo = classDebugInfo;
    }
   
    public boolean compile(String source) {
        Main compiler = new Main(out, "jsp->javac");
        String[] args = null;

        if( outdir != null ) {
            args = new String[]
            {
                "-encoding", encoding,
                "-classpath", classpath,
                "-d", outdir,
                source
            };
        } else {
            args = new String[]
            {
                "-encoding", encoding,
                "-classpath", classpath,
                source      
            };
        }
        if( classDebugInfo ) {
            String[] args2 = new String[args.length + 1];
            args2[0] = "-g";
            System.arraycopy(args,0,args2,1,args.length);
            args=args2;
        }

        return compiler.compile(args);
    }
View Full Code Here

TOP

Related Classes of sun.tools.javac.Main

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.