Manual For Using the NetBeans IDE

Similar documents
LAB 1. Familiarization of Rational Rose Environment And UML for small Java Application Development

Using Eclipse to Run Java Programs

enter the administrator user name and password for that domain.

Installing Java 5.0 and Eclipse on Mac OS X

Using NetBeans to Compile and Run Java Programs

Java Software Development Kit (JDK 5.0 Update 14) Installation Step by Step Instructions

Installing Java. Table of contents

Lab: Data Backup and Recovery in Windows XP

How to use the Eclipse IDE for Java Application Development

Appendix A Using the Java Compiler

How to Configure Windows 8.1 to run ereports on IE11

ICP Data Entry Module Training document. HHC Data Entry Module Training Document

Lab - Data Backup and Recovery in Windows XP

Virtual Office Remote Installation Guide

Downloading and Installing Core FTP

Introduction to the use of the environment of Microsoft Visual Studio 2008

DEVELOPING CONTRACT - DRIVEN WEB SERVICES USING JDEVELOPER. The purpose of this tutorial is to develop a java web service using a top-down approach.

Training module 2 Installing VMware View

Business Objects InfoView Quick-start Guide

Internet Address: cloud.ndcl.org

LAB4 Making Classes and Objects

Lesson 1 - Creating a C18 Project with MPLAB

How To Access The Outlook Help Desk In Outlook.Com

Blackboard Collaborate Introduction & Handbook

Rational Application Developer v7.0 (RAD7) trial version. Installation guide

Installing and using XAMPP with NetBeans PHP

Testing your Linux Virtual Box

Copy Documents from your Computer (H Drive) to a Flash Drive

Installing the Android SDK

WA1826 Designing Cloud Computing Solutions. Classroom Setup Guide. Web Age Solutions Inc. Copyright Web Age Solutions Inc. 1

To begin, visit this URL:

3 IDE (Integrated Development Environment)

Java with Eclipse: Setup & Getting Started

HHC Compensation Module Training Document

2 Getting Started with jgrasp 2.0

Java CPD (I) Frans Coenen Department of Computer Science

INSTALLATION INSTRUCTIONS FOR UKSSOGATEWAY

Install FileZilla Client. Connecting to an FTP server

Student Getting Started Guide

Week 2 Practical Objects and Turtles

DOCUMENT MANAGEMENT SYSTEM

Introduction to Android Development

CDUfiles User Guide. Chapter 1: Accessing your data with CDUfiles. Sign In. CDUfiles User Guide Page 1. Here are the first steps to using CDUfiles.

L.E.A.P.S Electronic Freight Billing System Installation Guide

Introduction to MS WINDOWS XP

Netbeans IDE Tutorial for using the Weka API

Creating a Poster in PowerPoint A. Set Up Your Poster

SMARTstuff. The first rule for using an interactive whiteboard is very simple and of the utmost importance: Have faith in yourself you can do this!

The goal with this tutorial is to show how to implement and use the Selenium testing framework.

BSDI Advanced Fitness & Wellness Software

For Introduction to Java Programming, 5E By Y. Daniel Liang

These instructions were tested on OS X Earlier or later versions may have slight or major differences in how things work and appear.

Introduction to Macromedia Dreamweaver MX

QClaims Launch Instructions for Windows

Pacesetter BES Lettering Installation Guide

Hypercosm. Studio.

Quick Guide. Passports in Microsoft PowerPoint. Getting Started with PowerPoint. Locating the PowerPoint Folder (PC) Locating PowerPoint (Mac)

CS170 Lab 11 Abstract Data Types & Objects

First Java Programs. V. Paúl Pauca. CSC 111D Fall, Department of Computer Science Wake Forest University. Introduction to Computer Science

How To Use Ticket Validation Software On A Pc Or Mac Or Macbook Or Ipad (For Acedo) On A Computer Or Ipa (For An Ipa) On An Ipad Or Macintosh (For Macintosh) On Pc

Pharmacy Affairs Branch. Website Database Downloads PUBLIC ACCESS GUIDE

ELECTRONIC DATA PROCESSOR (EDP) QUICKSTART FOR DATA PROVIDERS

Optional Lab: Data Backup and Recovery in Windows 7

MiraCosta College now offers two ways to access your student virtual desktop.

Microsoft FrontPage 2003

Appendix K Introduction to Microsoft Visual C++ 6.0

1. To ensure the appropriate level of security, you will need Microsoft Windows XP or above.

INTRODUCTION TO COMPUTER CONCEPTS CSIT 100 LAB: MICROSOFT POWERPOINT

Angel Learning Management System Introductory Tutorial for Students

Download and Installation Instructions. Java JDK Software for Windows

JAVS Scheduled Publishing. Installation/Configuration... 4 Manual Operation... 6 Automating Scheduled Publishing... 7 Windows XP... 7 Windows 7...

Online Sharing User Manual

Supplement I.B: Installing and Configuring JDK 1.6

BID2WIN Workshop. Advanced Report Writing

How to Create a PDF Document

File Management Using Microsoft Windows

Installing a printer in Windows 95.

