Java Tutorials - First Program

in #steemstem7 years ago (edited)

Hello Steemians !!! Welcome to my 2nd tutorial on Java programming. In the last article we have seen how we can install Java in our windows operating system. Now, in this article we will see how we can install Eclipse IDE on our windows operating system and for testing it we are going to run our first program. I will not go deep here as this is just for testing.

What is Eclipse IDE?
-IDE stands for integrated development environment which helps you to code your program.
-IDE is an editor which will help you to write and compile your program and Eclipse is one such IDE and most used IDE in the terms of Java development.
So, let’s see how we can install Eclipse IDE on our windows operating system step by step.

Step 1 :
First of all, open your browser and search for Eclipse IDE and the first link hopefully comes is www.eclipse.org . Just click this link and in here you will be able to see different versions of Eclipse IDE but right now we are interested in developing Java applications so will download the first option which is 'Eclipse IDE for Java development'.

Step 2 :
Now depending on the system type of your computer, it’s 64-bit or 32-bit, you need to download one of these zip files.
So, to check which system type you have just go to Computer > right click > properties. Mine is 32-bit so I will click on 32-bit and you can click on the corresponding link then you will be able to save the zip file. It’s a zip file so don’t be confused that it should be executable. It’s not an executable file but it’s a ‘.zip’ file. Wait for the download and once it will be downloaded we will see how we can configure Eclipse on our windows operating system in the next step.

Step 3 :

So, my download is complete now I will just open this zip file. It contains a folder called Eclipse as you can see in the screenshot below.

eclipse1.png

Step 4 :
Extract it in your C folder and wait for the extraction to complete. Once this extraction is complete you can see this Eclipse folder inside your C folder or folder of My Computer or whatever location you have chosen.

eclipse2.png

And in this folder all the Eclipse files are extracted.

Step 5 :
In order to run this you can double click on this Eclipse icon. Now, for the first time when Eclipse opens, your computer will ask for the location for workspace. I will leave it as default and click OK but if you want to change the folder for this location you can change it.

Step 6 :
Now Eclipse will open in a moment. To create a new project in Eclipse IDE you just need to go to file > new > Java project.

eclipse4.png

In here, you just need to give the name to your project (for example: MyFirstProject) and click next.

eclipse5.png

Now you will see our project folder and our source folder. Now click on finish. Once you click finish Eclipse will create MyFirstProject for you. In MyFirstProject you will see there is a folder called source.

eclipse6.png

Step 7 :
In this folder we can create simple class and we are doing this just for testing whether Eclipse is working or not. In next article we will see how to properly configure a project and how to create your first Java project in a proper way.
So, right click on src > new > class

eclipse7.png

and give the class name (for example: MyClass) and check the option which is ‘public static void main’ which will create a main method.

eclipse8.png

We will see our classes and main method in Java but for now we just want to just check whether it’s working or not. Just click finish.

eclipse9.png

Now you can see we have created a class called MyClass.java.

Step 8 :
Now we are going to print something that you can see in the screenshot below. Just type as it is.

eclipse10.png

Now to run this program right click on MyFirstProgram > Run as > Java application. Now click OK. You can se “Hello World” is printed on the console.

eclipse12.png

That means Eclipse IDE is properly configured in my system and i will be able to compile my Java program.

If you have any questions please comment below.

Imaportant :

All the images used in this article are the screenshots taken in my phone and my pc and some of them are cropped using Paint.

References :

  1. https://www.eclipse.org/downloads/packages/eclipse-ide-java-developers/keplersr1
  2. Book : The Java programming language by Arnold.
Sort:  

Congratulations! This post has been upvoted from the communal account, @minnowsupport, by pratique007 from the Minnow Support Project. It's a witness project run by aggroed, ausbitbank, teamsteem, theprophet0, someguy123, neoxian, followbtcnews, and netuoso. The goal is to help Steemit grow by supporting Minnows. Please find us at the Peace, Abundance, and Liberty Network (PALnet) Discord Channel. It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.

If you would like to delegate to the Minnow Support Project you can do so by clicking on the following links: 50SP, 100SP, 250SP, 500SP, 1000SP, 5000SP.
Be sure to leave at least 50SP undelegated on your account.