1 Development Environments AUBG, COS dept Lecture Title: Dev Env: NetBeans (Extract from Syllabus) Reference: www.netbeans.org.

Slides:



Advertisements
Similar presentations
Introduction to Eclipse. Start Eclipse Click and then click Eclipse from the menu: Or open a shell and type eclipse after the prompt.
Advertisements

Stored procedures and views You can see definitions for stored procedures and views in the demo databases but you can’t change them. For views, expand.
Professional Toolkit V2.0 C:\Presentations - SmartCafe_Prof_V2.0 - bsc page 1 Professional Toolkit 2.0.
Using Eclipse. Getting Started There are three ways to create a Java project: 1:Select File > New > Project, 2 Select the arrow of the button in the upper.
© by Pearson Education, Inc. All Rights Reserved.
Java Integrated Development Environments: ECLIPSE Part1 Installation.
Presented by IBM developer Works ibm.com/developerworks/ 2006 January – April © 2006 IBM Corporation. Making the most of The Java Development Tools project.
Introduction to Java A lab course by Dr. Junaid Ahmed Zubairi SUNY Fredonia.
C# Programming: From Problem Analysis to Program Design1 2 Your First C# Program.
CS1020: Intro Workshop. Topics CS1020Intro Workshop Login to UNIX operating system 2. …………………………………… 3. …………………………………… 4. …………………………………… 5. ……………………………………
Eclipse IDE. 2 IDE Overview An IDE is an Interactive Development Environment Different IDEs meet different needs BlueJ and DrJava are designed as teaching.
03 Using Eclipse. 2 IDE Overview An IDE is an Interactive Development Environment Different IDEs meet different needs BlueJ and DrJava are designed as.
Introduction to ArcGIS Add-Ins Exercises GIS/LIS Conference, 2014 Rochester, MN.
TrendReader Standard 2 This generation of TrendReader Standard software utilizes the more familiar Windows format (“tree”) views of functions and file.
A First Program Using C#
Chapter 4 Code Editor Goals and Objectives Program more efficiently? How can you speed up your development process? Do you want to learn useful shortcuts.
From BlueJ to NetBeans SWC 2.semester.
How to Download and Install a Sharp Print Driver on a Mac.
COS120 Software Development Using C++ AUBG Fall semester 2010 Ref book: Problem Solving, Abstraction and Design Using C++ Authors: Frank Friedman, Elliot.
Advanced Forms Lesson 10.
11 Getting Started with C# Chapter Objectives You will be able to: 1. Say in general terms how C# differs from C. 2. Create, compile, and run a.
1 INF160 IS Development Environments AUBG, COS dept Lecture 06 Title: Dev Env: Code::Blocks (Extract from Syllabus) Reference:
The NetBeans IDE CSIS 3701: Advanced Object Oriented Programming.
JLabel, JTextField, JButton and JOptionPane
Fundamentals of Java.  Explain the structure of a Java class  List and explain steps to write a Java program  Identify the benefits of NetBeans IDE.
Using Eclipse. What is Eclipse? The Eclipse Platform is an open source IDE (Integrated Development Environment), created by IBM for developing Java programs.
Arc: AddIns Dr Andy Evans. Java Direct access to ArcObjects Framework inside and outside Arc. Ability to add components to the GUI. Ability to communicate.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved. 1 2 Welcome Application Introducing the Visual Basic 2008 Express Edition IDE.
Author: Loh Jianxiong Christopher Editors: Chua Jie Sheng, Li Mengran, Peh Shao Hong, Oo Theong Siang.
1 Development Environments AUBG, COS dept Lecture Title: Dev Env: Eclipse (Extract from Syllabus) Reference:
Introduction to Arrays. definitions and things to consider… This presentation is designed to give a simple demonstration of array and object visualizations.
10/10/2015Assoc. Prof. Stoyan Bonev1 COS240 O-O Languages AUBG, COS dept Lecture 10b Title: Running Programs & IDEs (Java) Reference: COS240 Syllabus.
UCSC All rights reserved. No part of this material may be reproduced and sold. 1 IT1202-Fundamentals Of Programming (Using JAVA) Interacting with.
Lesson 1 The Java World AUBG ICoSCIS Team Assoc. Prof. Stoyan Bonev March, , 2013 SWU, Blagoevgrad.
© 2005 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. Data Structures for Java William H. Ford William R. Topp Appendix E The EZJava.
POS 406 Java Technology And Beginning Java Code
Programming Concept Chapter I Introduction to Java Programming.
Clement Allen, PhD Florida A&M University SUMMER 2006.
Introduction to Eclipse CSC 216 Lecture 3 Ed Gehringer Using (with permission) slides developed by— Dwight Deugo Nesa Matic
How to Run a Java Program CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
1 INF160 IS Development Environments AUBG, COS dept Lecture 06 Title: Dev Env: Visual Studio (Extract from Syllabus) Reference:
How to Run a Java Program CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
Lecture 6: Computer Languages. Programming Environments (IDE) COS120 Software Development Using C++ AUBG, COS dept.
Microsoft Office Outlook 2013 Microsoft Office Outlook 2013 Courseware # 3252 Lesson 6: Organizing Information.
McGraw-Hill © 2009 The McGraw-Hill Companies, Inc. All rights reserved. Chapter 6 Multiform Projects.
Unit 1: Java and Eclipse The Eclipse Development Environment.
Creating and running a Java program. Eclipse Interactive Development Environment (IDE)  Eclipse is an Interactive Development Environment (IDE) for Java.
9/2/ CS171 -Math & Computer Science Department at Emory University.
Programming Fundamentals 2: Simple/ F II Objectives – –give some simple examples of Java applications and one applet 2. Simple Java.
1 CSC 222: Object-Oriented Programming Spring 2012 netBeans & GUIBuilder  netBeans IDE create/edit/run a project  GUIBuilder JFrame, JButton, JTextField,
Introduction to Processing. 2 What is processing? A simple programming environment that was created to make it easier to develop visually oriented applications.
Core Java Introduction Byju Veedu Ness Technologies httpdownload.oracle.com/javase/tutorial/getStarted/intro/definition.html.
Trinity College Dublin, The University of Dublin GE3M25: Computer Programming for Biologists Python Karsten Hokamp, PhD Genetics TCD, 03/11/2015.
1 Class 1 Lecture Topic Concepts, Definitions and Examples.
introductory lecture on java programming
Lecture Set 2 Part A: Creating an Application with Visual Studio – Solutions, Projects, Files 8/10/ :35 PM.
IE 411/511: Visual Programming for Industrial Applications Lecture Notes #2 Introduction to the Visual Basic Express 2010 Integrated Development Environment.
Netbeans QuickStart. Creating a project File->New Project –For now you want General->Java Application –Then fill in the project details.
1 Development Environments AUBG, COS dept Lecture Title: Dev Env: BlueJ (Extract from Syllabus) Reference:
Part 1 Learning Objectives To understand that variables are a temporary named location to store data and that programmers work with different data types.
CS 201 Lecture 1 (b) Using an IDE Tarik Booker CS 201: Introduction to Programming California State University, Los Angeles.
SESSION 1 Introduction in Java. Objectives Introduce classes and objects Starting with Java Introduce JDK Writing a simple Java program Using comments.
Author: Loh Jianxiong Christopher Contributions: Chua Jie Sheng, Li Mengran, Peh Shao Hong, Oo Theong Siang, Tong Chun Kit, Tania Chattopadhyay.
Running Programs & IDEs Reference: COS240 Syllabus
Some Tips for Using Eclipse
How to Run a Java Program
How to Run a Java Program
Using Eclipse.
Developing Java Applications with NetBeans
Developing Java Applications with NetBeans
Presentation transcript:

