Thursday 21 August 2014

Back to Java classes , J2SE development , Environment setup with first HelloWorld example

Hi friends, today I am going to setup J2SE environment for java development to revise what I learned back from my BS degree.

  • To start first we need to install jdk to our system, download latest jdk from : http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html, I just downloaded windows x64 ( for windows 8 ).
  • After installation, need to add jdk's bin location to path Environment veritable. To do that right click "My Computer", then go to "Advance System Settings", click "Environment Variables", under System Variables grid, double click path record, as shown in figure :


and append the full path to the bin folder in jdk after installation at the end of path value separated by semi-colon and click OK.
  • To check everything working fine, just open command prompt and type and enter "javac", if you find screen as shown below, then everything working properly : 


  • Now to compile and run your first java program, open note pad, copy-paste following lines in it and save it as HelloWorld.java to some location in the drive.


public class HelloWorld {

    public static void main(String[] args) {
        System.out.println("Hello, World");
    }

}

  • Then go to location where you save above file in command prompt and then run following two commands one by one :
  1. javac HelloWorld.java
  2. java HelloWorld

  • After second command, you will see output like "Hello, World".
That't it, you are already a java developer now and have written and executed your first java program successfully.

Whats Next :

Will going to present different tutorials and links on J2SE developement soon, so stay tuned, keep codding and enjoy :)

No comments:

Post a Comment