Package javax.tools

Examples of javax.tools.JavaCompiler.run()


    source.println("package " + packageName + ";");
    source.println("public class " + classNamePrefix
        + " { public static void main(String[] args) { } };");
    source.close();
    JavaCompiler jc = ToolProvider.getSystemJavaCompiler();
    int result = jc.run(null, null, null, javaPath);
    assertEquals(0, result);
    File classFile = new File(classPath);
    assertTrue(classFile.exists());
    return new FileAndPath(packageName.replace('.', '/') + '/', classFile);
  }
View Full Code Here


                pw.close();
            }
        }
        JavaCompiler javac = ToolProvider.getSystemJavaCompiler();
        final String javacCmds[] = {UNPACK_FN + ".java"};
        javac.run(null, null, null, javacCmds);
    }
   
    static TestResult runUnpack200(File packFile) throws Exception {
        if (!packFile.exists()) {
            throw new Exception("please check" + packFile + " exists");
View Full Code Here

      ByteArrayOutputStream errorOutputStream = new ByteArrayOutputStream();

      JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();

      compiler.run(null, null, errorOutputStream, sourceFile.getAbsolutePath());

      for (byte b : errorOutputStream.toByteArray()) {
        System.out.print((char) b);
      }
View Full Code Here

      ByteArrayOutputStream errorOutputStream = new ByteArrayOutputStream();

      JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();

      compiler.run(null, null, errorOutputStream, sourceFile.getAbsolutePath());

      for (byte b : errorOutputStream.toByteArray()) {
        System.out.print((char) b);
      }
View Full Code Here

    }

    private void compile(MetaDataExporter exporter) {
        JavaCompiler compiler = new SimpleCompiler();
        Set<String> classes = exporter.getClasses();
        int compilationResult = compiler.run(null, null, null, classes.toArray(new String[classes.size()]));
        if(compilationResult == 0) {
            System.out.println("Compilation is successful");
        } else {
            Assert.fail("Compilation Failed");
        }
View Full Code Here

        options.add("-source");
        options.add("1.6");
        options.add("-verbose");
        options.addAll(classes);

        int compilationResult = compiler.run(null, System.out, System.err, options.toArray(new String[options.size()]));
        if (compilationResult == 0) {
            System.out.println("Compilation is successful");
        } else {
            Assert.fail("Compilation Failed");
        }
View Full Code Here

      ByteArrayOutputStream errorOutputStream = new ByteArrayOutputStream();

      JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();

      compiler.run(null, null, errorOutputStream, sourceFile.getAbsolutePath());

      for (byte b : errorOutputStream.toByteArray()) {
        System.out.print((char) b);
      }
View Full Code Here

    compilerArgs.add(generatedClassFolder.getPath());
    compilerArgs.add("-Xlint");
    compilerArgs.add("-g");
    compilerArgs.addAll(javaPaths);

    int returnCode = javaCompiler.run(null, null, null, compilerArgs.toArray(new String[0]));
    if (returnCode != 0) throw new IOException("compilation failed: " + javaPaths);
  }

  private static Model getModel() throws MolgenisModelException, DatabaseException
  {
View Full Code Here

    if(classPath != null) {
      params.add("-classpath");
      params.add(classPath);
    }
    params.addAll(files);
    return compiler.run(null, null, null, params.toArray(new String[0]));
  }
}
View Full Code Here

        + ".class");
    classFile.delete();

    // compile java file to class file
    final JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
    compiler.run(System.in, System.out, System.err, optionsAndSources);

    // delete java file
    javaFile.delete();
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.