- HubPages»
- Technology»
- Computers & Software»
- Computer Science & Programming»
- Programming Languages
How to Make Java Program Using Eclipse IDE: Introduction for Beginners
How to Program in Java Using Eclipse IDE
To be able to Program in Java using eclipse, you must Install Eclipse IDE first if you do not have the IDE yet. You can find the download links and instructions on how to have Eclipse IDE on your PC here. Assuming you already have an Eclipse IDE in your PC. Open Eclipse and follow the steps below.
How to Make a Java Project on Eclipse IDE
1. Click FILE, then NEW, then JAVA PROJECT.
2. A text box will open. Enter a name for your new Java Project. Example: First_Eclipse_Program
3. Click FINISH. Your Java Project Name will be listed on the left side bar.
4. To make a Main Class for your Java Project, right click the Project Name on the left side bar, Click NEW, Choose CLASS.
5. A Dialog box will Open, then type MAIN on the class Name. Click FINISH. Now a new interface will open, that would be your Main Class Program.
Inside the main class, the code is like this:
public class main {
}
Make your First Eclipse Java Project inside the Main Class
Inside the main class: Try to Copy and Paste this Code:
public static void main(String[] args)
{
System.out.println("Yay! This is my First Program in Eclipse...:D");
}
The whole code must look like this:
public class main {
public static void main(String[] args)
{
System.out.println("Yay! This is my First Program in Eclipse...:D");
}
}
6. Save the Program. Short cut is ctrl + S, it will automatically be saved.
7. Then Click Run: It is the one enclosed in red below.
8. See the output on the console below.
Sample Console Output
9. If you want to make another class aside from main program, just repeat the step 5, except the name must not be MAIN, make your own name. It will be another class inside the package. The MAIN name is a default name for the main program. So, every time you make another Java Project, you will also manually make the MAIN Class. If you do not, the program will not run without the MAIN class.
That’s it. If you want some other codes for beginners, better look at this one and try it out!