Steps to Compile and Run a Java Program Sample Java Application

By | December 7, 2010
This tutorial you will learn about how to Compile and Run a Java Program Sample Java Application.What is Java Compiler.Step by step development of java application.In this tutorial you will learn about how to develop java program and Steps to Compile and Run a Java Program Sample Java Application. A Sample Java Application.
Step by step development of java application.In this tutorial you will learn about how to develop java program and Steps to Compile and Run a Java Program Sample Java Application.
A Sample Java Application
The following program can be created using any text editor
public class HelloWorld{
public static void main(String [] args){
System.out.println(“Hello World!”);
}
}
Save the file as HelloWorld.java
Take care; case of file name matters.
Open a command prompt.
Go to the directory in which the source file is saved.
Type the following command > javac HelloWorld.java
The Java compiler will convert the source code into the byte code HelloWorld.class
Use the following command to execute the bytecode > java HelloWorld.
Java Compiler
The source code of Java will be stored in a text file with extension .java . The Java compiler compiles a .java file into byte code. Byte code will be in a file with extension .class . Languages like C compiles the program into the machine language format of the hardware platform on which it is running. Byte Code is NOT in the machine language format of the hardware platform on which the code is compiled. The hardware processor cannot understand the byte code.

Leave a Reply

Your email address will not be published. Required fields are marked *