Create your first java project (Begginer)
Step 0: Launch Eclipse Launch Eclipse by running "eclipse.exe" from the Eclipse installed directory. Choose an appropriate directory for your workspace, i.e., where you would like to save your files (e.g., d:\myproject\eclipse for Windows) If the "Welcome" screen shows up, close it by clicking the "cross" button next to the "Welcome" title. Step 1: Create a new Java Project For each Java application, you need to create a project to keep all the source files, classes and relevant resources. To create a new Java project: Choose "File" menu ⇒ "New" ⇒ "Java project". The "New Java Project" dialog pops up. In "Project name", enter "FirstProject". Check "Use default location". In "JRE", select "Use default JRE (currently 'JDK1.8.xx')". But make sure that your JDK is 1.5 and above. In "Project Layout", check "Use project folder as root for sources and class files" Push "Finish" button. Step 2: Write a Hello-world Java Program In the "Package Explorer" (left pane) ⇒ Right-click on "FirstProject" (or use the "File" menu) ⇒ New ⇒ Class. The "New Java Class" dialog pops up. In "Source folder", keep the "FirstProject" In "Package", delete the content if it is not empty In "Name", enter "Hello" Check "public static void main(String[] args)" Don't change the rest. Push "Finish" button. The source file "Hello.java" opens on the editor panel (the center pane). Enter the following codes: public class Hello { public static void main(String[] args) { System.out.println("Hello, world!"); } } Step 3: Compile & Execute the Java Program There is no need to compile the Java source file in Eclipse explicitly. It is because Eclipse performs the so-called incremental compilation, i.e., the Java statement is compiled as and when it is entered. To run the program, right-click anywhere on the source file "Hello.java" (or choose "Run" menu) ⇒ Run As ⇒ Java Application. The output "Hello, world!" appears on the Console panel (the bottom pane).
Step 0: Launch Eclipse Launch Eclipse by running "eclipse.exe" from the Eclipse installed directory. Choose an appropriate directory for your workspace, i.e., where you would like to save your files (e.g., d:\myproject\eclipse for Windows) If the "Welcome" screen shows up, close it by clicking the "cross" button next to the "Welcome" title. Step 1: Create a new Java Project For each Java application, you need to create a project to keep all the source files, classes and relevant resources. To create a new Java project: Choose "File" menu ⇒ "New" ⇒ "Java project". The "New Java Project" dialog pops up. In "Project name", enter "FirstProject". Check "Use default location". In "JRE", select "Use default JRE (currently 'JDK1.8.xx')". But make sure that your JDK is 1.5 and above. In "Project Layout", check "Use project folder as root for sources and class files" Push "Finish" button. Step 2: Write a Hello-world Java Program In the "Package Explorer" (left pane) ⇒ Right-click on "FirstProject" (or use the "File" menu) ⇒ New ⇒ Class. The "New Java Class" dialog pops up. In "Source folder", keep the "FirstProject" In "Package", delete the content if it is not empty In "Name", enter "Hello" Check "public static void main(String[] args)" Don't change the rest. Push "Finish" button. The source file "Hello.java" opens on the editor panel (the center pane). Enter the following codes: public class Hello { public static void main(String[] args) { System.out.println("Hello, world!"); } } Step 3: Compile & Execute the Java Program There is no need to compile the Java source file in Eclipse explicitly. It is because Eclipse performs the so-called incremental compilation, i.e., the Java statement is compiled as and when it is entered. To run the program, right-click anywhere on the source file "Hello.java" (or choose "Run" menu) ⇒ Run As ⇒ Java Application. The output "Hello, world!" appears on the Console panel (the bottom pane).