Home Java Training Compiling and Interpreting Applications in Java

Related Tutorials


 
 

Share on Google+Share on Google+

Compiling and Interpreting Applications in Java

Advertisement
Compiling and Interpreting Applications in Java. Learn How to compile and interpret your Java application.

Welcome to Java tutorial series. In this lesson, you will learn about following topics:

Compiling Java Program

For compiling Java program, first your code must write the code using text editor and save with .java extension. The file name must be the same as the class name.

After this you can compile your program using javac compiler, which translate java source code into java byte code. The output from a Java compiler comes in the form of Java class files with .class extension.

Pursue the following steps to convert a Java source program into an object program:

  • First create the source code with text editor like notepad, jEdit, TextPad etc. Save it as .java file having same name as the class name.
  • Open a command prompt and change to the directory containing the source file.
  • Now we compile the created code, which is Greeting.java in this example. Type command javac Greeting.java on command prompt and hit Enter to compile your code.

This will produce one or more .class files, which are Java byte code.

Interpreting and running Java Program

Interpreting and running a Java program is process of executing the Java Program. In this process the Java VM is invoked and it takes the byte code and interprets it. In this process the byte code is converted to platform-dependent machine codes so that your computer can understand and run the program.

Once your program successfully compiles into Java bytecodes, you can interpret and run your applications on any Java VM or JVM enabled web browser as applet.

For running java code at the command line on Unix and DOS shell operating systems, you need to issue: java Greeting.

This command will interprets byte code hold by .class file and converts into machine specific binary code. Then JVM runs the binary code on the host machine.

Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: June 11, 2013

Related Tutorials

Discuss: Compiling and Interpreting Applications  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0
DMCA.com