How To Download Nvision Reports In Awnsoft Peoplesoft Report Manager And Nvision Operating Reports In Excel

VMWare Workstation 11 Installation MICROSOFT WINDOWS SERVER 2008 R2 STANDARD ENTERPRISE ED.

Creating a Web Site with Publisher 2010

Software Development Environment. Installation Guide

First Time On-Campus VLab Setup Windows XP Edition

Lab - Data Backup and Recovery in Windows 7

Tutorial 4 - Attribute data in ArcGIS

HOW TO USE THE File Transfer Protocol SERVER ftp.architekturaibiznes.com.pl

First Bytes Programming Lab 2

Creating Personal Web Sites Using SharePoint Designer 2007

Gaggle Account How-To. How do I login to my Gaggle Account? To login, follow these steps: Go to:

WA1791 Designing and Developing Secure Web Services. Classroom Setup Guide. Web Age Solutions Inc. Web Age Solutions Inc. 1

Creating Your Own TinyWeb Database. Ball State University - CS116 - Ashley Swartz

Using the SAS Enterprise Guide (Version 4.2)

Installing LearningBay Enterprise Part 2

Download and Installation Instructions. Android SDK and Android Development Tools (ADT)

Optional Lab: Data Backup and Recovery in Windows Vista

Microsoft Security Essentials Installation and Configuration Guide

Creating a Web Service using IBM Rational HATS. For IBM System i (5250) Creating a Web Service using HATS 1

Getting Started using the SQuirreL SQL Client

Transcription:

1 Manual For Using the NetBeans IDE The content of this document is designed to help you to understand and to use the NetBeans IDE for your Java programming assignments. This is only an introductory presentation, and is no way intended for any professional or commercial use. It is geared especially for those students who have little or no knowledge of NetBeans and its use. 1

2 TABLE OF CONTENTS DOWNLOAD JDK(SDK) AND NETBEANS... 3 LOCATE NETBEANS... 5 LOAD NETBEANS... 5 NAVIGATING THE NETBEANS WINDOW.... 7 CREATING A PROJECT/FOLDER... 9 CREATING A JAVA FILE...13 COMPILING A JAVA FILE...15 CREATING A TEST CLASS...16 EXECUTING A JAVA FILE...17 EXERCISES...18 2

3 Download JDK(SDK) and NetBeans In order to compile and execute your Java program, you need the Java compiler, first and foremost. You can download it from the web at oracle.com at no cost to you. Secondly you will need an editor which will use to compose the program. We have chosen the program NetBeans, though other programs such JCreator could. NetBeans is more than Just an editor. It is what is called an Integrated Development Environment (IDE, as it is popularly called) is a suite of programs that comes packaged as one unit that enables programmers to develop application software. It comes with a source editor which you will use to create and edit the program that is being developed; a translator which compiles, executes the program; and, a debugger that helps to test and track errors in the program. Go to the netbeans website at: http://netbeans.org/downloads/ 3

4 4

5 Locate NetBeans Figure 1 shows a screen shot of my desktop. The last icon in the row of icons represents the NetBeans program. Locate it on your screen and point the mouse on it. Figure 1 Locate the NetBean icon. Load NetBeans Once you have located the NetBeans icon by placing your point on it, double click on the icon to load NetBeans. Waite a while and you ll observe the NetBeans screen appears. It looks similar to Figure 2. Figure 2 The NetBeans Program being loaded. 5

6 In its setting up, your will see a window appears, with a small window inset similar to Figure 3. Inside the small window you will notice a slider moving across. This is indicating that the NetBeans program is still being loaded into the memory of your computer. Wait. Figure 3 NetBeans is Being Loaded. Once NetBeans is loaded the smaller window disappears and the larger one remains. Your screen should look similar to Figure 4. This is the window that you will be using to: (a) Type/edit your Java program. (b) Compile your program, and (c) Execute your program. Figure 4 The NetBeans Environment 6

7 Navigating The NetBeans Window. Referring to Figure 4 notice that the screen is divided into various areas. There are three (3) rows of information and three sub screens/windows. The first row tells us among other things, the name of the Program. In this case NetBeans IDE 4.1 (Yours might be an updated version say 5.10 or so). The second row is a menu showing the different tasks that you can perform. The first option is File. Click on it and you will see as in Figure 5 the different options for handling your Java program file(s). Figure 5. The File Menu. The File menu allows you, among other things, to: (a) Create a new project (directories in which to store your Java files) (b) Create a new Java source file; or (c) Open an existing project, or (d) Open an existing Java file. If you slide the mouse across the menu, to Edit and click on it, you will see the activities (in grey) that can be done when editing a Java file. See Figure 6. 7

8 Figure 6 The Edit menu Chief among the activities that you can perform are: (a) Copy a piece of text, and (b) Paste a piece of text that was copied. Next, move the mouse over to the menu choice Build. This is another option that you will be using frequently. See Figure 7. In grey you see the menu item marked Compile File. This is the option that you will choose when you want to compile your Java program. Figure 7 The Build Menu. 8

