Using NetBeans to Compile and Run Java Programs



Similar documents
Using Eclipse to Run Java Programs

Junk Settings. Options

DEPLOYING A VISUAL BASIC.NET APPLICATION

Assigning owner rights over MS Exchange Server folders

Create a Web Service from a Java Bean Test a Web Service using a generated test client and the Web Services Explorer

OUTLOOK 2007 USER GUIDE

Netbeans IDE Tutorial for using the Weka API

E-Map Application CHAPTER. The E-Map Editor

Symantec Client Firewall Policy Migration Guide

Printer Sharing of the Brother QL-Series in a Windows Environment

How to Mail Merge PDF Documents

Subscribe to RSS in Outlook Find RSS Feeds. Exchange Outlook 2007 How To s / RSS Feeds 1of 7

SARANGSoft WinBackup Business v2.5 Client Installation Guide

Tutorial: Time Of Day Part 2 GUI Design in NetBeans

MS WORD 2007 (PC) Macros and Track Changes Please note the latest Macintosh version of MS Word does not have Macros.

Introduction: The Xcode templates are not available in Cordova or above, so we'll use the previous version, for this recipe.

Adding Outlook to a Blackberry, Downloading, Installing and Configuring Blackberry Desktop Manager

Tutorial: setting up a web application

Installing the Android SDK

Using an Automatic Back Up for Outlook 2003 and Outlook 2007 Personal Folders

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

Create, Link, or Edit a GPO with Active Directory Users and Computers

TERAcloud w w w. t e r a c l o u d. u k

Prepare your data in ArcGIS for Desktop

OLAP Cube Manual deployment and Error resolution with limited licenses and Config keys

Internet Address: cloud.ndcl.org

Moving Rockwell Software Activation Keys to the VersaView 200R Industrial Computer

About the To-Do Bar in Outlook 2007

Installing Primavera P6 Professional R8.2

Affiliated Provider Billing/Coding

Notepad++ The COMPSCI 101 Text Editor for Windows. What is a text editor? Install Python 3

SQL Server 2005: Report Builder

Pocket ESA Network Server Installation

PC Agent Quick Start. Open the Agent. Autonomy Connected Backup. Version 8.8. Revision 0

HELP DOCUMENTATION E-SSOM DEPLOYMENT GUIDE

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

Printer Sharing of the PT-9500pc in a Windows Environment

Virtual Office Remote Installation Guide

Configuring Thunderbird for Flinders Mail at home.

Learn how to create web enabled (browser) forms in InfoPath 2013 and publish them in SharePoint InfoPath 2013 Web Enabled (Browser) forms

QSF Creator Tool. Task Sheet. Logging Into Hosted Millennium

This Skill Builder demonstrates how to define and place sketched symbols in drawings.

Supplement I.B: Installing and Configuring JDK 1.6

Petrel TIPS&TRICKS from SCM

Installation of IR under Windows Server 2008

BSDI Advanced Fitness & Wellness Software

Detecting and Removing Spyware From Your Home Computer

What is a Mail Merge?

Tool Tip. SyAM Management Utilities and Non-Admin Domain Users

Backing up IMail Server using Altaro Backup FS

MANAGING OUTLOOK PERSONAL DATA FILES

Manual For Using the NetBeans IDE

ScanWin Installation and Windows 7-64 bit operating system

Pharmacy Affairs Branch. Website Database Downloads PUBLIC ACCESS GUIDE

NetBeans IDE Field Guide

Personal Geodatabase 101

Most of your tasks in Windows XP will involve working with information

Managing documents, files and folders

For example, you might want to create a folder to collect together all s relating to a particular project or subject.

Troubleshooting Guide. 2.2 Click the Tools menu on Windows Explorer 2.3 Click Folder Options. This will open a dialog box:

Office 365 Employee San Jac Outlook 2013

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

Staying Organized with the Outlook Journal

Trend Micro PC-cillin Internet Security 2006

Installing LearningBay Enterprise Part 2

Technical Bulletin. SQL Express Backup Utility

Basics. a. Click the arrow to the right of the Options button, and then click Bcc.

Kroll Mail Module. Contents

Olathe District Schools 1 of 11 GroupWise 7

HOW TO RETRIEVE FILES FROM THE TARGET ANALYTICS FTP SITE

Start A New Project with Keil Microcontroller Development Kit Version 5 and Freescale FRDM-KL25Z

Personalizing your Access Database with a Switchboard

Basics Managing Your Inbox

1/4/12 Installing and Configuring WebDAV on IIS 7 : WebDAV for IIS 7.0 : Publishing Content to Web Sites : T

Outlook 2007 EXPLORE THE OUTLOOK USER INTERFACE. Microsoft. Basic Tasks

How To Send An Encrypted In Outlook 2000 (For A Password Protected ) On A Pc Or Macintosh (For An Ipo) On Pc Or Ipo (For Pc Or For A Password Saf ) On An Iphone Or

Deploying BitDefender Client Security and BitDefender Windows Server Solutions

Business Objects InfoView Quick-start Guide

ELM Server Exchange Edition Virtual Archive Mailbox version 5.5

Symantec Enterprise Vault

DCOM Setup. User Manual

To add files to your , first create the . When you have opened a new

Auto-Archiving your s in Outlook

AXIS 1440 Print Server For EPSON Printers: Product Update. Important Information for Windows

Reference and Troubleshooting: FTP, IIS, and Firewall Information

SMS Database System Quick Start. [Version 1.0.3]

Secrets of Event Viewer for Active Directory Security Auditing Lepide Software

ArchiOffice/EngineerOffice-Microsoft Outlook Integration

Why Use Blackboard Content System to Store Documents One Time

etoken Enterprise For: SSL SSL with etoken

Laboratory 1 Initiating a Project

