Setting Up Java Developer Environment For Beginners

Before you start Java, may have a question “Why should I waste my time learning Java ?” Here’s Why


Java is an Object Oriented programming language.After the C family (C family nothing but C , C++ ,C#,Objective C,many more languages based on “C” but i like that  “C family”) its great to learn for fun. The best thing about Java is its flexibility and safety. Let me explain the flexibility in terms of coding, you can write code and compile on any system and create some binary files. In case of Java the compiled binary file executes on the Java Virtual Machine (JVM) not like ordinary binaries which executes on the system itself. So if there is a JVM present in any system the Java program or application would work on it. It’s like “Compile once and Run everywhere”.

For Your Information (FYI) : GUI of the Android is written in Java, still the core is based on C.


Here you go for Developing and tweaking with Java.

You’ll need three major stuff to jump into the Java,

The first and the most important : BRAIN (I hope you have it)

The Second thing is JavaDevelopingKit : JDK contains ” javac”  the compiler,and JRE as well.

Windows users download and install JavaDevelopmentKit

Linux users can download and install OpenJDK by following commands in the terminal.

For Debian based (i.e. Ubuntu)

sudo apt-get install openjdk-7-jdk

You can replace “7” with other new versions (if available)

For Fedora,Oracle Linux,Red Hat:

su -c “yum install java-1.7.0-openjdk-devel”

Further config is not required for Linux users.It was quite easy huh ?

OSX users don’t need this JDK to install it’s pre-installed.

Third is a Code Editor  :It’s nothing but a text editor like notepad or gedit.If you want that your code it well formatted and good looking try  Notepad++   notepad plus plus  that’s really good

When you have all these things above mentioned wake me up zzzzz………. zzzz…….. zz…… z……………. (LoL)

First try to make a very basic “Hello World” style Program.

Open a text editor and write the code below to test.

class NameOfYourClass {

public static void main(String[] args){

System.out.println(“I’m in Java”);



Save it as  keep in mind class name must match both sides in the text and file’s name.

Now we should compile this code in order to run it. If you have installed JDK on Windows still you have to PATH it so you can write code in CMD (or DOS) that compiles the file.

Let’s PATH the JDK. (Only for Windows users)

Do this after you have read this whole part

Go to Control Panel -> System -> Advanced System Setting -> Environment Variable

Now you can see the PATH option in “System Variable” ,so just add the path of “bin” folder inside the JDK folder.(Don’t change anything else that may cause system failure)

Quite complicated ?

screen shot
Pics worth a thousand words !!!

If you have installed jdk to “C:\Program Files\JDK” then write this “C:\Program Files\JDK\bin\” (without quotes) and don’t forget the “\” at the end.

And yes add a Semicolon (;) to separate paths.

You can path as well by command prompt:

PATH is the environment variable for storing PATH directories on windows as well as Linux. We’ll add path of JDK\bin to it.This is how it goes

Check if there is a semicolon present at the last. The command “echo %PATH%” will write down what is present in the PATH variable if there is not a “;” symbol at the last that means you’ll have to add one.

Now let us change the PATH variable using “setx“.

If there is not ; present at the last write

 setx PATH “%PATH%;C:\jdk\bin”

If there is a ; present at the last

 setx PATH “%PATH%;C:\jdk\bin”

And you’re done !

To test

Write “javac” (without quotes) on cmd or terminal and if it shows many of lines filled with how to use javac, it means you’ve properly PATH the jdk bins.

Why PATH ?

PATH is an environment variable that tells the shell (cmd,powershell,terminal or any other) which directories to search executable files.

So it was like a definition what it really does for us is removes the head and hand ache of leading the shell to the binary file always when we need it.

PATH is widely considered as most important environment variable so beware and don’t mess with it !

Time To Compile

Open command prompt \ or terminal.

First you must have to navigate the terminal to the right place where your program is saved.

Use “cd <path>” to navigate (Trick :  “use tab key”)

Write “javac” to compile.If your screen is not flooded with errors and warnings ,it means you’ve written a code that works.

Successful compilation would make a file named NameOfYourApp.class

Write “Java NameOfYourClass” to run that program you’ve just compiled .

Now you’re done with compiling and running a very basic Java program.


For more reference, HeadFirst is a great series of best books for programming and for online programming tutorial.

Keep i mind we don’t have affiliates of those,they’re here because they’re the best.

If you want them to affiliate us and we get some encouragement so tweet them @headfirstlabs and @wibit_usa with #AffiliateTipToGeek tag.

Thanks for reading and yeah I'd really appreciate  +1.Like or tweet.

Leave a Reply