MT311 Tutorial Li Tak Sing( 李德成 ). Uploading your work You need to upload your work for tutorials and assignments at the following site:

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

COMPUTER PROGRAMMING I Essential Standard 5.02 Understand Breakpoint, Watch Window, and Try And Catch to Find Errors.
Using Macros and Visual Basic for Applications (VBA) with Excel
An Online Microsoft Word Tutorial & Evaluation Begin.
Lecture Roger Sutton CO331 Visual programming 15: Debugging 1.
The IDE (Integrated Development Environment) provides a DEBUGGER for locating and correcting errors in program logic (logic errors not syntax errors) The.
1 Chapter 4 The Fundamentals of VBA, Macros, and Command Bars.
CS 2511 Fall  Windows:  Start->Specialized Academic Software- >Programming Languages->NetBeans->NetBeans IDE x.y.z  where x.y.z is a version.
CIT 590 Debugging. Find a laptop Please take a moment to open up your laptop and open up Eclipse. If you do not have a laptop, please find a friend. If.
DEBUGGERS For CS302 Data Structures Course Slides prepared by TALHA OZ (most of the text is from
COMPREHENSIVE Excel Tutorial 8 Developing an Excel Application.
Computer Programming and Basic Software Engineering 4. Basic Software Engineering 1 Writing a Good Program 4. Basic Software Engineering.
Using a Debugger. SWC What is ”debugging”? An error in a computer program is often called a ”bug”… …so, to ”debug” is to find and get rid of errors in.
The NetBeans IDE CSIS 3701: Advanced Object Oriented Programming.
XP New Perspectives on Microsoft Office Access 2003 Tutorial 11 1 Microsoft Office Access 2003 Tutorial 11 – Using and Writing Visual Basic for Applications.
Author: Loh Jianxiong Christopher Editors: Chua Jie Sheng, Li Mengran, Peh Shao Hong, Oo Theong Siang.
MT311 Java Application Development and Programming Languages Li Tak Sing( 李德成 )
XP 1 Microsoft Word 2002 Tutorial 1 – Creating a Document.
Lesson 12: Working with Code-editing Features Introduction to Adobe Dreamweaver CS6 Adobe Certified Associate: Web Communication using Adobe Dreamweaver.
1 ITI 1120 Lab # 1 An Introduction to the Lab Environment Contributors: G. Arbez, M. Eid, D. Inkpen, A. Williams, D. Amyot.
Microsoft Visual Basic 2012 CHAPTER THREE Program Design and Coding.
Debugging Dwight Deugo Nesa Matic
Debugging. 2 © 2003, Espirity Inc. Module Road Map 1.Eclipse Debugging  Debug Perspective  Debug Session  Breakpoint  Debug Views  Breakpoint Types.
Debugging in Java. Common Bugs Compilation or syntactical errors are the first that you will encounter and the easiest to debug They are usually the result.
Copyright © Curt Hill Turtles The beginning of media computation.
VB – Debugging Tools Appendix D. Why do we need debugging? Every program has errors, and the process of finding these errors is debugging Types of errors.
EIE375 BlueJ: Getting Started Dr Lawrence Cheung.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 8 Debugging, Creating Executable Files, and Distributing a Windows Application.
Debugging Visual Basic.NET Programs ► ► Use debugging tools ► ► Set breakpoints and correct mistakes. ► ► Use a Watch and Local window to examine variables.
Debuggers in Python. The Debugger Every programming IDE has a tool called a debugger. This application does NOT locate or fix your bugs for you! It slows.
INSERT BOOK COVER 1Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Getting Started with VBA for Microsoft Office 2010 by.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 4 Slide 1 Slide 1 What we'll cover here l Using the debugger: Starting the debugger Setting.
NETBEANS DEBUGGER.  To create a breakpoint place the cursor at the desired location.  Go to the Run -> toogle line Breakpoint or Ctrl +F8. It creates.
Concurrency Properties. Correctness In sequential programs, rerunning a program with the same input will always give the same result, so it makes sense.
Author: Loh Jianxiong Christopher Contributions: Chua Jie Sheng, Li Mengran, Peh Shao Hong, Oo Theong Siang, Tong Chun Kit, Tania Chattopadhyay.
Dreamweaver MX. 2 Tools for Code Editing (p. 366) n An HTML editor like Dreamweaver writes most of the code you need, but at times you will need to perform.
Creating and Editing a Web Page
How to Execute TSR Program. Install Borland C++ Download Borland C++ from LMS – oads/BORLANDC.rarhttp://vulms.vu.edu.pk/Courses/CS609/Downl.
Debugging tools in Flash CIS 126. Debugging Flash provides several tools for testing ActionScript in your SWF files. –The Debugger, lets you find errors.
Debugging What coders (programmers) do to find the errors (“bugs”) in their own programs “Bugs” – Admiral Grace Hopper, developer of the world’s first.
C language + The Preprocessor. + Introduction The preprocessor is a program that processes that source code before it passes through the compiler. It.
On Line Microsoft Word Tutorial & Evaluation Begin.
An introduction to the debugger And jGrasp editor-syncrasies (ideosyncrasies)
Netbeans QuickStart. Creating a project File->New Project –For now you want General->Java Application –Then fill in the project details.
Debuggers. Errors in Computer Code Errors in computer programs are commonly known as bugs. Three types of errors in computer programs –Syntax errors –Runtime.
1 Using an Integrated Development Environment. Integrated Development Environments An Integrated Development Environment, or IDE, permits you to edit,
Author: Loh Jianxiong Christopher Contributions: Chua Jie Sheng, Li Mengran, Peh Shao Hong, Oo Theong Siang, Tong Chun Kit, Tania Chattopadhyay.
Debugging with Eclipse
Excel Tutorial 8 Developing an Excel Application
Chapter 2: The Visual Studio .NET Development Environment
Dept of Computer Science University of Maryland College Park
Debugging Dwight Deugo
Eclipse Navigation & Usage.
Testing and Debugging.
Tutorial 1 – Creating a Document
Important terms Black-box testing White-box testing Regression testing
Important terms Black-box testing White-box testing Regression testing
TRAINING OF FOCAL POINTS ON THE CountrySTAT/FENIX SYSTEM
Debugging with Eclipse
CIS 470 Mobile App Development
DEBUGGING JAVA PROGRAMS USING ECLIPSE DEBUGGER
Testing, debugging, and using support libraries
Debugging Visual Basic Programs
CIS 470 Mobile App Development
How to Execute TSR Program
Debugging Dwight Deugo
How to Execute TSR Program
Running a Java Program using Blue Jay.
Debugging with Eclipse
CIS 694/EEC 693 Android Sensor Programming
Presentation transcript:

MT311 Tutorial Li Tak Sing( 李德成 )

Uploading your work You need to upload your work for tutorials and assignments at the following site: The user id would be your student number and the password would be distributed shortly.

Java Netbeans You need to use Java Netbeans to prepare Java programs in this course. Before you can create a Java file, you need to create a project in Netbeans. This is done by following the link: File -> New Project

Creating Project in Netbeans Then a new window would appear. This would enable you to choose the type of project you want to create. At this moment, you would select General on the left window and Java Application on the right window. Then press the 'next' button.

Creating Project in Netbeans Then, you need to provide the project name and the location where you want the project files to be stored. If you have bought along a USB drive or a floppy, please specify the location to be on the USB drive or the floppy. Otherwise your work will be lost after leaving the computer. Let's assume that the new project name is MyProject.

Creating Files in a Project After that, a file called Main.java would be created for you. You can simply ignore this file or you can delete it. To create a java file, follow the link: File -> New File. Then, you need to select the type of file you want to create. For a Java class, select Java Classes on the left window, select Java class on the right windows.

Creating Files in a Project Then, you need to specify the name of the class. Let's assume that the class we want to create is MyClass. Then, press the 'Finish' button. After that, an entry for MyClass.java would appear in the top left window and the contents of the file is shown on the right window.

Creating Files in a Project The file would contain the following lines: package MyProject; public class MyClass { /** Creates a new instance of MyClass */ public MyClass() { } }

Editing Java file You can then add your code inside the file. If your code contains syntax errors, then the errors will be shown underlined with wave lines.

Compiling Java files To compile the file you just edited: – press F9 ; or – follow the link: Build -> compile MyClass.java

Compiling Java files Files in a project may depends on each other. So if you have made changes to a file, then all files that use the class in the former file have to be compiled again. To do so, you can: – press F11; or – follow the link File -> Build main project – or press the button on the tool bar:

Clean and build project The last method sometimes fails in that when you make some changes to a file and another file used this file does not get compiled. In this case, you may need to force a recompilation of all files in the project.

Clean and build project This is done by doing the followings: – press shift-F11 – follow the link: Build -> Clean and Build Main Project – press the following button on the tool bar:

Compilation errors If your program contains syntax errors, the errors will be shown in the lower window. You can click at the errors and the places where errors occur will be shown in the editor window.

Debugging Java programs It is difficult to write a correct program in one go especially when you are writing a large program. So it is important that you know how to debug a program. The most primitive ways of debugging a program is to insert some print statements to show the status of the program at different states.

Debugging Java programs However, with Netbeans, you can actually set breakpoints in your code so that the program will be stopped at certain point to enable you to check the contents of different variable. You can even execute the Java statements line by line so that you can watch how the status of the program changes.

Debugging Java programs To debug the Java file you have just edited, you can do one of the followings: – press ctrl-shift-F5 – follow the link: Run->Run File -> Debug MyClass.java

Debugging Java programs Once you have start the debugging process, the program will be compiled and then executed. So you do not need to explicitly compile the file before debugging. However, sometimes you need to do a clean compilation before of the problem mentioned previously.

Setting breakpoints A breakpoint is a point where execution will stop when you debug a program. To set a breakpoint, you just need to click on the left margin of the place where you want the execution to stop. Once the breakpoint is set, you can see a small pink square at the left margin.

Removing breakpoints You can remove a breakpoint by clicking at it again.

Viewing local variables When the program is stopped at a breakpoint, the lower right window shows three tags: Watches, Call Stack, Local Variables.

Viewing local variables If you click at the local variables tag, all local variables are listed in the window. If the variable is an object, you can click on a '+' button to expand it to view the values of its attributes.

Call stack The call stack lists out all the methods in the stack. So if you have method A calling method B, then, you would see method B on top of method A in the call stack window. You can click at a particular method in the call stack if you want to view the local variables of that method. Of course, you need to switch back to the Local Variables widow to see them.

Watches In the watches window, you can specify any expression you want to view and then Netbeans will evaluate the expression and shows the value.

Step-by-step execution When the program is stopped, you can execute the next statement by doing any of the followings: – Press F8 – follow the link: Run->Step Over – Press the following button on the tool bar:

Stepping into a method When the program is stopped at a point where the statement is calling a method, then, you can step into it by doing one of the followings: – F7 – follow the link: Run -> Step Into – press the following button on the tool bar:

Getting out of a method If you want to get out of a method, you can do the followings: – press alt-shift-F7 – follow the link: Run -> Step Out

Run to cursor When a program is stopped at one point and you want execution to resume until certain point, then you can first click at the point where you want to stop again and then do one of the followings: – press F4 – follow the link: Run -> Run to cursor – press the following button on the tool bar: