CSCI 701:

braintreesmileSoftware and s/w Development

Aug 15, 2012 (4 years and 8 months ago)

226 views

CSCI 3701: Advanced Object
-
Oriented Programming

Assignment 0: Using the Java SDK

and the NetBeans IDE


The purpose of this exercise is to introduce you to using the Java SDK (Software
Development Kit)
and the Netbeans IDE
on your home PC. There is nothing
to turn in or
to grade; however, doing this now will make things much easier when you do the first
assignment.


Installing

the Java SDK

and NetBeans IDE

You will first need to
install

the Java SDK (software development kit), which includes
the java compile
r, the run
-
time interpreter, and built
-
in class libraries.
This comes
bundled with the Netbeans IDE, a very useful platform for developing and testing Java
programs.


Go to the Sun page for downloading Java 1.
7

(and the NetBeans IDE)

at
http://www.oracle.com/technetwork/java/javase/downloads/index.html
.











Once this is done, you will see the usual things that happen when you install software. By
default, everythi
ng
related to Java
should be in the directory
C:
\
Program
Files
\
Java
\
jdk
javaversion
.
The NetBeans files will be in
C:
\
Program
Files
\
NetBeans
netbeansversion



Downloading and Viewing the Test Program with the
NetBeans IDE


NetBeans

is

a very nice IDE (integ
rated development environment) for creating and
testing Java programs. While it can generate some code automatically, we will not be
using that ability right now


until you know a lot more about Java, you won’t be able to
understand what is being generate
d.


There is a simple program on my web site (the same one we used in class) to make sure
everything works.


First, set up the NetBeans environment for the test:

1.

Open NetBeans. You can do this from the icon installed on your desktop (if you
chose to do th
is), or from
Programs



NetBeans 5.0



NetBeans IDE


2.

Select
File


New Project

from the top menu.

3.

This will open a window for defining project properties.


Choose
Java

as the category and
Java Application
as the project. Then press
Next
.


4.

The next window

allows you to choose the name and location of the project, and
the name of the main class.


Since the class on the web page is
Hello
,
type that
as the

project name

(this is
important). Note that under the “Main Class”, the name “hello.
Main
” will appear
(this is related to the package being created)
.


For the location, select some folder that you want to use for your work. Press
Finish
.


5.

At this point

you should have something that looks like the below. The window
on the right contains all of the code th
at has already been generated for you.


6.

Later on, when you know a bit more about the structure of Java classes, you will
actually use this code. For n
ow, however, just delete it all.



You can now load the
Main
.java
code from the web page into the IDE:

1.

O
pen the following link to the
Main.java

example.

2.

Select all
of the code in the example and
copy
it.

3.

Paste
the code into the right side of the NetBeans window:



You can now compil
e and run the code in the IDE:

1.

Select
Build Main Project

from the
Build
menu.

This will compile the application. If there are no errors, you will see the message
BUILD SUCESSFUL
in the bottom window.

2.

Select
Run Main Project

from the
Run
menu.

You should s
ee the following application on the screen:



Press the button and see what happens!