JavaLab1(Chongqing) – Getting familiar with Java environment

Task 1: Getting Started With Eclipse and Java

1. What is Eclipse?

Eclipse is an open source, extensible Integrated Development Environment (IDE) that is very popular among Java programmers. It runs on most versions of Windows, Red Hat and SuSE Linux, Solaris, Macintosh OS X and other platforms. It has a Java editor that finds all syntax errors as you type. It has a good source-level debugger. Plus, it’s free.

2. Starting Eclipse

A. Double click the Eclipse executable icon from the desktop of computer. When you launch Eclipse, you will see the Workspace Launcher. The Workspace Launcher appears the first time Eclipse is run. Click Run button.

B. Click Browse button, click Computer icon, double click Java_WorkSpace folder, click Ok button, then click Ok button again. You will see a Welcome Screen similar to one of those below:

C. Close Welcome Screen by clicking “X” from the top left screen.

Task 2:Create Lab1 project:We will go through the steps required to create and run a simple Java program.

1. Create a Java a project.

a) Choose the menu item File/New/Project... .

b) Select Java Project in the category list. Click Next.

c) Give the project a name (“Lab1”, for example). Click Finish.

2. Create a new Java class called Welcome: right click on Lab1 folder on the left column, select “New” and then “class”. Name the class as “Welcome”. Check the box before “public static void main (String[]args)”. Then click on “Finish.

3. Please delete the codes (like *@paramargs and //TODD…) that Eclipse generated for you.

4. Now we will start creating our first Java program. You can just type the following code into the pane:

5. Save your work. You can do this by choosing File/Save All.

6. Run your program. Click Run icon from the toolbar ().

7. The bottom frame shows a Console view. The Console is the window for text I/O:

You can see the output “Ball State welcomes you!” in the Console.

8. Once you have run your program once, you can run it again by clicking the Run icon from the toolbar.

9. Errors

If your code has any syntax errors or other problems that prevent it from compiling, the editor window shows a red X icon at the beginning of each line with a problem. If you move the mouse over the X, a message will pop up. Also, the Problems pane at the bottom lists all error messages. In the picture below, I have misspelled “println” as “printlln” and have deleted the semicolon from the end of the printing statement:

10. Please fix the errors and Run the program again.

11. Congratulations! You have just finished your first Java program!

12. Let your instructor to grade your Lab1.

Thanks! Dr. Zhang

Download JDK and Eclipse for your own laptop

13: Download Java SE Development Kit (JDK) – jdk-8u-windows-x64 to your computer from below link:

14: Download the version Eclipse IDE for Java EE Developers to your Computer from the below link: