Skip to main content

How to Install Eclipse and Get Started with Java Programming


 #Topic-3

How to Install Eclipse and Get Started with Java Programming.

Last topic we have discussed about Java Development Kit (JDK) tool and how to write, compile & run (execute) a java program using notepad and command prompt.If you not go through that ,click this link
What is the software’s needed to start JAVA programming.

So let’s see How to Install Eclipse and Get Started with Java Programming.

 
What is Eclipse?
Eclipse is famous for Java Integrated Development Environment (IDE), Eclipse is an open-source Integrated Development Environment (IDE). Eclipse is popular for Java application development (Java SE and Java EE) and Android apps. It also supports C/C++, PHP, Python, Perl, and other web project developments via extensible plug-ins. Eclipse is cross-platform and runs under Windows, Linux and Mac OS.
The Java Development Tools (JDT) project provides a plug-in that allows Eclipse to be used as a Java IDE, PyDev is a plugin that allows Eclipse to be used as a Python IDE, C/C++ Development Tools (CDT) is a plug-in that allows Eclipse to be used for developing application using C/C++, the Eclipse Scala plug-in allows Eclipse to be used an IDE to develop Scala applications and PHPeclipse is a plug-in to eclipse that provides complete development tool for PHP.
Every year, since 2006, the Eclipse foundation releases the Eclipse Platform, the latest version is Neon (Eclipse 4.6) Released on 22 June 2016(next version will be Oxygen (28 June 2017 planned and releasing soon, may be next week!) and Photon (June 2018 planned) .

Downloading Eclipse
You can download eclipse from http://www.eclipse.org/downloads/. The download page shows different types of eclipse packages we have to choose Java developers typically use Eclipse Neon/latest version or Eclipse IDE for developing Java applications.
If your machine is 64 bit then you can click on download 64 bit button else click on the option Download Packages (please refer below screenshot marked in red color).

 
Installing Eclipse
To install on windows, you need a tool that can extract the contents of a zip file. For example you can use:
Using any one of the above tools, extract the contents of the downloaded eclipse zip file to any folder of your choice.



Launching Eclipse
On the windows platform, suppose if you extracted the contents of the zip file to G:\, then you can start eclipse by using G:\eclipse\eclipse.exe , it depends on which folder you have extracted the contents of the zip file.
When eclipse starts up for the first time it prompts you for the location of the Workspace folder. All your data will be stored in the Workspace folder. You can accept the default or choose a new location wherever you want, I would suggest you make separate folder like java or any proper name. 

If you select "Use this as the default and do not ask again", this dialog box will not come up again. Next follow the below screen shot, click on workbench icon.  


Parts of an Eclipse Window :
The major visible parts of an eclipse window are:
  • Views
  • Editors (all appear in one editor area)
  • Menu Bar
  • Toolbar
    An eclipse perspective is the name given to an initial collection and arrangement of views and an editor area. The default perspective is called java. An eclipse window can have multiple perspectives open in it but only one perspective can be active at any point of time. A user can switch between open perspectives or open a new perspective. A perspective controls what appears in some menus and tool bars. 



    Description of Menu(s):
    File: The File menu allows you to open files for editing, close editors, save editor content and rename files. Among the other things, it also allows you to import and export Workspace content and shutdown Eclipse.
    Edit: The Edit menu presents items like copy & paste.
    Source: The Source menu is visible only when a java editor is open. It presents a number of useful menu items related to editing java source code.
    Navigate: The Navigate menu allows you to quickly locate resources and navigate to them.
    Search: The Search menu presents items that allow you to search the Workspace for files that contain specific data.
    Project: The menu items related to building a project can be found on the Project menu.
    Run: The menu items on the Run menu allow you to start a program in the run mode or debug mode. It also presents menu items that allow you to debug the code.
    Window: The Window menu allows you to open and close views and perspectives. It also allows you to bring up the Preferences dialog.
    Help: The Help menu can be used to bring up the Help window, Eclipse Marketplace view or Install new plug-ins. The about Eclipse menu item gives you version information. 

    How to create a new java project in eclipse:
    There are many ways to create a new java Project:
    • By clicking on the File menu and choosing New-->Project-->Java Project.
    • By right clicking anywhere in the Project Explorer and selecting New → Project-->Java Project.
    • By clicking on the New button in the Tool bar and selecting Java Project.

    Click next button as per below screen shot
       

    The New Java Project has two pages. On the first page :
    • Enter the Project Name
    • Select the Java Run-time Environment (JRE) or leave it at the default
    • Select the Project Layout which determines whether there would be a separate folder for the source codes and class files. The recommended option is to create separate folders for sources and class files(default option).
    Please refer below screen shot:

     
    • You can click on the Finish button to create the project or click on the Next button to change the java build settings.
    • On the second page you can change the Java Build Settings like setting the Project dependency (if there are multiple projects) and adding additional jar files to the build path.


     
    How to open the Newly Created java Project:
    The Package explorer shows the newly created Java project. The icon that represents a Project is decorated with a J to show that it is a Java Project. The folder icon is decorated to show that it is a java source folder.



    How to create a New Java Package in eclipse:
    You can use the New Java Package to create a Java package. The Java Package can be created in different ways:
    • By clicking on the File menu and selecting New → Package.
    • By right click in the package explorer and selecting New → Package.
    • By clicking on the package icon which is in the tool bar.
    If you are creating a sub package, before opening the Java Package select the parent package so that name field can have a default value in it. 

     Once create new Java Package comes up:
    • Enter/confirm the source folder name.
    • Enter the package name.
    • Click on the Finish button. 


     Naming Conventions:
    • Package names are written in all lower case to avoid conflict with the names of classes or interfaces.
    • Companies use their reversed Internet domain name to begin their package names ,It should be like domainname.organization.projectname.modulename  
      Ex: com.example.region.mypackage.

    The package explorer will show the newly created package under the source folder.


    How to create a New Java Class in eclipse:
    Once done with java project and package creation, you can use the New Java Class to create a Java class. The Java Class can be invoked in following ways:

    • By clicking on the File menu and selecting New → Class.
    • By right clicking in the package explorer and selecting New → Class.
    • By clicking on the class drop down button and selecting class.
    Please note before bringing up the New Java Class, select the package in which the class is to be created so that the wizard can automatically fill in the package name for you.


    Once the new java class page comes up:
    • Ensure the source folder and package is correct.
    • Enter the class name.
    • Select the appropriate class modifier.
    • Enter the super class name or click on the Browse button to search for an existing class.
    • Click on the Add button to select the interfaces implemented by this class.
    • Examine and modify the check boxes related to method stubs(select public static void main(String[] args) for create main class) and comments.
    • Click the Finish button.  


    How to open newly created class:
    The newly created class should appear in the Package Explorer view and a java editor instance that allows you to modify the new class. It should appear in the editor area.


    Well! Complete the program using the output statement for display the message “Hello world…!” As per below screen shot: 


    Running it
    There are many ways to run a java Program:
    • Save using ctrl-s. This automatically compiles HelloWorld.java.
    • Click the Run button in the toolbar (looks like a little man running).
    • You will be prompted to create a Launch configuration. Right click on class name and select Run As à Java Application.
    • Click "Run" to run the Hello World program. The console will open and display "Hello World". 


    Congratulations! You have completed the setup for eclipse on your computer. It’s now ready to write any Java program. 

    Next week I will post about(#Topic-4) Your First Java Program: Hello World
     
    If you enjoyed this post, I’d be very grateful if you’d help it spread by emailing it to a friend, or sharing it on Twitter or Facebook. Thank you! - Shivananda Rai

    Comments

    1. Thank you sir, I have learned lot...

      ReplyDelete
    2. Informative and great site for beginners.

      ReplyDelete
    3. Complete information about Eclipse , good information

      ReplyDelete
    4. Thanks for information and Please keep on post .

      ReplyDelete

    Post a Comment

    Popular posts from this blog

    What is the software’s needed to start JAVA programming

    #Topic-2 Last week we have discussed about some basic topics like how to start java , what is the use etc , If you are very new to Java programming then click this link Java Tutorials for Beginners. What is the software’s needed to start JAVA programming. If you are new to Java programming and wish to learn it right now by doing some hands-on practice, you have visited the right place. This tutorial will help you what is the software’s needed to write your first Java program, Throughout this tutorial, you will learn fundamental concepts and steps which are necessary for every Java fresher.  In order to write and run a Java program, you need below software / editor: 1. Java Development Kit (JDK) 2. Command prompt 3. Note pad OR 4.IDEs : These IDEs offer a variety of features, like: building Java applications, Testing, debugging, code inspections, code assistance, visual GUI builder and code editor, and more. While you can find several Java IDEs or integrated development en

    Variables and Data Types in Java

    #Topic-5 Previous topic (4) we have discussed about how to start coding! , we have gone through our first Java Program line by line. If you have not gone through that topic, click this link  Your First Java Program: Hello World In this section we will discuss about variable , Data types , Literals and many more! Variable Variable is name of reserved area allocated in memory . In other words, it is a name of memory location . It is a combination of "vary + able" that means its value can be changed.   Example:   int value= 10 ; //Here value is variable float a= 10.50 ; //Here a is variable   There are three major types of variables in java: local variable instance variable static variable 1) Local Variable : A variable which is declared inside the method is called local variable. 2) Instance Variable : A variable which is declared inside the class but outside the method, is called instance variable . It is not declared as static. 3) St