How to Use Eclipse IDE to run Java Programs?

First of all you need to create a Java project in Eclipse IDE.  In the created Java project, you will see some default items that are displayed. You must know these items before creating and running Java programs.

  1. In the ‘Eclipse IDE’, see the Package Explorer tab. You will see the created Java project name.image001
  2. Expand the Java project folder and ensure that the ‘src’ folder and JRE System Library are displayed.image003
  3. ‘src’ folder contains the project source code. Here, you can find all the created Java programs as Java Class files.
  4. You can find all the predefined libraries under ‘JRE System Library’. These are required to run all the Java programs.image005
Creating a Package
  1. From the ‘Package Explorer’, right-click the created project and select New->Package.image007
  2. This will display the ‘New Java Package’ dialog box. Type the package name in the Name field. Click Finish.image008
  3. Right-click on the created package and select New->Class.image009
  4. This will display the ‘New Java Class’ dialog box. Ensure that the following things are reflected, as shown in the image.image011
  5. In the Eclipse IDE, ‘’ file is displayed.image013
  6. Write the code for adding two numbers in the ‘main’ method.image015
  7. Save the ‘’ file, as shown below.image017
  8. Right-click ‘’ class and select Run As->Java Application.image019
  9. Output will be displayed in the Eclipse IDE->Console.image020

Get A Free Quote

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.