Step 1 : Checking Directory Structure
- After installing JDK , Restart system.
- Open My Computer and Check Java Installation Directory.
- These two folders gets created inside “My Computer => C Drive => Program File => Java“.
- Check Inside JDK folder and look for “java” , “javac” application files.
- If these files are present then 75% we are on right track. Now Let’s Check whether “javac” is working properly or not.
- Type command in cmd java -version
Step 2 : Writing Sample Hello.java Program
- Create “code” folder inside C Drive. (call it as – hello.java)
- 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");
}
}
- Note : Select File Type as All files.
- Now open Command Prompt.
- 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