If you want to make money online : Register now

Validating Installation or Running Hello World in Java

, , No Comments

Step 1 : Checking Directory Structure

  1. After installing JDK , Restart system.
  2. Open My Computer and Check Java Installation Directory.
Checking Java Installation Directory Structure
  1. These two folders gets created inside “My Computer => C Drive => Program File => Java“.
  2. Check Inside JDK folder and look for “java” , “javac” application files.
Java Bin Directory
  1. If these files are present then 75% we are on right track. Now Let’s Check whether “javac” is working properly or not.
  2. Type command in cmd java -version 

Step 2 : Writing Sample Hello.java Program

  1. Create “code” folder inside C Drive. (call it as – hello.java)
  2. Copy paste following code snippet and paste into notepad. (Dont forgot to save File using .java extenstion) .
class hello
{
public static void main(String args[])
{
System.out.println("Welcome to Java");
}
}
  1. Note : Select File Type as All files.
Saving Java file
  1. Now open Command Prompt.
  2. Type following Commands.
C:>java -version //for checking version of java
C:>javac -version //checking compiler version
C:>cd code
C:code>javac hello.java
C:code>java hello
Welcome to Java
C:code>

0 comments:

Post a Comment