The NetBeans IDE - YSU Computer Science & Information Systems

advertisement
The NetBeans IDE
CSIS 3701: Advanced Object Oriented Programming
Integrated Development Environment
• Single environment with tools for:
– Generating and editing source code
– Compiling and executing code
– Testing and debugging code
• NetBeans IDE for Java
– Available with Java from Sun (http://java.sun.com )
– Available separately from http://www.netbeans.org
– See “Homework 0” on course web site for more
details
NetBeans Organization
• Applications organized into projects
– Contains all files associated with application
(source code, executables, testing, etc.)
• Projects contain packages
– Groups of related files (like C++ libraries)
• Packages contain individual files
– Each class in own file
– Class is application if contains a main function
(can be executed in standalone mode)
Creating Projects
• Select File  New Project
Creating Projects
• Choose Java as category and then Java Application
Creating Projects
• Give basic information about project
– Project name
– Where stored on computer
Automatically
creates a “main”
class with same
name as project
Basic Project Structure
• Project listed on left
• Contains packages for that project
By default package with same
name as project automatically
created under Source Packages
• Package contains main class
defined when project created
• Will see other packages besides
source packages later (testing,
etc.)
Editing a Class
• Source code written and edited in IDE
• Color coded by type:
–
–
–
–
Keywords blue
Identifiers green
Strings orange
Comments grey
Editing a Class
• Automatically checks syntax of class after every change
• Syntax errors highlighted in red
• Hints available on rollover
Compiling and Running a Project
• Can compile (“build”) and run from Run menu
– Running automatically saves and compiles project
– Can use shortcut
Running a Project
• Code executed starting in main method of the main class
• GUI output popped up in
separate window
• Text written to standard output displayed in “Output” tab
on bottom of NetBeans window
Download