9 Lastly, move the mouse over to the menu choice mark Run. See Figure 8. Figure 8 The Run menu. This is the option that you will use when you want to execute your Java program. Point on Run you will see sub menu Run File. At this point you will not be able to see anything more since we do not have an active file to run. The third row of menu choices contains icons for many of the menu choices in the second row. You may explore these at your own pace. Look back at Figure 4 we see three rectangular windows. The window marked Projects is the area which shows us the Java files, among other things, that are in the Project/folder that you are currently working with. The window to the right of it is where you will compose/edit your Java files; and the window that is marked Output shows: (a) The state of your Java program when it is compiling, (b) The state of it when it is executing (running), and (c) Any output generated from your program. Creating a Project/Folder Whenever you are about to write a Java program using NetBeans, one of the first things that NetBeans requires you to do is to create a folder in which to place all the Java files for your application. NetBeans calls the folder a Project. So you must create a project in which to place your Java files. To create a Project do the following: (a) Select File New Project. You will get a screen similar to Figure 9. 9

10 Figure 9 Creating a new Project. (b) Using Figure 9, select General Java Application, and click Next. (c) Go to menu item Project Location. Click on the Browse button, and select the disk drive and directory where you want your project to be stored. You will get a new window, similar to Figure 10. When you have decided on the folder where you want to create your project, click on it, and then click Open. In my case I selected drive D, and directory computer science 2006. Next click on the Open button to confirm the selection. Figure 10. Locating Disk Drive and Directory in which to create Project. 10

11 By now you should get a new screen similar to Figure 11. Notice that the Project Location field and the Project Folder field are filled in for you automatically. Figure 11 Fields are automatically filled in. (d) Next, in the text field marked Project Name, ignore whatever the default name is and type your own project name. In my case I call it Understanding NetBeans. See Figure 12. Notice that NetBeans fill in your project name at the field Project Folder also. 11

12 Figure 12 Filling in Project Name (e) Because you want to have control over the things that you do in your Project, uncheck the selections marked: Set as Main Project, and Create Main class See Figure 13. Figure 13 Uncheck items Set as Main Project and Create Main Class (f) Click the button marked Finish. Wait a while. You should have a screen similar to Figure 14. 12

13 Figure 14 The Project has been Created. Creating a Java File To create a java program file do the following (a) Using Figure 14, select File New File. See Figure 15. Figure 15 Creating a Java File. (b) On the new window, Figure 15, select Categories: Java Classes and File Types: Empty Java File. See Figure 16, and click the Next button. 13

14 Figure 16 Selecting File Category and File Type. (c) Enter the name of the java class file you wish to develop, and press the Finish button. You should see a screen similar to Figure 17. In my case I name the file Book. NetBeans will automatically append.java to the name of the file you supplied. In this case, Book.java. Figure 17. Namethe Java file Book (d) This empty window Figure 18 is the window in which you will type a single Java class file. There is another way to create a new window, but stick with this format for now. 14

15 Figure 18 An empty window in which to type a single Java file. (e) Type the definition for the class called Book.java. In this exercise a book has a title, the isbn, and a price associated with it. See Figure 19. Figure 19 Typing the Java file called Book. Compiling a Java File Go to the menu in the second row of the NetBeans window and select Build Compile Book.java. See Figure 20. 15

16 Figure 20. Locating the Compile option. When you click on this option, you are submitting your Java program to the Java compiler to compile your class (Book.java) in this case. If the program is compiled successfully the window marked Output should be similar to Figure 21. Figure 21. Compiling Java program file Book.java successfully Creating A Test Class Our next task it to write the test class. Select the option File New File. Follow steps (a) to (e). I call my new class TestBook. See Figure 22. 16

17 Figure 22 Writing a Test class. Next, compile the code for TestBook.java. Follow similar steps as in the previous case for the class Book.java. Executing a Java File You can only run a program that has a main method, like class Test.java. To run you program select Run Run File Run TestBook.java. On doing so, you should get a screen similar to Figure 23. Figure 23 Locating the option to Run/Execute a Java program. After you have clicked on the option your screen should look similar to Figure 24. 17

18 Figure 24. The result of Executing the Program. Once this is done, the program runs, you get an output similar to what you see in the window marked Output of Figure 24. See the exercise at the end of this manual. Create a workspace called test01, type the two classes in the same folder but store them in separate files - Book.java and TestBook.java. Compile Book.java first, then TestBook.java. Execute TestBook.java, both files will be executed. Exercises 1. Type the following source code and save it in a file called Book.java public class Book { private String name, isbn; private double price; public Book(String n, String isb, double cost) { name = n; isbn = isb; price = cost; } public String getname() { return name; } public String getisbn() 18

19 { } return isbn; } public double getprice() { return price; } 2. Compile the code 3. Type the following source code and save it in a file called TestBook.java public class TestBook { public static void main(string arg[]) { Book b = new Book("High Road To Programming", "100-00-999", 125.50); } } System.out.println(); System.out.println("Name of book: " + b.getname()); System.out.println("The ISBN is : " + b.getisbn()); System.out.println("The price is : $" + b.getprice()); System.out.println(); 4. Compile the code 5. Execute the program 6. Show result to your lab instructor. The End 19