Download Assignment 0: Using the Java SDK and the NetBeans IDE

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
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 compiler, 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 8 (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, everything related to Java should be in the directory C:\Program
Files\Java\jdkjavaversion. 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 (integrated 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 generated.
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 this), 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.
4. Choose Java as the category and Java Application as the project. Then press
Next.
5. 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 Welcome, type that as the project name (this is
important). Note that under the “Main Class”, the name “welcome.Welcome”
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.
6. At this point you should have something that looks like the below. The window
on the right contains all of the code that has already been generated for you.
7. Later on, when you know a bit more about the structure of Java classes, you will
actually use this code. For now, however, just delete it all.
You can now load the Main.java code from the web page into the IDE:
1. Open the following link to the Welcome.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 compile 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 see the following application on the screen:
Press the button and see what happens!