Difference between revisions of "Hello World in Eclipse"

From Progzoo
Jump to: navigation, search
(Download Eclipse)
 
(19 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
See [[Hello Web with Tomcat]] when you have completed this.
 
==Download Eclipse==
 
==Download Eclipse==
 +
[[Image:Eclipse_Download_Screenshot.png|Pick the EE (Enterprise Edition)|thumb]]
 
*http://eclipse.org/download - you need the JEE version for your operating system
 
*http://eclipse.org/download - you need the JEE version for your operating system
 
*Choose the '''Eclipse IDE for Java EE Developers'''
 
*Choose the '''Eclipse IDE for Java EE Developers'''
 +
<br clear=all>
 +
==Unzip and make a shortcut==
 +
[[Image:Eclipse_Unzipped.png|No install - just unzip it|thumb]]
 
*There is no install - simply unzip it to a convenient locations (for example c:\)
 
*There is no install - simply unzip it to a convenient locations (for example c:\)
[[Image:Eclipse_Download_Screenshot.png|Pick the EE (Enterprise Edition)|thumb]]
+
*You can start by double clicking eclipse.exe
 +
*You can make a shortcut on your desktop
 +
<br clear=all>
 +
==Welcome Screen==
 +
[[Image:Eclipse_Welcome.png|Close this pane|thumb]]
 +
*Accept the default workspace and move on
 +
*The welcome screen can be closed - you will not need it again
 +
<br clear=all>
 +
==New project==
 +
[[Image:Eclipse_new_project.png|File New Project|thumb]]
 +
*You want to start with a Java Project
 +
**A project can include many classes and other things
 +
*<u>F</u>ile / <u>N</u>ew / Project...
 +
*You want to start a Java Project
 +
<br clear=all>
 +
==New Project Wizard==
 +
[[Image:Eclipse_Project_Wizard.png|thumb]]
 +
*Set the Project Name to FirstProject (Use a capital for the first letter)
 +
*Pick Java Project to start with
 +
*Call your project FirstProject and check that you have at least 1.5 as the Execution Environment.
 +
**Note that 1.5 is often referred to as 5; similarly 1.7 is version 7.
 +
**The big changes happened at 1.5
 +
*You can just accept the defaults regarding file locations and perspectives.
 +
<br clear=all>
 +
==Java Perspective==
 +
[[Image:Eclipse_Java_Perspective.png|Make friends with this layout|thumb]]
 +
*You are now looking at the Java perspective – this is the arrangement of panes.
 +
*You are going to see this window a lot.
 +
*Your project files are listed in the '''Package Explorer''' on the left hand side
 +
<br clear=all>
 +
 
 +
==Java Perspective==
 +
[[Image:Eclipse_New_Class.png|Your new Class is Hello|thumb]]
 +
*File/New/Class
 +
*Call your class Hello use a capital H.
 +
*Tick public static void main…
 +
*You don’t want the other options
 +
<br clear=all>
 +
 
 +
==System.out.println==
 +
[[Image:Eclipse_Hello.png|Change main|thumb]]
 +
*Replace the TODO comment line with:
 +
System.out.println(42);
 +
*Click the green Run button to make it go.
 +
**You can also use: '''Ctrl F11'''
 +
<br clear=all>
 +
==Preferences==
 +
[[Image:Eclipse_preferences.png|Pick your font|thumb]]
 +
*There are an overwhelming number of preferences.
 +
*Select your favourite font from
 +
**Window/Preferences/General/Appearance/Colors and Fonts/Basic/Text Font
 +
*Variable width fonts work fine too.

Latest revision as of 15:00, 19 November 2013

See Hello Web with Tomcat when you have completed this.

Download Eclipse

Pick the EE (Enterprise Edition)


Unzip and make a shortcut

No install - just unzip it
  • There is no install - simply unzip it to a convenient locations (for example c:\)
  • You can start by double clicking eclipse.exe
  • You can make a shortcut on your desktop


Welcome Screen

Close this pane
  • Accept the default workspace and move on
  • The welcome screen can be closed - you will not need it again


New project

File New Project
  • You want to start with a Java Project
    • A project can include many classes and other things
  • File / New / Project...
  • You want to start a Java Project


New Project Wizard

Eclipse Project Wizard.png
  • Set the Project Name to FirstProject (Use a capital for the first letter)
  • Pick Java Project to start with
  • Call your project FirstProject and check that you have at least 1.5 as the Execution Environment.
    • Note that 1.5 is often referred to as 5; similarly 1.7 is version 7.
    • The big changes happened at 1.5
  • You can just accept the defaults regarding file locations and perspectives.


Java Perspective

Make friends with this layout
  • You are now looking at the Java perspective – this is the arrangement of panes.
  • You are going to see this window a lot.
  • Your project files are listed in the Package Explorer on the left hand side


Java Perspective

Your new Class is Hello
  • File/New/Class
  • Call your class Hello use a capital H.
  • Tick public static void main…
  • You don’t want the other options


System.out.println

Change main
  • Replace the TODO comment line with:
System.out.println(42);
  • Click the green Run button to make it go.
    • You can also use: Ctrl F11


Preferences

Pick your font
  • There are an overwhelming number of preferences.
  • Select your favourite font from
    • Window/Preferences/General/Appearance/Colors and Fonts/Basic/Text Font
  • Variable width fonts work fine too.