Netbeans BlueJ
BlueJ is a program for introducing how classes and
objects (instances of a class) work in Java.
http://www.bluej.org
Netbeans is an independent development environment
(IDE) used by professional Java programmers.
http://www.netbeans.org
Netbeans BlueJ is a version of Netbeans with a BlueJ
interface, so that students can move gradually from the
BlueJ interface to Netbeans.
http://www.bluej.org/netbeans/
or
http://edu.netbeans.org/bluej/
Viewing an existing project
Download the following file to your Desktop:
http://www.bluej.org/netbeans/tutorial/calculator.zip
Unzip the file.
Right click file
–
Open with
–
StuffIt Expander
Open Netbeans BlueJ.
Finder
–
Applications
–
SLIS
–
Unsupported
Open the 'calculator' folder on the Desktop as a
project.
File
–
Open project
–
browse to the 'calculator' folder and
single
-
click
it
–
Open Project Folder
The interfaces
Projects (Netbeans) vs. BlueJ
Views of the same files
Classes with main methods (i.e.,
runnable classes) have green
triangles on them
To run programs/projects:
right click classes with green
triangles and select 'run file'
OR click 'run main project'
To compile individual files, right click and select
'compile file'.
Classes that are out of date with their sources have
hatching on their icons (e.g., CalcEngine.java above).
To close a project:
BlueJ view: File
–
Close “calculator”
Netbeans: right click the project
–
Close Project
Your first project
File
–
New Project
BlueJ
–
Next
Give it a name, and select the folder where you
want the files to be stored.
File
–
New File
BlueJ
–
Class with main method
–
Next
Give it a name (first letter must be uppercase)
Insert your code in the main method. It creates
“Hello world” for you.
In pictures... “new project”
name the project
new file
name the file
write your code
And if you mess up...
When you save the file, it will auto
-
compile behind the scenes, and attempt
to guess where you made errors.
Its guesses are marked with red X boxes
(see next slide).
Why might the guesses not be perfect? (hint:
the compiler interprets the code left
-
to
-
right,
top
-
to
-
bottom)
Let's see what happens if we forget to
capitalize the class name and leave a
semicolon off of a println() statement.
Enter the password to open this PDF file:
File name:
-
File size:
-
Title:
-
Author:
-
Subject:
-
Keywords:
-
Creation Date:
-
Modification Date:
-
Creator:
-
PDF Producer:
-
PDF Version:
-
Page Count:
-
Preparing document for printing…
0%
Σχόλια 0
Συνδεθείτε για να κοινοποιήσετε σχόλιο