Frequently Asked Questions

Lesson 8: LMS Inventory Wizard

Creating a Distribution List from an Excel Spreadsheet

Lotus Notes Archive Guide

Transcription:

Using NetBeans to Compile and Run Java Programs This document is based on NetBeans 4.1 and 5.5. (The document has two sections. The first section covers NetBeans 5.5; the second section covers NetBeans 4.1. But really, the instructions for NetBeans 4.1 and NetBeans 5.5 are almost identical.) For information on other versions of NetBeans, contact the author via email: BeginProg2 at BurdBrain dot com. NetBeans 5.5 1. Download NetBeans by visiting http://www.netbeans.org. 2. Install the downloaded NetBeans program on your computer. 3. Run NetBeans by clicking the NetBeans icon. You see the NetBeans 5.5 opening screen. 4. Click Create New Project. 1

The New Project dialog appears. 5. In the Categories pane, select General, and in the Projects pane, select Java Application. 6. Click Next. The New Java Application dialog appears. 2

7. Unless you re fussy, you can accept whatever defaults you see in the Project Name, Project Location, and Project Folder fields. Leave Set as Main Project checked. But in this example, you should uncheck Create Main Class. 8. Click Finish. A new project tree appears in the NetBeans Projects window. 9. On the project tree, right-click the Source Package branch. In the resulting context menus, select New Java Class. 3

On a Macintosh, substitute Ctrl-Click for right-click. The New Java Class dialog appears. 4

10. In the Class Name field, type the name of the class that you want to create. In this example, I type MyFirstJavaClass, because I intend to run the code in Listing 3-1. The name of the Java source file is MyFirstJavaClass.java, but in the Class Name field, I type MyFirstJavaClass, without the.java extension. 11. Click Finish. The new class appears in the Projects window. Some skeletal code for the new class appears in the editor. 12. If you re creating code from scratch, you can type additional code in the editor. But if you re running an example from the book, copy that example s code, and paste the code into the NetBeans editor (replacing the skeletal code that s already in the editor). 5

13. On the main NetBeans menu, choose File Save. 14. In the NetBeans Projects window, right-click the current project branch. In the resulting context menu, select Set Main Project. On a Macintosh, substitute Ctrl-Click for right-click. 6

15. On the main NetBeans menu, choose Build Build Main Project. The output window shows a successful compilation. If the compilation isn t successful, make changes to the code in the editor window, and try compiling again. 16. In the Projects window, right-click the current project s branch. In the resulting context menu, select Properties. (On a Macintosh, substitute Ctrl-Click for right-click.) The Project Properties dialog appears. 7

17. On the left side of the Project Properties dialog, select Run. The fields on the right side change to include Main Class, Arguments, and so on. 8

18. In the Main Class field, type the name of the class that contains the main method. In this example, I type MyFirstJavaClass, because I intend to run the code in Listing 3-1. The name of the Java source file is MyFirstJavaClass.java, but in the Main Class field, I type MyFirstJavaClass, without the.java extension. 19. Click OK to dismiss the Project Properties dialog. 20. On the main NetBeans menu, choose Run Run Main Project. The program s output appears in the NetBeans Output window, and everybody is happy. 9

NetBeans 4.1 1. Download NetBeans by visiting http://www.netbeans.org. 2. Install the downloaded NetBeans program on your computer. 3. Run NetBeans by clicking the NetBeans icon. You see the NetBeans 4.1 opening screen. 4. Click New Project. The New Project dialog appears. 10

5. In the Categories pane, select General, and in the Projects pane, select Java Application. 6. Click Next. The New Java Application dialog appears. 11

7. Unless you re fussy, you can accept whatever defaults you see in the Project Name, Project Location, and Project Folder fields. Leave Set as Main Project checked. But in this example, you should uncheck Create Main Class. 8. Click Finish. A new project tree appears in the NetBeans Projects window. 12

9. On the project tree, right-click the Source Package branch. In the resulting context menus, select New Java Class. On a Macintosh, substitute Ctrl-Click for right-click. The New Java Class dialog appears. 13

10. In the Class Name field, type the name of the class that you want to create. In this example, I type MyFirstJavaClass, because I intend to run the code in Listing 3-1. The name of the Java source file is MyFirstJavaClass.java, but in the Class Name field, I type MyFirstJavaClass, without the.java extension. 11. Click Finish. The new class appears in the Projects window. Some skeletal code for the new class appears in the editor. 12. If you re creating code from scratch, you can type additional code in the editor. But if you re running an example from the book, copy that example s code, and paste the code into the NetBeans editor (replacing the skeletal code that s already in the editor). 14

13. On the main NetBeans menu, choose File Save. 14. In the NetBeans Projects window, right-click the current project branch. In the resulting context menu, select Set Main Project. On a Macintosh, substitute Ctrl-Click for right-click. 15

15. On the main NetBeans menu, choose Build Build Main Project. The output window shows a successful compilation. If the compilation isn t successful, make changes to the code in the editor window, and try compiling again. 16. In the Projects window, right-click the current project s branch. In the resulting context menu, select Properties. (On a Macintosh, substitute Ctrl-Click for right-click.) The Project Properties dialog appears. 16

17. On the left side of the Project Properties dialog, select Run. The fields on the right side change to include Main Class, Arguments, and so on. 17

18. In the Main Class field, type the name of the class that contains the main method. In this example, I type MyFirstJavaClass, because I intend to run the code in Listing 3-1. The name of the Java source file is MyFirstJavaClass.java, but in the Main Class field, I type MyFirstJavaClass, without the.java extension. 19. Click OK to dismiss the Project Properties dialog. 20. On the main NetBeans menu, choose Run Run Main Project. The program s output appears in the NetBeans Output window, and everybody is happy. 18