Title: Hello World in the Forte IDE
1Hello World in the Forte IDE
- An introduction to the Forte IDE (integrated
development environment) writing the classic
Hello World program in Java
2Create a folder for your projects
- One way is to use Windows Explorer (WE)
- On the left-hand-side of WE, click on the
location where the folder is to be created - On the right-hand-side of WE, right click in the
open area and choose from the menu New and then
Folder
3Create a New Folder
4Rename the FolderRight click on the Folder and
choose Rename, then type the name, press ENTER
5Start ForteStart/Programs/Forte for Java CE/
Forte for Java CE
6Start Forte (Alternative)Double click on the
runidew icon found in forte4j/bin
7Close Tip Window(if it appears)
8Forte at Startup
Main window menus and toolbars
Explorer window
Properties window
Desktop showing through
Filesystems, see next slide
9Right click on Filesystems (circled on previous
slide) in the Explorer Window
Choose Mount Directory from the menu
10The Mount Directory Dialog Box
11Use the Mount Directory Look in drop-down box
to choose a drive and the region below to select
a folder
12Alternative Choose File then Mount Filesystem on
the Main Window menu to bring up the dialog box
shown below
Type the folders path or Browse for it , then
click OK
13To remove any previous Filesystem, right click on
it and choose Unmount Filesystem
14Java Packages
- In order to facilitate portability (moving a
program from computer to computer), Java breaks
references to a files (complete/full) path (its
location) into two parts - An external part (known as the CLASSPATH) which
will change as the program is moved around
(mounted) - An internal part which will not change as the
program is moved around (package.class) - The dividing line is a folder known as a package
15To create a package for your project, right click
on the particular filesystem and choose New
Package
16Name the packageNOTE Javas convention is that
only class names are capitalized, Java is case
sensitive hello ? Hello
small letter
17Make your package part of current project (click
Yes)
18Right click on package folder, select
New/Classes/Main
This template (Main) has a method (main) needed
to start execution
19Name your classJava convention is that class
name are capitalized
Capital letter
20Finish
- For the simple Hello World project in this
example, one might as well click Finish at this
stage - However, we will step through a series of dialog
boxes that may prove useful when writing future
projects
21Dialog Box 1
Click Next
22Dialog Box 2
23Dialog box 3
Most classes have fields (or properties) and we
could begin to list them here
24Dialog box 4
Classes also have methods which could be added
here
25Make class part of current project
26The Source Editor Window appears.This is where
we will type the code.Some code is already
provided.
27Source editor
comments
package
Beginning of class
28Some features
- Comment anything between / and / is a
comment they are ignored by the computer and
are there for the sake of the programmer or
anyone else reading the code - The Hello class begins with the line
- public class Hello extends Object
- public, class and extends are keywords or
reserved words, which is why they are in a
different color
29Hello World
- For this simple program, we will add just one
line to what was supplied by the IDE - That line is
- System.out.println(Hello World.)
- It belongs inside the curly brackets associated
with the main method - Curly brackets set off a unit of coding known
as a block
30The main method
Constructor, not needed for this program
the main method
31Indenting scheme convention
- Free-formatting white space (spaces, tabs,
returns) are usually ignored by the computer when
interpreting Java - To make the program more readable (not to the
computer but to the human beings), certain
conventions are followed - One convention is to place the curly brackets on
a line by themselves and have them vertically
aligned (indented the same amount) and then
anything within the curly brackets is indented
further
32Start typing the lineAfter typing the period,
notice the pop-up menus
33Java is case-sensitive
- Java is case-sensitive
- In the one line, System (a class) must be
capitalized, out (an object) must not be
capitalized - The pop-up menus provide the properties and
methods associated with a class or object - If they do not pop up, it is a good indication
that there is a typo
34Hello World Program
35Right click on Hello (the class not the package)
and choose Compile
36The Output Window appears if there are errors
In this case there is a missing semicolon
Error reported on line 28 although line with
missing semicolon is line 27 (free formatting)
37Edit (add semicolon), Compile again, then
Execute Right click on class and choose Execute
38Output Window
39Execution Shortcut
40Build and Compile Shortcuts
41Windows Explorer