Tuesday, March 5, 2013

how to compile java file without javac command?


how to compile java file without javac command?

JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
int result = compiler.run(null, null, null, "yourClass.java");

The compiler is a command line tool but can also be invoked using the Java Compiler API.
The compiler accepts source code defined by the Java Language Specification (JLS) and produces class files defined by the Java Virtual Machine Specification (JVMS)
http://docs.oracle.com/javase/7/docs/technotes/guides/javac/index.html


  • ECJ - Eclipse Compiler for Java

Eclipse provides and uses its own compiler that is not javac

    The Eclipse compiler is used inside the IDE (Eclipse)
    The Eclipse compiler can also be used as a pure batch compiler outside of Eclipse


  • OpenJDK is the only open-source Java SE implementation

http://openjdk.java.net



  • The GNU Compiler for the JavaTM Programming Language

GCJ is a portable, optimizing, ahead-of-time compiler for the Java Programming Languag
http://gcc.gnu.org/java/

No comments:

Post a Comment