Friday, September 4, 2015

How to start learning java?

   To start learning java, you need JDK (Java Development Kit) and some text editor like EditPlus or power full IDE like Eclipse

Download the JDK from Oracle site and install it.

Set Environment variable PATH and CLASSPATH

Write a sample java program with the text editor and compile with javac compiler
and run the class with java tool / JVM

MainClass.java :
public class MainClass {
    public static void main(String[] args) {
        System.out.println("Java");
    }
}
>javac MainClass.java
>java MainClass

You may get compile time or runtime error if you not properly set Environment variables


PATH must point to bin directory of JDK like C:\Program Files\Java\jdk1.8.0_45\bin

CLASSPATH must point to lib directory of JDK / JRE like C:\Program Files\Java\jdk1.8.0_45\jre\lib or C:\Program Files\Java\jre1.8.0_51\lib

choose JDK's JRE for better compatibility 

No comments :

Post a Comment