Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

C209 Java Eclipse Guide

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

OFFICIAL (CLOSED) \ NON-SENSITIVE

C209 Advanced Object-Oriented Programming


Java and Eclipse IDE Guide (rev 2022)

Getting Java and Eclipse


1. You can get jdk-15.0.2_windows-x64_bin.exe and eclipse-java-2020-12-R-win32-x86_64.zip
from your Lecturer’s thumb drive or you can download them from the links below.

2. Download (Not necessary if you already have the above software from a thumb drive
 Get both Java and the Eclipse here: http://bit.ly/2021c209 (if Ctrl-Click does not work, try
copying and pasting the link).

 Java SE 15
https://www.oracle.com/sg/java/technologies/javase-jdk15-downloads.html

 Eclipse 2020-12
https://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/
release/2020-12/R/eclipse-java-2020-12-R-win32-x86_64.zip

Page 1
OFFICIAL (CLOSED) \ NON-SENSITIVE

Pre-installation Tasks
3. To ensure a smooth and successful installation operation, it is strongly recommended that you
perform the following housekeeping tasks first:

a) Back up Eclipse projects


i. Start your Eclipse and choose the following option:

ii. Note your Eclipse workspace directory, which will likely be different from the
following example:

iii. Open Windows Explorer and navigate to the Eclipse workspace directory. Create a zip
file of that directory:

Page 2
OFFICIAL (CLOSED) \ NON-SENSITIVE

iv. Save the zip file in a secure location as a backup copy of your work.

b) Delete all older versions of Eclipse


i. Locate the directory where your Eclipse version is installed. If you start Eclipse with a
shortcut, right-click on it and select Properties:

ii. Note the Eclipse directory, which will likely be different from the following example:

Page 3
OFFICIAL (CLOSED) \ NON-SENSITIVE

iii. Delete Eclipse directory

c) Remove all older versions of Java


i. Start Windows Settings by clicking on the Gear icon above the Windows icon:

ii. Click on Apps:

iii. In the Apps & Features option windows, look for ALL Java installations and uninstall.
Page 4
OFFICIAL (CLOSED) \ NON-SENSITIVE

Installing Java
4. To install Java SE Development Kit, double click on the file jdk-15.0.2_windows-x64_bin.exe
Follow the steps listed below.

5. Click [Next]

Page 5
OFFICIAL (CLOSED) \ NON-SENSITIVE

6. Click [close] to complete the installation.

Installing Eclipse
7. Double-click on eclipse-java-2020-12-R-win32-x86_64.zip

8. Copy the eclipse folder

Page 6
OFFICIAL (CLOSED) \ NON-SENSITIVE

9. Paste the eclipse folder to a location of your choice. E.g.(D:\)

10. After pasting, your directory structure should look similar to the below.

11. Double click on eclipse.exe

12. You will be asked to select a workspace. This will be the folder which Eclipse stores all your
codes.

Chose a meaningful folder. E.g. C:\RP\C209\workspace. Ensure that your workspace folder
should NOT be in the eclipse program folder in Step 10. You can change the location of this
workspace whenever you want. Click on the checkbox Use this as the default.

Page 7
OFFICIAL (CLOSED) \ NON-SENSITIVE

13. After Eclipse has started, right-click on the Eclipse’s icon at the taskbar and click Pin this program
to taskbar.

14. Uncheck Always show Welcome at start up.

15. Dismiss the Welcome Window by clicking on the [X] on the Welcome Tab as circled above. You
can bring back the Welcome Window by clicking Help  Welcome.

16. You should now see the empty workspace.

Page 8
OFFICIAL (CLOSED) \ NON-SENSITIVE

Configuring Eclipse
17. Click Window  Preferences. Type “font” in the text box. The following dialog will appear.

18. Select Colors and Fonts. Select Basic, then scroll down to select Text Font. Click the [Edit…]
button. Change the font to Consolas 10. Click [Apply and Close].

Check Compliance Level


19. Go to Windows > Preferences > Java > Compiler

20. Ensure that your compiler compliance level is 15. Click [Apply and Close].

Page 9
OFFICIAL (CLOSED) \ NON-SENSITIVE

Creating Your First Project


21. Click File  New  Java Project. In the Project Name, key in P000.
Ensure that you are using default JRE (third JRE option).

Page 10
OFFICIAL (CLOSED) \ NON-SENSITIVE

22. Click [Finish]. When prompted to create module-info.java, select [Don’t Create].

23. You will be able to see the newly created project in the Package Explorer as illustrated.

Creating Your First Class


24. Right-click on P000. Select NewClass.

25. In the Name, key in HelloWorld, ensure that “public static void main(String[] args)” is checked.
Click [Finish].

Page 11
OFFICIAL (CLOSED) \ NON-SENSITIVE

26. Expand the src folder and you should see the file HelloWorld.java created there.

27. Move the mouse pointer to the margin of the editor window and right-click to bring up the pop-
up menu. Select Show Line Numbers.

After line numbers shown:

Page 12
OFFICIAL (CLOSED) \ NON-SENSITIVE

28. Enter the following codes at Line 6 and press [Ctrl]+S to save the codes.

System.out.println("My First Java Program");

Executing Your Program


29. Click Run  Run.
a. Or you can click on the ‘play’ button shown below

30. The program outputs to the Console window as illustrated below.

Page 13
OFFICIAL (CLOSED) \ NON-SENSITIVE

Configuring The Language Bar


If you have additional Language installed in your computer, you need to perform the steps given in
this section.

Using Windows Search, click on the magnifying glass icon, then key in Advanced Keyboard Settings:

In the Advanced keyboard settings window, click on Input language hot keys:

Page 14
OFFICIAL (CLOSED) \ NON-SENSITIVE

Select any Ctrl+Space key sequence and click [Change Key Sequence…]:

Page 15
OFFICIAL (CLOSED) \ NON-SENSITIVE

Change Ctrl+Space to Left Alt + Shift. Click [OK] and click [OK] again.

Restart your computer.

Page 16

You might also like