Jump to content

Check out our Community Blogs

Register and join over 40,000 other developers!

Recent Status Updates

View All Updates

- - - - -

Getting started

java tutorial java eclipse

  • Please log in to reply
No replies to this topic

#1 mdebnath


    CC Newcomer

  • Member
  • PipPip
  • 17 posts
  • Programming Language:C, Java, C++
  • Learning:C, Java, C++

Posted 16 February 2013 - 08:23 PM

Before delving into the realm of Java, a few words to intrigue your curious mind. Did you ask yourself - Why do you want to learn Java? Reasons may vary, and in fact, don't even matter, as long as you have inquisitiveness and penchant to learn. The series of article down the line shall try to give you an air and glimpse of how deep the rabbit hole goes. So without much ado let us meander through, starting with a hint of – why & what Java? with no technical jargon, more in layman's term.


Learning Java


Java is simply a computer language. And it is actually pretty easy compared to other popular computer languages. Learning software
development, in general, might be a daunting task, because, there are lot of stuff that goes in and around apart from simply knowing a particular language. Java in particular, is easy and straightforward as a first programming language. The hard part is actually understanding all the intricacies of the object oriented concept. However, object oriented programming is somewhat easy to grasp for a person who actually never did any programming before. It seems natural more like building objects in the world around you. People who already know some other language may get intimidated at the beginning, but as you move on things become much simpler and quick. You can easily map your understanding and know exactly which peg goes into which hole.


...and software development


In our modern society software is tied into so much of what we do. It is hard to find anything you can touch upon that does not have a
computer in it, around it or controlling it. Software is actually a lot of little things. You just pile up these little pieces and Voila! Get this magnificent thing called software. When you try to understand the details of a sophisticated thing, say a calculator, in one go - it is really tough, but when you start peeling the layers of the onion things becomes very simple and you can easily understand it. The important thing here is that you gave it a try. The most insanely complex thing is actually pretty simple when you give it a try. So what do you think software development is – an assemblage of many a little things within a lot.


...what's next


So you are intrigued, indeed? Great! Read on...


Setting up the Environment

First step to start Java is to setting up you programming environment. What you need is a compiler, an editor called IDE (Integrated Development Environment) for writing your code and documentation for ready reference. So, download the following and install it.

  1. JDK: The acronym Java Development Kit is the compiler needed to translate your source code into target code. Java Runtime Environment (JRE) is automatically installed with JDK (which is required by Eclipse). If you are unsure how to install check out the installation guide.

  2. JDK Docs: the documentation files comes in HTML format of Java API(Application Programming Interface). In a word it is called javadoc.This javadoc can be used as a ready and most authentic reference to different functions, classes and packages used while Java programming which collectively called Java API library. You simply need to unzip the file and open the index.html to see it.   

  3. Eclipse: One of the most popular IDE for Java programming. Note that there are several very good IDE available such as BlueJ, Jedit, NetBeans etc. Choosing any of them will do but in this and the following articles we shall be using Eclipse that's all. Eclipse comes in a zipped file format. Simple download and unzip it in a preferred location and you are ready to go. You do not need to install it in the sense JDK is installed. If you are still unsure check out the installation guide

Please ensure that Java is installed properly on your computer before you begin. To check everything is alright try out the instruction below.    

  • Open Eclipse
  • File->New->Java Project
  • Give the name of the project, say TestProject
  • Make sure that
    • the Use a project specific JRE shows the JRE you have installed.
    • Otherwise,click on Configure JREs... and add the JRE home path. Note that JRE home is nothing but the jre folder found in the location where you have installed JDK (say, c:\java\jre)).
    • Assuming   everything OK click on Next and then Finish.
    • Expand the TestProject from Package Explorer left pane.
    • Right click on the src folder then New->Class
    • Give the Package Name: mypackage and Class Name: MyClass
    • Click Finish
    • Copy/type the following code.


package mypackage;
public class
MyClass {

    public static void main(String[] args) {        

        System.out.println("JDK and Eclipse installed properly");


  • Select Run-> Run As-> Java Application
  • If everything is alright the output will be shown in the Console window



Note: A java program can be written in any text editor even in notepad. It is not an absolute necessity to have an IDE like Eclipse. However, writing a program in an IDE is more convenient. A java program can be compiled and run from MSDOS console in Windows or Linux console. The command for compiling a java program is javac MyClass.java and to run java MyClass. Compiling and running from console requires some additional configuration such as creating an environment variable of CLASSPATH. You can easily learn that later at a little advanced stage. As of now it hardly matters as long as you are using Eclipse.

You are done


So every thing is running fine, nice and easy and you are ready to dive in, how deep the rabbit hole goes we shall see. Next article coming up in the series would be a little more technical, don't be intimidated I will explain everything. But before that let me tell you, each article shall have a set of questions/quizzes, programming tasks etc. You may find it interesting to find the answers in whatever way you like but preferably find it yourself. Some answers you may find in the article itself and others have to be searched for.




  1. What is Java
    1. An Object oriented programming language
    2. A type of coffee
    3. A website
    4. None of the above
  2. Who created Java
    1. Bjarne Stroustroup
    2. James Gosling
    3. Dennis Ritchie
    4. Steven Spielberg
  3. What is Eclipse
    1. A state when moon comes between sun and earth
    2. An IDE for Java
    3. Java compiler
    4. None of the above
  4. What is an IDE
    1. Integrated Development Editor
    2. Integrated Device Environment
    3. Integrated Device Editor
    4. Integrated Development Environment
  5. Programming Java is not possible without
    1. IDE
    2. Eclipse
    3. javac
    4. none of the above
  6. In Eclipse output is shown generally in the
    1. Console window
    2. Project explorer window
    3. No output shown
    4. None of the above
  7. Command to compile a Java program from console (MSDOS console or Linux console)
    1. java MyClass.java
    2. java MyClass
    3. javac MyClass.java
    4. None of the above
  8. Command to run a Java program from console (MSDOS console or Linux console)
    1. java MyClass.java
    2. java MyClass
    3. javac MyClass.java
    4. javac MyClass
  9. JDK contains JRE, JRE does not contain JDK
    1. True
    2. False
  10. Who provides environment for running a Java program
    1. JRE
    2. JDK
    3. Eclipse
    4. Operating System
  11. ________is an environment variable
    1. MSDOS
    2. IDE
    3. JAVADOC




Tasks: Try yourself

  • Why Java is called Java after all? 
  • Who created Java and why Java came into existence? 
  • Why Eclipse is called an IDE? 
  • Name some IDE other than Eclipse.  
  • Name some object oriented language other than Java.



Next: Introduction to Java | Back to Table of content


Edited by mdebnath, 08 March 2013 - 01:15 AM.

  • 0

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download