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
- Open Eclipse.
- If you are running eclipse for the first time, you will get a dialog box asking to define “default workspace’
- 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.
- Inside the root folder you can see few folders that are created.
- The src folder will contain the .java file that you save.
- The bin folder will contain the .class file that is created after your compile the .java file.
- The settings folder contains the necessary files for the running of the program.
- Create a new Java project
- 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.
- Some special shortcuts useful :
- CTRL+D deletes the whole line at once
- Type main and hitting CTRL+SPACE will write the main method declaration.
- CTRL + SHIFT + F will make align all the lines of the program with correct indentation and proper nesting alignment.
- Type sysout and hitting CTRL+SPACE will write the java statement to print a line.
- 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
- To make a new object. Type new and press CTRL+SPACE. It will write the java statement for creating a new class.
- 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