Launch the eclipse.exe application by double-clicking on it. If you dont see the window with the Welcome tab in the upper left corner, pull down the Help menu and select Welcome. Click on the green checkmark (with pencil with green eraser) to go to Tutorials. Click on Create a Hello World application.
The right panel contains a series of six steps marked with isosceles right triangles. Here are hints to help you follow them. Remember, the name of the project and class, HelloWorld, is one word with no space. The H and W must be uppercase, and the rest lowercase. Email me if you get into trouble: mark.meretzky@nyu.edu
After you press the
Finish
button,
a
HelloWorld.java
file should appear in the
Java editor
(the central panel).
The default package and
HelloWorld.java
file will also be listed in the Package Explorer on the left.
The
HelloWorld
class and its
main
method will be listed in the
Outline
window.
If the Outline is not visible,
Window → Show View → Outline
Also two files,
HelloWorld.java
and
HelloWorld.class
will appear in your
HelloWorld
folder.
System.out.println("Hello world!");in the empty line immediately under the // TODO comment. (You can remove the comment.) To indent your statement the same distance as the comment, use the Tab key or pull down the Source menu and select Format.
If the Java editor is too cramped, maximize it by clicking on the larger icon at the right end of its title bar. To restore it to its original size, click on the icon that looks like two rectangles.
Anything you do wrong will be underlined with a red zigzag. For example, the S in System must be uppercase, and the L in println must be a lowercase letter L and not the digit 1. (The ln stands for line). Dont be unnerved if it displays the word out in blue italics; its only trying to be helpful. The " character is a double quote, not a pair of single quotes. The computer wont be satisfied until you have typed the semicolon at the end of the statement.
To save your changes after you have inserted the
println
statement,
pull down the
File
menu and select
Save.
If there are error messages,
they will appear in the bottom center window;
click on the
Problems
tab.
If you dont see it,
Window →
Show View →
Problems
Correct them and save again.
If you want to print the HelloWorld.java file, click on it in the Java editor, pull down the File menu, and select Print….
Your HelloWorld class in the Package Explorer has an uppercase C in a green circle. If you dont see it, open the HelloWorld.java icon in the Package Explorer by clicking on its minus sign (on Mac, rightward-pointing triangle). On a Mac you have no right mouse button, so hold down the control key as you click on the HelloWorld in the Package Explorer. If it says Select resources to save, just press OK.
You should have a
Console
window at the bottom center.
If you dont see it,
Window →
Show View →
Console
The output of your Java program
(the words Hello world!)
will appear in the Console.
You can maximize and restore the Console just as you maximized and restored the Java editor. To print the output, copy and paste the words into a document (e.f., in Notepad) and print the document.
Before running the program again, you may want to erase the output. Click on the Console icon of a sheet of paper with an X in the lower right corner.