Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Create your first Java Program

Before getting started


These instructions are specifically for the Eclipse IDE computer program available
for both windows and mac OS.

Download Java
You might have to download java in case is not downloaded in your computer. Some
Mac come preloaded with Java, so make sure your laptop comes with java, in case of
not having it, download from java website.
 For Windows go to
https://java.com/en/download/help/windows_manual_download.xml and follow
the prompted instructions.
 For Mac OS go to https://java.com/en/download/help/mac_install.xml and follow
the prompted instructions.

Download Eclipse
 To download go to www.eclipse.org/dowloads and download Eclipse.
 Start the Eclipse Installer executable. Windows users will find it in their download
directory. Start the executable and you may get a security warning to run this file,
make sure the Publisher is Eclipse Foundation. Mac and Linux users need to
unzip the download to create the installer. After that start the installer once
available.
 Next step is to select the package to install, for our purpose, select Eclipse IDE
for Java Developers. It should be the first option.
 Finally select your installation folders and click the install button.

Now that you have downloaded eclipse, go ahead and launch the program to get
started on your first java project.

Steps:
1. Launch the program after downloading and installing it.
2. You’ll see a welcome screen. To create your first java project go ahead and
create a new java project. You can do this by clicking file on the top of the
screen, and then new, and finally java project.

3. A new screen will pop out. Here you will name your project and click finish at the
bottom of the screen.

Note: Depending of you operating system, you may be asked if you want
to create a module. For our purpose we will not need to create one, so
click “don’t create” when prompted.

4. Now we have to create a new class under our java project. To do so right click
under your project folder and click “New” and then “Class”.
5. A new screen will pop out. Here you’ll name your class, for this case will name
our class “Main”. Also chose the main method under the method stubs. Click
finished at the bottom of the screen.

Note: You can choose whichever name you want for your class although
you must keep in mind some points. When naming a class be brief and
meaningful, no spaces are allowed, and some special character (such as
“.”,”@”, “,”) are not allowed.
6. On your new class, write the following to display a simple “Hello world” text.

System.out.print("Hello World");

Note: System is a pre-defined class that Java provides us and it holds


some useful methods and variables. Out is a static variable within System
that represents the output of your program (stout).

Your screen should look like this:


7. Now is time to run your program, to do so click on the top green play button.
(You’ll encounter a pop up window asking if you want to save and launch, just
click on).

8. Your output should be display on your console, which is situated at the part of
your screen. It should display “Hello World”.

You might also like