Programming in an IDE – Eclipse

I am using Eclipse Indigo Service Release 1 in my classes.

Eclipse is an IDE just like Netbeans. It provides an environment many features that makes programming much easier than working in notepad. It provides programmers with code autocorrect, class and property suggestion, code formatting, code generation, inbuilt program compilation and output console.

Learn more about what an IDE is here

Download Eclipse from here.

Read about pre-requisites of running a java program from here

Running EclipseJAVA blog

 

  1. Open Eclipse.
  2. If you are running eclipse for the first time, you will get a dialog box asking to define “default workspace’
  3. A default workspace is nothing but the root folder where all your java files including your class files and other necessary files will be stored from now on.
  4. Insidjava3e the root folder you can see few folders that are created.
    1. The src folder will contain the .java file that you save.
    2. The bin folder will contain the .class file that is created after your compile the .java file.
    3. The settings folder contains the necessary files for the running of the program.
  5. Create a new Java project
  6. Make packages.  Packages are method to manage files in a folder system. The normal convention of writing a package is reverse order of writing a webpage URL. For example, com.primecollege.labs .This will create a folder hierarchy of D:JavaClassCSIT7thbincomPrimeCollegelabs automatically.
  7. Some special shortcuts useful :
    1. CTRL+D deletes the whole line at once
    2. Type main and hitting CTRL+SPACE will write the main method declaration.
    3. CTRL + SHIFT + F will make align all the lines of the program with correct indentation and proper nesting alignment.
    4. Type sysout and hitting CTRL+SPACE will write the java statement to print a line.
    5. Select a class name or a property and hit ALT+SHIFT+R. It will re factor all the instances of that classes everywhere in the root package
    6. To make a new object. Type new  and press CTRL+SPACE. It will write the java statement for creating a new class.
    7. to quickly generate getters and setters. First declare all the properties. Select all the declarations and RightClick->Source->Generate Getters and Setters.

Learn more about other shortcuts of Eclipse here

 

Leave a Comment

Your email address will not be published. Required fields are marked *