How To Run Your First Java Program.
Step 1: Download and install the JDK(Java Devlopment Kit) from the below link.
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Step 2: Usally it is installed in "C" Folder
C:\Program Files (x86)\Java\jdk1.7.0_55\bin
Step 3:
Now open the Notepad and copy the below program in it and name it as "HelloWorld.java" (which is the class name ).
public class HelloWorld { public static void main(String[] args) { // Prints "Hello, World" in the terminal window. System.out.println("Hello, World"); } }
Step 4:
Now open a command prompt and follow the below steps.
1- Navigate to Folder where you have saved your program.(using cd command )
2 - Now you have to set path using the command shown below.
set path:C:\Program Files (x86)\Java\jdk1.7.0_55\bin;
3 - Now to check whether the path is set correctly or not you can
type java in the command prompt you should see something like below.
4 - Now for Compilation: javac HelloWorld.java ( - This Generates a .class file ).
5 - For Running the program : java HelloWorld
Comments
Post a Comment