First Java Program With NetBeans
First Java Program With NetBeans
Computing Department
University of Surrey
Amir r Razavi
Contents
• Introduction
• Setting Up a Project
– Creating a new Java class library
– Creating a new Java application
– Configuring the compilation classpath
• Creating and Editing Java Source Code
– Creating a Java package and class file
– Editing a Java file
– Finding all usages of a class name
• Compiling and Running a Project
– Setting the main class and execution arguments
– Running the main project
• Modifying for Image Processing
Introduction
• Using NetBeans IDE
• Following the standard Java by
NetBeans
• Image Processing by NetBeans
• Free Full Software and Proper
Documentations and support
http://www.netbeans.org/
Creating a new Java class library
• Choose File > New Project (Ctrl-Shift-N).
Creating a new Java class library
• Press Alt-Shift-I to
create an import
statement for
org.me.mylib.LibCl
ass.
Editing a Java file
• Enter a period after LibClass. The code completion box opens
again. Select the acrostic method to see popup Javadoc for
the method. Enter the acrostic method with its default
argument: args, then type a closing parenthesis and
semicolon. The final line should look like this:
• String result = LibClass.acrostic(args);
Editing a Java file
• Press Enter to start a new
line. Then type sout and
press space. The sout
abbreviation expands to
System.out.println(""); with
the caret between the
quotation marks. Type
Result = inside the
quotation marks and +
result after the quotation
marks. The final line should
look like this:
System.out.println("Result = "
+ result);
Finding all usages of a class name
Setting the main class and execution
arguments
Running the main project
• Choose Run > Run Main Project (F6) from the Run menu. Double-
click the Output window to maximize it so you can see all the output.
Note that Ant builds MyLib.jar first and then compiles MyApp using it.
Finally, it prints the output from the program, Result = Hello (the
acrostic of the phrase that was passed to the program as an
argument).
Modifying for Image Processing
Modifying for Image Processing
Modifying for Image Processing
Modifying for Image Processing
Modifying for Image Processing