Writing Your First Java Program in Eclipse
by, 02-11-2012 at 03:03 PM (1344 Views)
Follow these steps to write your first Java program in Eclipse.
1. Launch Eclipse
• Click on “eclipse.exe” is the installation director of Eclipse.
• Select a folder for your workspace.
• Close the “welcome” screen.
2. Create New Java Project
For new application, you will create a new project to keep the entire related source and other files. To create a new Java project follows these steps.
• Choose New from File menu and then select Java Project.
• A new Java project dialog will open.
• Enter the project name as “FirstProject”.
• Click the check box “Use Default Location”.
• Click the check box “Use Default JRE”.
• Click “Finish”
3. Create a Java File
• Open File menu->New-Class
• Enter the class name “Hello”
• Click finish
A Java class will open in the editor. Please enter code.
4. Compile and Execute the Program
• Eclipse automatically performs incremental compilation so there is no need to compile a source file. Code is compiled when you write and save it.
• To run the program, right click in your java source file and choose “Run As”->”Java Application”