Java, Frameworks, Databases, Technology, Development, Build/Test Tools, OS, Servers, Books, More and What's News
Search This Blog
Saturday, October 31, 2009
Java Compiler
To commence with Java programming, we must know the significance of Java Compiler. When we write any program in a text editor like Notepad, we use Java compiler to compile it. A Java Compiler javac is a computer program or set of programs which translates java source code into java byte code. The output from a Java compiler comes in the form of Java class files (with .class extension). The java source code contained in files end with the .java extension. The file name must be the same as the class name, as classname.java. When the javac compiles the source file defined in a .java files, it generates bytecode for the java source file and saves in a class file with a .class extension. The most commonly used Java compiler is javac, included in JDK from Sun Microsystems. Following figure shows the working of the Java compiler: Once the byte code is generated it can be run on any platform using Java Interpreter (JVM). It interprets byte code (.class file) and converts into machine specific binary code. Then JVM runs the binary code on the host machine. How to use Java Compiler When you run javac command on the command prompt, it shows the following output. C:\>javac Usage: javac
No comments:
Post a Comment