1 Development Environments AUBG, COS dept Lecture Title: Dev Env: NetBeans (Extract from Syllabus) Reference:

2 Lecture Contents: §NetBeans – introduction §NetBeans – functionality l NetBeans IDE Java Quick Start Tutorial ( l Introduction to GUI Building ( functionality.html) §NetBeans – configuration

3 NetBeans – Introduction §NetBeans refers to both l NetBeans Platform l NetBeans IDE §NetBeans Platform is a reusable framework for simplifying the development of Java Swing desktop applications. §NetBeans IDE is an open-source integrated development environment that supports development of all Java application types.

4 NetBeans – introduction §Currently installed NetBeans IDE version §Develop desktop, mobile and web applications with Java, PHP, C/C++ and more. §Runs on Windows, Linux, Mac OS X and Solaris.

5 NetBeans – functionality NetBeans IDE Java Quick Start §Setting up the project l To Create an IDE project §Adding Code to the Generated Source File §Compiling and running a project §Building and deploying the application (.jar file) §Create javadoc §Packaging and Distributing Java Desktop Applications §Tips for NetBeans users

6 Setting Up the Project §.§.

7 To create an IDE project: §1. Start NetBeans IDE. §2. In the IDE, choose File > New Project… (Ctrl+Shift+N), as shown in the figure below.

8 To create an IDE project: §3. In the New Project wizard, expand the Java category and select Java Application as shown in the figure below. Then click Next.

9 To create an IDE project: §4. In the Name and Location page of the wizard, do the following (as shown in the figure above): l In the Project Name field, type on your choice. l Leave the Use Dedicated Folder for Storing Libraries checkbox unselected. l In the Create Main Class field, type. on your choice (if it is empty). l Leave the Set as Main Project checkbox selected.

10 To create an IDE project: §5. Click Finish. The project is created and opened in the IDE. You should see the following components: l The Projects window, which contains a tree view of the components of the project, including source files, libraries that your code depends on, and so on. l The Source Editor window with a file called.java open. l The Navigator window, which you can use to quickly navigate between elements within the selected class. l The Tasks window, which lists compilation errors as well other tasks that are marked with keywords.

11 Adding Code to the Generated Source File §Because you have left the Create Main Class checkbox selected in the New Project wizard, the IDE has created a skeleton main class for you. You can add the "Hello World!" message to the skeleton code by replacing the line: // TODO code application logic here with the line: System.out.println("Hello World!"); §Save the change by choosing File > Save. §The file should look something like the following code sample.

12 Adding Code to the Generated Source File /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package helloworldapp; /** * */ public class HelloWorldApp { /** args the command line arguments */ public static void main(String[] args) { System.out.println("Hello World!"); }

13 Compiling and running a project §Because of the IDE's Compile on Save feature, you do not have to manually compile your project in order to run it in the IDE. When you save a Java source file, the IDE automatically compiles it. (how to switch this option off, see Project > Properties > Compiling). §To run the program: l Choose Run > Run Main Project (F6). l The next figure shows what you should now see. l Congratulations! Your program works.

14 Compiling and running a project

15 Compiling and running a project §If there are compilation errors, they are marked with red glyphs in the left and right margins of the Source Editor. l The glyphs in the left margin indicate errors for the corresponding lines. l The glyphs in the right margin show all of the areas of the file that have errors, including errors in lines that are not visible. §You can mouse over an error mark to get a description of the error. §You can click a glyph in the right margin to jump to the line with the error.

16 Compiling and running a project §Here are more options to process the project: §To test the program: l Choose Run > Test Project( ) (Alt+F6) l Try the command to know what you should now see. l Open the Output window (if it is closed) and have a look at the report generated in it.

17 Compiling and running a project §Here are more options to process the project: §To build only (without run) the program: l Choose Run > Build Main Project (F11) l Try the command to know what you should now see. l Open the Output window (if it is closed) and have a look at the report generated in it.

18 Compiling and running a project §Here are more options to process the project: §To duplicate the recent command given: l Choose Run > Repeat Build/Run: (jar) l Try the command to know what you should now see. l Open the Output window (if it is closed) and have a look at the report generated in it.

19 Compiling and running a project §Here are more options to process the project: §To establish project settings: l Click right mouse btn on Project name, select Properties OR l Choose Run > Set project configuration > Customize… l Try the command to know what you should now see. l Project Properties screen gets opened – you are free to manipulate/establish/modify current project parameters.

20 Compiling and running a project §Here are more options to process the project: §To establish Main project settings: l Click right mouse btn Project name, select Set as Main project OR l Choose Run > Set Main project > None Select among all projects for the current NetBeans session l Try the command to know what you should now see. l List of existing projects gets displayed and you are to select/set the main project for the current session.

21 Compiling and running a project §Here are more options to process the project: §To create archive (.jar) file for the program: l Choose Run > Clean and Build Main Project (Shift+F11) l Try the command to know what you should now see. l Open the Output window (if it is closed) and have a look at the report generated in it. l For details see next slide.

22 Building and deploying the application (.jar file) §Once you have written and test run your application, you can use the Clean and Build command to build your application for deployment. When you use the Clean and Build command, the IDE runs a build script that performs the following tasks: l Deletes any previously compiled files and other build outputs. l Recompiles the application and builds a JAR file containing the compiled files. §To build your application: l Choose Run > Clean and Build Main Project (Shift+F11) §You can view the build outputs by opening the Files window and expanding the node. The compiled bytecode file.class is within the build/classes/ subnode. A deployable JAR file that contains the.class is within the dist node.

23 Building and deploying the application (.jar file)..

24 Create javadoc §To be discussed in separate lecture on SW Documentation.

25 Packaging and Distributing Java Desktop Applications One question that a lot of beginning programmers have is: "Now that I've created my application in the IDE, how do I get it to work from the command line outside of the IDE." Similarly, someone might ask, "How do I distribute this application to other users without having to give them the whole IDE as well?" The answers to these questions are relatively simple, but not necessarily obvious. This document addresses those questions by taking you through the basics of using the IDE to prepare your applications for distribution and deployment. In addition, this document provides information that you might need to configure your system (or which you might need to pass on to the users of your application). We will show a few different approaches for deploying an application, so that users can access the application by: Double-clicking the application's Java Archive (JAR) file. Calling the application from the command line. Calling the application from a script file. Using Java Web Start

26 Tips for NetBeans users §The Compile on Save feature can be turned off in the Project Properties window. Right-click your project, select Properties. In the Properties window, choose the Compiling tab. The Compile on Save checkbox is right at the top. §Note that in the Project Properties window you can configure numerous settings for your project: project libraries, packaging, building, running, etc.

27 NetBeans – configuration.

28 Exercises/Tasks §Write a Java program to test the options for the main menu Run command: §To display 5 times the string “Good luck, dear student!!” §To enter two numeric integer/real values and To display their sum and product.

29 Exercises/Tasks for(int i=1; i<=5; i++) { System.out.print("Good luck, dear"); System.out.println(" student!!"); }

30 Exercises/Tasks import java.util.Scanner; … Scanner cin = new Scanner(System.in); System.out.println("\n Enter two real numeric values:"); double inp1, inp2, result1; inp1 = cin.nextDouble(); inp2 = cin.nextDouble(); result1 = inp1 + inp2; System.out.println(" result of addition is = " + result1);

31 Exercises/Tasks import java.util.Scanner; public class INF160Proba3 { /** args the command line arguments */ public static void main(String[] args) { for(int i=1; i<=5; i++) System.out.println("Good luck, dear student!!"); Scanner cin = new Scanner(System.in); System.out.println("\n Enter two real numeric values:"); double inp1, inp2, result1; inp1 = cin.nextDouble(); inp2 = cin.nextDouble(); result1 = inp1 + inp2; System.out.println(" result of addition is = " + result1); } // end of main } // end of class

32 Exercises/Tasks §Write a Java program to test the command-line arguments option §How to specify arguments l Right-click your project, select Properties. In the Properties window, choose the Run tab. Enter arguments §How to access arguments public static void main(String[] args) { for (int i=0; i<args.length; i++) System.out.println(args[i]); }

33 Exercises/Tasks §How to access arguments, second more reliable version public static void main(String[] args) { System.out.println("\n\n Command line arguments processed"); if (args.length >0) { for(int i=0; i<args.length; i++) System.out.println(args[i]); } else System.out.println(" No cmd line arguments specified"); }

34 Exercises/Tasks §Write a Java program to test the command-line arguments option §Run from within NetBeans §Run as a separate OS command java –jar Application.rar

35 Exercises/Tasks §Write a Java program to test the main menu Refactor command. §Rename variables l inp1 into input1 l inp2 into input2 l result1 into res1

36 Exercises/Tasks §Write a Java program to test the §GCD problem §Fibonacci problem §Factoriel problem

37 NetBeans – functionality Introduction to GUI Building §Contents § §Exercise 1: Creating a Project §Exercise 2: Building the Front End §Exercise 3: Adding Functionality §Exercise 4: Running the Program §How Event Handling Works

38 Thank You For Your Attention!