Adding Existing Source Code in NetBeans CS288, Autumn 2005 Lab 002

Size: px
Start display at page:

Download "Adding Existing Source Code in NetBeans CS288, Autumn 2005 Lab 002"

Transcription

1 Adding Existing Source Code in NetBeans CS288, Autumn 2005 Lab 002 Purpose This document will show how to incorporate existing source code within a NetBeans project. It will also introduce the concept of calling methods from a different class. You have already set up the Building class within the CS288 Java project using NetBeans before starting this exercise (Lab 000 and Lab 001). To continue with this exercise start NetBeans with the CS288 project open. Note: In using this document it is possible to paste text directly into NetBeans. That means when defining new terms in NetBeans their value can be copied directly from here, which will remove the possibility of mistyping values. If you are reading the PDF version of the document, then clicking on the Select icon activates text selection: Items can be selected and copied in the usual way after choosing this tool. The DialogInput Class The source code that we will add to the project is in the file DialogInput.java located on the course web site in the Lab002 section. This file needs to be copied to the same folder that NetBeans uses to store the source code for the CS288 project. Right click on the CS288 project in NetBeans and select project properties. This tells you the main project folder location. The source code for the CS288 project in this example is in the 'src\cs288' subfolder of the project folder. I.e. for the example shown above, the source code lives in the C:\Bill\Java\NetBeans\CS288\src\cs288 folder. Note: if you did not name your project CS288 then it will have a different path. If you have found the correct subfolder it will already contain the file Building.java.

2 Copy DialogInput.java to the 'src\cs288' folder. Note: the copied file MUST have exactly the same name and extension as the original file or NetBeans will not correctly include the class within the project. Also the copied file name must have exactly the same case structure as shown. If you have copied the file correctly then NetBeans will automatically update the project to include the new class and methods. If this is so the project view will also be updated and should look something like the illustration on the right. Double click the askuserforstring method in the DialogInput class. The purpose of the DialogInput class is to provide a user friendly way to get input strings during the execution of the Building application. The askuserforstring method creates a basic dialog box with a single text field for the user to fill in. The argument to askuserforstring is used as the prompt in the dialog box to display to the user. We will use this method in the Building class instead of the command line arguments that we used in the previous lab exercise. At this point of the course we have not covered enough material to understand what the code in the DialogInput class does. However we will still be able to use the methods. As another check that the new class has been correctly added to the project it is useful to compile the file and see that no errors are reported. Right click on DialogInput.java in the project view and select 'Compile File'. If the class has been added to the project without errors then the Output pane should show something like this: init: deps-jar: Compiling 1 source file to C:\Bill\Java\NetBeans\CS288\build\classes compile-single: BUILD SUCCESSFUL (total time: 0 seconds) Illustration 1:Updated Project View The DialogInput.java was designed as a stand alone Java class, and will not work correctly with the NetBeans project structure without some modification. Double click the DialogInput.java item in the project view. In the editor pane add the line: package cs288;

3 at the start of the file. Note: If you did not call your project cs288 then you will need to use the appropriate name at this point. This 'package' statement ensures the NetBeans compilation script understands that the DialogInput class is meant to be part of the same project. Strictly this is not required by the Java programming environment when all source files are contained within the same folder, however NetBeans does not completely comply with the Java standard. Using the askuserforstring method Add a new private field to the Building class. To do this you can choose the 'Add Field' option from the menu given by right clicking the Fields table in the project view. It is also possible to define a new field by simply typing directly into the editor pane. Open the Building.java editor window and type in (or copy) the following line: private DialogInput dlg = new DialogInput("Building Object"); For clarity it is best to add this line to the same part of file where the other fields have been declared. As a check click on the 'Clean and Build Main Project' icon. If the changes were correctly made you should see output something like this: init: deps-clean: Deleting directory C:\Bill\Java\NetBeans\CS288\build Deleting directory C:\Bill\Java\NetBeans\CS288\dist clean: init: deps-jar: Created dir: C:\Bill\Java\NetBeans\CS288\build\classes Compiling 2 source files to C:\Bill\Java\NetBeans\CS288\build\classes compile: Created dir: C:\Bill\Java\NetBeans\CS288\dist Building jar: C:\Bill\Java\NetBeans\CS288\dist\CS288.jar jar: BUILD SUCCESSFUL (total time: 0 seconds) The new line creates an object of the class DialogInput and assigns it to the variable 'dlg'. Having created this object we can use its methods to provide a more friendly method for user input with the askuserforstring method. Double click the main method in the Building.java branch of the cs288 project view. Either delete or comment out the statements that use the command line arguments to initialise the field values.

4 Immediately after the 'Building b1 = new Building();' line that creates the 'b1' object type the text 'dlg.' (do not forget to type the period '.'). NetBeans will now pop up a dialogue box listing all the fields and methods that are available for the 'b1' object. Scroll down to askuserforstring method and double click it. Replace the 'disstring' text in the method call with the string "Enter a value for the street name" (remember to include the quotation marks). Add a ';' to correctly terminate the statement. The source file should now contain this statement: dlg.askuserforstring("enter a value for the street name"); Error in Source File At this point we have an error in the source code. The new statement we have added is underlined in red. If you click on the line and leave the mouse stationary for a moment, the following dialogue box should appear: Even though we have not explicitly compiled the project, NetBeans has checked the code against the compiler in the background and is highlighting an error that will occur if we try to compile the project. The error occurs because the main method must be static in a Java program. A static method is only created once for the entire class and is not copied to new objects that are created during execution of

5 the application. The Java compiler does not allow static methods to directly refer to non static fields. A non static field may not exist at runtime because there do not have to be any objects of the corresponding class created during runtime. However, static methods can be executed at any point during runtime, whether objects for a class exist or not. If a static method attempted to access some non static field when there were no corresponding objects then their would be a runtime error. Error Resolution (1) We only want to create a DialogInput object to access its methods. In particular so that we can create a simple dialogue box for the user to enter a string. One solution is not to have a 'dlg' field at all as part of the Building class. Instead we could create a DialogInput object for use just within the main method. Right click the 'dlg' field item for the Building class in the project view. Choose the delete option. Now double click the main method. Modify the body of the method so that it looks like this: public static void main(string[] args) { Building b1 = new Building(); DialogInput dlg = new DialogInput("Building Object"); dlg.askuserforstring("enter a value for the street name"); System.out.println("Occupant name is " + b1.getoccupantname()); System.out.println("Street Name is " + b1.getstreetname()); System.out.println("Street Number is " + b1.getstreetnumber()); Note we have now declared 'dlg' as a local variable which only has meaning within the main method, and not as a field that can be accessed from any part of the class. Check that the code correctly compiles by clicking the 'Clean and Build Main Project' icon. Run the application. You should see a dialogue box something like this: Enter any value and click OK. The output should look like: init: deps-jar: compile: run: Occupant name is null Street Name is null Street Number is null BUILD SUCCESSFUL (total time: 9 seconds)

6 Note because we have not assigned any value to the Building fields they remain 'null'. Modify the main method to this: public static void main(string[] args) { Building b1 = new Building(); DialogInput dlg = new DialogInput("Building Object"); String tmp_string = dlg.askuserforstring("enter a value for the street name"); b1.setstreetname(tmp_string); System.out.println("Occupant name is " + b1.getoccupantname()); System.out.println("Street Name is " + b1.getstreetname()); System.out.println("Street Number is " + b1.getstreetnumber()); Notice we have now assigned the string value returned by the dlg.askuserforstring method to the local variable tmp_string. Then we have used the setstreetname method to assign a value to the b1 object field streetname. Run the application again. This time the value you type into the dialogue box will appear in the output view. Now modify the code so that the streetnumber and occupantname are also assigned values by using the dlg.askuserforstring method. Error Resolution (2) For this solution we will keep 'dlg' as a field in the Building class. Right click the fields item in the project view and add a new field 'dlg' of type DialogInput. Then edit the 'dlg' declaration so that it becomes: private DialogInput dlg = new DialogInput("Building Object"); Next define a new method for the Building class. Right click the methods item in project view and select new method. In the dialogue box enter usersetstreetname and click OK. Double click the new method in the project view. Edit the body of the method so that it looks like this: public void usersetstreetname() { String tmp_string = Now edit the main method to this: dlg.askuserforstring("enter a value for the street name"); setstreetname(tmp_string); public static void main(string[] args) { Building b1 = new Building(); b1.usersetstreetname(); System.out.println("Occupant name is " + b1.getoccupantname()); System.out.println("Street Name is " + b1.getstreetname()); System.out.println("Street Number is " + b1.getstreetnumber());

7 Clean and build the application, then run. This time whatever value you type in the dialogue box will be assigned to the streetname field. To see how this works try adding breakpoints in the main method and then running the debugger as we did in Lab000. Add other new methods to the Building class in the same way, so that the user can input values for the Street Number and Occupant Name. Call these new methods usersetoccupantname and usersetstreetnumber. Note: the second method requires some conversion between types in order to use an input String to define the Double field value of streetnumber. If you get stuck with this there is a solution near the end of this document. The error was resolved in this case by removing direct access to the 'dlg' field and wrapping it in a method call of the 'b1' object. The 'b1' object will always exist since it is created as part of a static method, namely the main method of the class. Error Resolution (3) One other solution to the original error is to make the DialogInput methods askuserforstring and showinframe be declared static. Then they can be called without creating an object for the DialogInput class. For example by invoking DialogInput.askUserForString( Some String or Other ) Edit the DialogInput class and the main method of the Building class to implement this solution. Hint: in changing the declaration of these methods to static, you will then cause other errors to occur which will then require various fields in the DialogInput class to also be declared static. User Output For this section it is assumed you have implemented Resolution 2 above for the static error. The DialogInput class has a method for displaying an output string in a simple frame. This section shows how to use this to display the field values of the 'b1' object. Double click the main method for the Building class in the project view. Comment out the lines that print the field values to standard output. Right click the methods item and select new method. Call the new method showstreetname: Edit the body of the new method so that it looks like this: public void showstreetname() { dlg.showinframe( "The Street Name is", streetname); This method can now be called for the 'b1' object in the main method. Double click the main method, and edit to this:

8 public static void main(string[] args) { Building b1 = new Building(); b1.usersetstreetname(); b1.showstreetname(); The main method indirectly calls the methods for the DialogInput class from methods for the 'b1' object. Clean build and run the application. Assuming you enter 'Smith St' in the dialogue box for entering the street name, then you should see a frame something like this after you click OK: Now modify the Building class so that it has new methods that show the street number and occupant name in their own frames. Call these new methods showstreetnumber and showoccupantname. The usersetstreetnumber and showstreetnumber methods The definition of the usersetstreetnumber and showstreetnumber methods are non-trivial since they require defining a 'Double' value from a given 'String' value and vice-versa. In your final solution your methods should look something like this: public void usersetstreetnumber() { String tmp_string = dlg.askuserforstring("enter the street number"); Double tmp_dbl = new Double(tmp_string); setstreetnumber(tmp_dbl); public void showstreetnumber() { dlg.showinframe("the Street Number is:", Double.toString(streetNumber)); In the first method notice that we create a new object 'tmp_dbl' of type 'Double'. Then we use the value of this new 'Double' object as the street number in the setstreetnumber method. Since users are limited to inputting values as String objects this kind of conversion within a method is quite typical.

9 In the second method we can not pass the streetnumber value directly to the dlg.showinframe method since it is not a String. To convert the value to a String object we apply the static Double method tostring. Summary The lab has shown how to add existing source code to the NetBeans project, and modified the code so that it will compile correctly with the configuration scripts of the NetBeans IDE. The lab has shown how to create an object of one class within another and then access its methods. The lab has also illustrated the difference between static and non static use of methods and fields.

2 Getting Started. Getting Started (v1.8.6) 3/5/2007

2 Getting Started. Getting Started (v1.8.6) 3/5/2007 2 Getting Started Java will be used in the examples in this section; however, the information applies to all supported languages for which you have installed a compiler (e.g., Ada, C, C++, Java) unless

More information

coe318 Lab 1 Introduction to Netbeans and Java

coe318 Lab 1 Introduction to Netbeans and Java coe318 Lab 1 Week of September 12, 2016 Objectives Lean how to use the Netbeans Integrated Development Environment (IDE). Learn how to generate and write formatted API documentation. Add a constructor,

More information

INGESTING N NWIS J S DATA USING AVA. July 11, by: Apurv Bhartia Resources Austin

INGESTING N NWIS J S DATA USING AVA. July 11, by: Apurv Bhartia Resources Austin INGESTING N NWIS J AVA S DATA USING July 11, 2008 by: Apurv Bhartia Center for Research in Water Resources The University of Texas at Austin Distribution Copyright 2008, Consortium of Universities for

More information

S8352: Java From the Very Beginning Part I - Exercises

S8352: Java From the Very Beginning Part I - Exercises S8352: Java From the Very Beginning Part I - Exercises Ex. 1 Hello World This lab uses the Eclipse development environment which provides all of the tools necessary to build, compile and run Java applications.

More information

3 Getting Started with Objects

3 Getting Started with Objects 3 Getting Started with Objects If you are an experienced IDE user, you may be able to do this tutorial without having done the previous tutorial, Getting Started. However, at some point you should read

More information

Getting Started (1.8.7) 9/2/2009

Getting Started (1.8.7) 9/2/2009 2 Getting Started For the examples in this section, Microsoft Windows and Java will be used. However, much of the information applies to other operating systems and supported languages for which you have

More information

Page 1 of 7. public class EmployeeAryAppletEx extends JApplet

Page 1 of 7. public class EmployeeAryAppletEx extends JApplet CS 209 Spring, 2006 Lab 9: Applets Instructor: J.G. Neal Objectives: To gain experience with: 1. Programming Java applets and the HTML page within which an applet is embedded. 2. The passing of parameters

More information

CS520 Setting Up the Programming Environment for Windows Suresh Kalathur. For Windows users, download the Java8 SDK as shown below.

CS520 Setting Up the Programming Environment for Windows Suresh Kalathur. For Windows users, download the Java8 SDK as shown below. CS520 Setting Up the Programming Environment for Windows Suresh Kalathur 1. Java8 SDK Java8 SDK (Windows Users) For Windows users, download the Java8 SDK as shown below. The Java Development Kit (JDK)

More information

CS 201 Software Development Methods Spring Tutorial #1. Eclipse

CS 201 Software Development Methods Spring Tutorial #1. Eclipse CS 201 Software Development Methods Spring 2005 Tutorial #1 Eclipse Written by Matthew Spear and Joseph Calandrino Edited by Christopher Milner and Benjamin Taitelbaum ECLIPSE 3.0 DEVELOPING A SIMPLE PROGRAM

More information

Lecture (01) Getting started. Dr. Ahmed ElShafee

Lecture (01) Getting started. Dr. Ahmed ElShafee Lecture (01) Getting started Dr. Ahmed ElShafee 1 Dr. Ahmed ElShafee, fundamentals of Programming I, Agenda Download and Installation Java How things work NetBeans Comments Structure of the program Writing

More information

AP Computer Science A Summer Assignment

AP Computer Science A Summer Assignment Mr. George AP Computer Science A Summer Assignment Welcome to AP Computer Science A! I am looking forward to our class. Please complete the assignment below. It is due on the first day back to school in

More information

AP Computer Science A Summer Assignment

AP Computer Science A Summer Assignment AP Computer Science A Summer Assignment Welcome to AP Computer Science A! I am looking forward to our class. Please complete the assignment below. Email the completed Part I as an attachment to kgeorge@glenridge.org

More information

Eclipse Setup. Opening Eclipse. Setting Up Eclipse for CS15

Eclipse Setup. Opening Eclipse. Setting Up Eclipse for CS15 Opening Eclipse Eclipse Setup Type eclipse.photon & into your terminal. (Don t open eclipse through a GUI - it may open a different version.) You will be asked where you want your workspace directory by

More information

NetBeans IDE Java Quick Start Tutorial

NetBeans IDE Java Quick Start Tutorial NetBeans IDE Java Quick Start Tutorial Welcome to NetBeans IDE! This tutorial provides a very simple and quick introduction to the NetBeans IDE workflow by walking you through the creation of a simple

More information

RVDS 4.0 Introductory Tutorial

RVDS 4.0 Introductory Tutorial RVDS 4.0 Introductory Tutorial 402v02 RVDS 4.0 Introductory Tutorial 1 Introduction Aim This tutorial provides you with a basic introduction to the tools provided with the RealView Development Suite version

More information

Setting up your Computer

Setting up your Computer Setting up your Computer 1 Introduction On this lab, you will be getting your computer ready to develop and run Java programs. This lab will be covering the following topics: Installing Java JDK 1.8 or

More information

Software and Programming 1

Software and Programming 1 Software and Programming 1 Lab 1: Introduction, HelloWorld Program and use of the Debugger 17 January 2019 SP1-Lab1-2018-19.pptx Tobi Brodie (tobi@dcs.bbk.ac.uk) 1 Module Information Lectures: Afternoon

More information

Engr 123 Spring 2018 Notes on Visual Studio

Engr 123 Spring 2018 Notes on Visual Studio Engr 123 Spring 2018 Notes on Visual Studio We will be using Microsoft Visual Studio 2017 for all of the programming assignments in this class. Visual Studio is available on the campus network. For your

More information

CSCI 161: Introduction to Programming I Lab 1b: Hello, World (Eclipse, Java)

CSCI 161: Introduction to Programming I Lab 1b: Hello, World (Eclipse, Java) Goals - to learn how to compile and execute a Java program - to modify a program to enhance it Overview This activity will introduce you to the Java programming language. You will type in the Java program

More information

Introduction to Computation and Problem Solving

Introduction to Computation and Problem Solving Class 3: The Eclipse IDE Introduction to Computation and Problem Solving Prof. Steven R. Lerman and Dr. V. Judson Harward What is an IDE? An integrated development environment (IDE) is an environment in

More information

Life Without NetBeans

Life Without NetBeans Life Without NetBeans Part A Writing, Compiling, and Running Java Programs Almost every computer and device has a Java Runtime Environment (JRE) installed by default. This is the software that creates

More information

Packaging Your Program into a Distributable JAR File

Packaging Your Program into a Distributable JAR File Colin Kincaid Handout #5 CS 106A August 8, 2018 Packaging Your Program into a Distributable JAR File Based on a handout by Eric Roberts and Brandon Burr Now that you ve written all these wonderful programs,

More information

ActiveSpaces Transactions. Quick Start Guide. Software Release Published May 25, 2015

ActiveSpaces Transactions. Quick Start Guide. Software Release Published May 25, 2015 ActiveSpaces Transactions Quick Start Guide Software Release 2.5.0 Published May 25, 2015 Important Information SOME TIBCO SOFTWARE EMBEDS OR BUNDLES OTHER TIBCO SOFTWARE. USE OF SUCH EMBEDDED OR BUNDLED

More information

Embedding Graphics in JavaDocs (netbeans IDE)

Embedding Graphics in JavaDocs (netbeans IDE) Embedding Graphics in JavaDocs (netbeans IDE) This note describes how to embed HTML-style graphics within your JavaDocs, if you are using Netbeans. Additionally, I provide a few hints for package level

More information

designed to enable you to create a foundation for your own plugin project.

designed to enable you to create a foundation for your own plugin project. Plugin Development Introduction Savant is unique in the Genome Browser arena in that it was designed to be extensible through a rich plugin framework, which allows developers to provide functionality in

More information

Javadocing in Netbeans (rev )

Javadocing in Netbeans (rev ) Javadocing in Netbeans (rev. 2011-05-20) This note describes how to embed HTML-style graphics within your Javadocs, if you are using Netbeans. Additionally, I provide a few hints for package level and

More information

CS 209 Section 52 Lab 1-A: Getting Started with NetBeans Instructor: J.G. Neal Objectives: Lab Instructions: Log in Create folder CS209

CS 209 Section 52 Lab 1-A: Getting Started with NetBeans Instructor: J.G. Neal Objectives: Lab Instructions: Log in Create folder CS209 CS 209 Section 52 Lab 1-A: Getting Started with NetBeans Instructor: J.G. Neal Objectives: 1. To create a project in NetBeans. 2. To create, edit, compile, and run a Java program using NetBeans. 3. To

More information

IBM WebSphere Java Batch Lab

IBM WebSphere Java Batch Lab IBM WebSphere Java Batch Lab What are we going to do? First we are going to set up a development environment on your workstation. Download and install Eclipse IBM WebSphere Developer Tools IBM Liberty

More information

Eclipse Tutorial. For Introduction to Java Programming By Y. Daniel Liang

Eclipse Tutorial. For Introduction to Java Programming By Y. Daniel Liang Eclipse Tutorial For Introduction to Java Programming By Y. Daniel Liang This supplement covers the following topics: Getting Started with Eclipse Choosing a Perspective Creating a Project Creating a Java

More information

Software and Programming 1

Software and Programming 1 Software and Programming 1 Lab 8: Use of classes, static class variables and methods 1st March 2018 SP1-Lab8-2018.pdf Tobi Brodie (Tobi@dcs.bbk.ac.uk) 1 Lab 8 Objectives Understanding the encapsulation

More information

MEDIA COMPUTATION DRJAVA. Lecture 11.3 November 7, 2008

MEDIA COMPUTATION DRJAVA. Lecture 11.3 November 7, 2008 MEDIA COMPUTATION DRJAVA Lecture 11.3 November 7, 2008 LEARNING GOALS Understand at practical level Where to get DrJava How to start DrJava Dr Java features How to add items to the classpath for DrJava

More information

Jerry Cain Handout #5 CS 106AJ September 30, Using JSKarel

Jerry Cain Handout #5 CS 106AJ September 30, Using JSKarel Jerry Cain Handout #5 CS 106AJ September 30, 2017 Using JSKarel This handout describes how to download and run the JavaScript version of Karel that we ll be using for our first assignment. 1. Getting started

More information

RVDS 3.0 Introductory Tutorial

RVDS 3.0 Introductory Tutorial RVDS 3.0 Introductory Tutorial 338v00 RVDS 3.0 Introductory Tutorial 1 Introduction Aim This tutorial provides you with a basic introduction to the tools provided with the RealView Development Suite version

More information

CSCI0330 Intro Computer Systems Doeppner. Lab 02 - Tools Lab. Due: Sunday, September 23, 2018 at 6:00 PM. 1 Introduction 0.

CSCI0330 Intro Computer Systems Doeppner. Lab 02 - Tools Lab. Due: Sunday, September 23, 2018 at 6:00 PM. 1 Introduction 0. CSCI0330 Intro Computer Systems Doeppner Lab 02 - Tools Lab Due: Sunday, September 23, 2018 at 6:00 PM 1 Introduction 0 2 Assignment 0 3 gdb 1 3.1 Setting a Breakpoint 2 3.2 Setting a Watchpoint on Local

More information

MODEL-BASED DEVELOPMENT -TUTORIAL

MODEL-BASED DEVELOPMENT -TUTORIAL MODEL-BASED DEVELOPMENT -TUTORIAL 1 Objectives To get familiar with the fundamentals of Rational Rhapsody. You start with the simplest example possible. You end with more complex functionality, and a more

More information

Software and Programming 1

Software and Programming 1 Software and Programming 1 Lab 1: Introduction, HelloWorld Program and use of the Debugger 11 January 2018 SP1-Lab1-2017-18.pptx Tobi Brodie (tobi@dcs.bbk.ac.uk) 1 Module Information Lectures: Afternoon

More information

A PROGRAM IS A SEQUENCE of instructions that a computer can execute to

A PROGRAM IS A SEQUENCE of instructions that a computer can execute to A PROGRAM IS A SEQUENCE of instructions that a computer can execute to perform some task. A simple enough idea, but for the computer to make any use of the instructions, they must be written in a form

More information

CS 209 Sec. 52 Spring, 2006 Lab 4-A: Arrays Instructor: J.G. Neal Objectives: Lab Instructions: Obtain file ArrayDemoConsole.java

CS 209 Sec. 52 Spring, 2006 Lab 4-A: Arrays Instructor: J.G. Neal Objectives: Lab Instructions: Obtain file ArrayDemoConsole.java CS 209 Sec. 52 Spring, 2006 Lab 4-A: Arrays Instructor: J.G. Neal Objectives: To gain experience with: 1. The declaration, creation, and use of arrays. 2. Inserting/removing items into/from an array. 3.

More information

You should see something like this, called the prompt :

You should see something like this, called the prompt : CSE 1030 Lab 1 Basic Use of the Command Line PLEASE NOTE this lab will not be graded and does not count towards your final grade. However, all of these techniques are considered testable in a labtest.

More information

PART 1. Eclipse IDE Tutorial. 1. What is Eclipse? Eclipse Java IDE

PART 1. Eclipse IDE Tutorial. 1. What is Eclipse? Eclipse Java IDE PART 1 Eclipse IDE Tutorial Eclipse Java IDE This tutorial describes the usage of Eclipse as a Java IDE. It describes the installation of Eclipse, the creation of Java programs and tips for using Eclipse.

More information

3 CREATING YOUR FIRST JAVA APPLICATION (USING WINDOWS)

3 CREATING YOUR FIRST JAVA APPLICATION (USING WINDOWS) GETTING STARTED: YOUR FIRST JAVA APPLICATION 15 3 CREATING YOUR FIRST JAVA APPLICATION (USING WINDOWS) GETTING STARTED: YOUR FIRST JAVA APPLICATION Checklist: The most recent version of Java SE Development

More information

Java Programming Constructs Java Programming 2 Lesson 1

Java Programming Constructs Java Programming 2 Lesson 1 Java Programming Constructs Java Programming 2 Lesson 1 Course Objectives Welcome to OST's Java 2 course! In this course, you'll learn more in-depth concepts and syntax of the Java Programming language.

More information

Module Road Map. 7. Version Control with Subversion Introduction Terminology

Module Road Map. 7. Version Control with Subversion Introduction Terminology Module Road Map 1. Overview 2. Installing and Running 3. Building and Running Java Classes 4. Refactoring 5. Debugging 6. Testing with JUnit 7. Version Control with Subversion Introduction Terminology

More information

NetBeans Tutorial. For Introduction to Java Programming By Y. Daniel Liang. This tutorial applies to NetBeans 6, 7, or a higher version.

NetBeans Tutorial. For Introduction to Java Programming By Y. Daniel Liang. This tutorial applies to NetBeans 6, 7, or a higher version. NetBeans Tutorial For Introduction to Java Programming By Y. Daniel Liang This tutorial applies to NetBeans 6, 7, or a higher version. This supplement covers the following topics: Getting Started with

More information

Software Installation for CS121

Software Installation for CS121 Software Installation for CS121 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University August 26, 2005 1 Installation of Java J2SE 5 SDK 1. Visit Start Settings Control Panel

More information

CS 209 Sec. 52 Spring, 2006 Lab 6 - B: Inheritance Instructor: J.G. Neal

CS 209 Sec. 52 Spring, 2006 Lab 6 - B: Inheritance Instructor: J.G. Neal CS 209 Sec. 52 Spring, 2006 Lab 6 - B: Inheritance Instructor: J.G. Neal Objectives. To gain experience with: 1. The creation of a simple hierarchy of classes. 2. The implementation and use of inheritance.

More information

Check the entries in the home directory again with an ls command and then change to the java directory:

Check the entries in the home directory again with an ls command and then change to the java directory: MODULE 1p - A Directory for Java Files FIRST TASK Log in to PWF Linux and check the files in your home directory with an ls command. Create a directory for your Java files: c207@pccl504:~> mkdir java Move

More information

Introduction. Key features and lab exercises to familiarize new users to the Visual environment

Introduction. Key features and lab exercises to familiarize new users to the Visual environment Introduction Key features and lab exercises to familiarize new users to the Visual environment January 1999 CONTENTS KEY FEATURES... 3 Statement Completion Options 3 Auto List Members 3 Auto Type Info

More information

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 2: SEP. 8TH INSTRUCTOR: JIAYIN WANG

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 2: SEP. 8TH INSTRUCTOR: JIAYIN WANG CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 2: SEP. 8TH INSTRUCTOR: JIAYIN WANG 1 Notice Class Website http://www.cs.umb.edu/~jane/cs114/ Reading Assignment Chapter 1: Introduction to Java Programming

More information

JDirectoryChooser Documentation

JDirectoryChooser Documentation JDirectoryChooser Documentation Page 1 of 7 How to Use JDirectoryChooser The JDirectoryChooser provides user-friendly GUI for manipulating directories from Java application. User can either simply choose

More information

Lab: Supplying Inputs to Programs

Lab: Supplying Inputs to Programs Steven Zeil May 25, 2013 Contents 1 Running the Program 2 2 Supplying Standard Input 4 3 Command Line Parameters 4 1 In this lab, we will look at some of the different ways that basic I/O information can

More information

Checking Out and Building Felix with NetBeans

Checking Out and Building Felix with NetBeans Checking Out and Building Felix with NetBeans Checking out and building Felix with NetBeans In this how-to we describe the process of checking out and building Felix from source using the NetBeans IDE.

More information

In this lab we will practice creating, throwing and handling exceptions.

In this lab we will practice creating, throwing and handling exceptions. Lab 5 Exceptions Exceptions indicate that a program has encountered an unforeseen problem. While some problems place programmers at fault (for example, using an index that is outside the boundaries of

More information

Table of Contents. Tutorial API Deployment Prerequisites... 1

Table of Contents. Tutorial API Deployment Prerequisites... 1 Copyright Notice All information contained in this document is the property of ETL Solutions Limited. The information contained in this document is subject to change without notice and does not constitute

More information

Laboratory 1: Eclipse and Karel the Robot

Laboratory 1: Eclipse and Karel the Robot Math 121: Introduction to Computing Handout #2 Laboratory 1: Eclipse and Karel the Robot Your first laboratory task is to use the Eclipse IDE framework ( integrated development environment, and the d also

More information

CHAPTER 7 OBJECTS AND CLASSES

CHAPTER 7 OBJECTS AND CLASSES CHAPTER 7 OBJECTS AND CLASSES OBJECTIVES After completing Objects and Classes, you will be able to: Explain the use of classes in Java for representing structured data. Distinguish between objects and

More information

ICOM 4015 Advanced Programming Laboratory. Chapter 1 Introduction to Eclipse, Java and JUnit

ICOM 4015 Advanced Programming Laboratory. Chapter 1 Introduction to Eclipse, Java and JUnit ICOM 4015 Advanced Programming Laboratory Chapter 1 Introduction to Eclipse, Java and JUnit University of Puerto Rico Electrical and Computer Engineering Department by Juan E. Surís 1 Introduction This

More information

Chapter 1 Getting Started

Chapter 1 Getting Started Chapter 1 Getting Started The C# class Just like all object oriented programming languages, C# supports the concept of a class. A class is a little like a data structure in that it aggregates different

More information

In this lab, you will build and execute a simple message flow. A message flow is like a program but is developed using a visual paradigm.

In this lab, you will build and execute a simple message flow. A message flow is like a program but is developed using a visual paradigm. Lab 1 Getting Started 1.1 Building and Executing a Simple Message Flow In this lab, you will build and execute a simple message flow. A message flow is like a program but is developed using a visual paradigm.

More information

Software Development. COMP220/COMP285 Seb Coope Ant: Structured Build

Software Development. COMP220/COMP285 Seb Coope Ant: Structured Build Software Development COMP220/COMP285 Seb Coope Ant: Structured Build These slides are mainly based on Java Development with Ant - E. Hatcher & S.Loughran. Manning Publications, 2003 Imposing Structure

More information

Chapter 4 Defining Classes I

Chapter 4 Defining Classes I Chapter 4 Defining Classes I This chapter introduces the idea that students can create their own classes and therefore their own objects. Introduced is the idea of methods and instance variables as the

More information

CSE 1102 Fall 2009 Lab Assignment 2

CSE 1102 Fall 2009 Lab Assignment 2 CSE 1102 Fall 2009 Lab Assignment 2 Objectives: When you complete this assignment you will be able to: Edit and execute a program using BlueJ and the Wheels package. Use relative positioning Place a composite

More information

1.00 Lecture 2. What s an IDE?

1.00 Lecture 2. What s an IDE? 1.00 Lecture 2 Interactive Development Environment: Eclipse Reading for next time: Big Java: sections 3.1-3.9 (Pretend the method is main() in each example) What s an IDE? An integrated development environment

More information

1 Getting started with Processing

1 Getting started with Processing cis3.5, spring 2009, lab II.1 / prof sklar. 1 Getting started with Processing Processing is a sketch programming tool designed for use by non-technical people (e.g., artists, designers, musicians). For

More information

Instructions PLEASE READ (notice bold and underlined phrases)

Instructions PLEASE READ (notice bold and underlined phrases) Lab Exercises wk02 Lab Basics First Lab of the course Required Reading Java Foundations - Section 1.1 - The Java Programming Language Instructions PLEASE READ (notice bold and underlined phrases) Lab Exercise

More information

SmartCVS Tutorial. Starting the putty Client and Setting Your CVS Password

SmartCVS Tutorial. Starting the putty Client and Setting Your CVS Password SmartCVS Tutorial Starting the putty Client and Setting Your CVS Password 1. Open the CSstick folder. You should see an icon or a filename for putty. Depending on your computer s configuration, it might

More information

Software and Programming 1

Software and Programming 1 Software and Programming 1 Lab 2: Step-by-step execution of programs using a Debugger 18 January 2018 SP1-Lab2-18.pdf Tobi Brodie (tobi@dcs.bbk.ac.uk) 1 Lab Session 2: Objectives This session we are concentrating

More information

What s NetBeans? Like Eclipse:

What s NetBeans? Like Eclipse: What s NetBeans? Like Eclipse: It is a free software / open source platform-independent software framework for delivering what the project calls "richclient applications" It is an Integrated Development

More information

Computer Science AP 2017 Summer Assignment Mrs. McFarland

Computer Science AP 2017 Summer Assignment Mrs. McFarland Computer Science AP 2017 Summer Assignment Mrs. McFarland Read Chapter 1 from the book Think Java: How to Think Like a Computer Scientist by Allen B. Downey. I have included Chapter 1 in this pdf. If you

More information

How to set up a Default Printer

How to set up a Default Printer How to set up a Default Printer 1. Click on the Start Menu 2. Select the Devices and Printers icon Start menu window 3. The Devices and Printers window will show you all the installed printers you have

More information

JUnit Test Patterns in Rational XDE

JUnit Test Patterns in Rational XDE Copyright Rational Software 2002 http://www.therationaledge.com/content/oct_02/t_junittestpatternsxde_fh.jsp JUnit Test Patterns in Rational XDE by Frank Hagenson Independent Consultant Northern Ireland

More information

Even though we created a folder for the workspace, we still have to let JCreator do the same. So click File, New, and then Blank Workspace.

Even though we created a folder for the workspace, we still have to let JCreator do the same. So click File, New, and then Blank Workspace. Getting Started With JCreator The first thing to do with JCreator is to create a workspace. A workspace is an area where you can store a project or a set of related projects. For me, the best way to create

More information

COMP1406 Tutorial 1. Objectives: Getting Started:

COMP1406 Tutorial 1. Objectives: Getting Started: COMP1406 Tutorial 1 Objectives: Write, compile and run simple Java programs using the IntelliJ Idea IDE. Practice writing programs that require user input and formatted output. Practice using and creating

More information

Series 40 6th Edition SDK, Feature Pack 1 Installation Guide

Series 40 6th Edition SDK, Feature Pack 1 Installation Guide F O R U M N O K I A Series 40 6th Edition SDK, Feature Pack 1 Installation Guide Version Final; December 2nd, 2010 Contents 1 Legal Notice...3 2 Series 40 6th Edition SDK, Feature Pack 1...4 3 About Series

More information

Do this by creating on the m: drive (Accessed via start menu link Computer [The m: drive has your login id as name]) the subdirectory CI101.

Do this by creating on the m: drive (Accessed via start menu link Computer [The m: drive has your login id as name]) the subdirectory CI101. Creating and running a Java program. This tutorial is an introduction to running a computer program written in the computer programming language Java using the BlueJ IDE (Integrated Development Environment).

More information

Introduction to C/C++ Programming

Introduction to C/C++ Programming Chapter 1 Introduction to C/C++ Programming This book is about learning numerical programming skill and the software development process. Therefore, it requires a lot of hands-on programming exercises.

More information

Chapter 1 Introduction to Computers, Programs, and Java. What is a Computer? A Bit of History

Chapter 1 Introduction to Computers, Programs, and Java. What is a Computer? A Bit of History Chapter 1 Introduction to Computers, Programs, and Java CS170 Introduction to Computer Science 1 What is a Computer? A machine that manipulates data according to a list of instructions Consists of hardware

More information

Create new Android project in Android Studio Add Button and TextView to layout Learn how to use buttons to call methods. Modify strings.

Create new Android project in Android Studio Add Button and TextView to layout Learn how to use buttons to call methods. Modify strings. Hello World Lab Objectives: Create new Android project in Android Studio Add Button and TextView to layout Learn how to use buttons to call methods. Modify strings.xml What to Turn in: The lab evaluation

More information

public class Foo { private int var; public int Method1() { // var accessible anywhere here } public int MethodN() {

public class Foo { private int var; public int Method1() { // var accessible anywhere here } public int MethodN() { Scoping, Static Variables, Overloading, Packages In this lecture, we will examine in more detail the notion of scope for variables. We ve already indicated that variables only exist within the block they

More information

Software and Programming 1

Software and Programming 1 Software and Programming 1 Lab 2: Step-by-step execution of programs using a Debugger 24 January 2019 SP1-Lab2-2018-19.pdf Tobi Brodie (tobi@dcs.bbk.ac.uk) 1 Lab Session 2: Objectives This session we are

More information

1. The Apache Derby database

1. The Apache Derby database 1. The Apache Derby database In these instructions the directory jdk_1.8.0_112 is named after the version 'number' of the distribution. Oracle tend to issue many new versions of the JDK/ JRE each year.

More information

1. Go to the URL Click on JDK download option

1. Go to the URL   Click on JDK download option Download and installation of java 1. Go to the URL http://www.oracle.com/technetwork/java/javase/downloads/index.html Click on JDK download option 2. Select the java as per your system type (32 bit/ 64

More information

Getting Started with Web Services

Getting Started with Web Services Getting Started with Web Services Getting Started with Web Services A web service is a set of functions packaged into a single entity that is available to other systems on a network. The network can be

More information

CHAPTER 7 OBJECTS AND CLASSES

CHAPTER 7 OBJECTS AND CLASSES CHAPTER 7 OBJECTS AND CLASSES OBJECTIVES After completing Objects and Classes, you will be able to: Explain the use of classes in Java for representing structured data. Distinguish between objects and

More information

Getting started with UNIX/Linux for G51PRG and G51CSA

Getting started with UNIX/Linux for G51PRG and G51CSA Getting started with UNIX/Linux for G51PRG and G51CSA David F. Brailsford Steven R. Bagley 1. Introduction These first exercises are very simple and are primarily to get you used to the systems we shall

More information

RTMS - Software Setup

RTMS - Software Setup RTMS - Software Setup These instructions are for setting up the RTMS (Robot Tracking & Management System) software. This software will run on your PC/MAC and will be used for various labs in order to allow

More information

Slide 1 CS 170 Java Programming 1 Testing Karel

Slide 1 CS 170 Java Programming 1 Testing Karel CS 170 Java Programming 1 Testing Karel Introducing Unit Tests to Karel's World Slide 1 CS 170 Java Programming 1 Testing Karel Hi Everybody. This is the CS 170, Java Programming 1 lecture, Testing Karel.

More information

Lab 1 Introduction to UNIX and C

Lab 1 Introduction to UNIX and C Name: Lab 1 Introduction to UNIX and C This first lab is meant to be an introduction to computer environments we will be using this term. You must have a Pitt username to complete this lab. NOTE: Text

More information

Working with Macros. Creating a Macro

Working with Macros. Creating a Macro Working with Macros 1 Working with Macros THE BOTTOM LINE A macro is a set of actions saved together that can be performed by issuing a single command. Macros are commonly used in Microsoft Office applications,

More information

CST8152 Compilers Creating a C Language Console Project with Microsoft Visual Studio.Net 2010

CST8152 Compilers Creating a C Language Console Project with Microsoft Visual Studio.Net 2010 CST8152 Compilers Creating a C Language Console Project with Microsoft Visual Studio.Net 2010 The process of creating a project with Microsoft Visual Studio 2010.Net is similar to the process in Visual

More information

Importing a Table into Excel

Importing a Table into Excel Importing a Table into Excel This guide will show you step by step how to copy a table into notepad, create a CSV file and then import it into Microsoft Excel. This is a very basic guide but will cover

More information

Section 1. How to use Brackets to develop JavaScript applications

Section 1. How to use Brackets to develop JavaScript applications Section 1 How to use Brackets to develop JavaScript applications This document is a free download from Murach books. It is especially designed for people who are using Murach s JavaScript and jquery, because

More information

Creating jwb Menus. A snapshot of the JWB menu stucture

Creating jwb Menus. A snapshot of the JWB menu stucture Creating jwb Menus Introduction JBASE for web builders has integrated into it the functionality to build menus that have the same look and feel as those in Window s Explorer. The menu is a visual feature

More information

The NetBeans IDE is a big file --- a minimum of around 30 MB. After you have downloaded the file, simply execute the file to install the software.

The NetBeans IDE is a big file --- a minimum of around 30 MB. After you have downloaded the file, simply execute the file to install the software. Introduction to Netbeans This document is a brief introduction to writing and compiling a program using the NetBeans Integrated Development Environment (IDE). An IDE is a program that automates and makes

More information

Task-Oriented Solutions to Over 175 Common Problems. Covers. Eclipse 3.0. Eclipse CookbookTM. Steve Holzner

Task-Oriented Solutions to Over 175 Common Problems. Covers. Eclipse 3.0. Eclipse CookbookTM. Steve Holzner Task-Oriented Solutions to Over 175 Common Problems Covers Eclipse 3.0 Eclipse CookbookTM Steve Holzner Chapter CHAPTER 6 6 Using Eclipse in Teams 6.0 Introduction Professional developers frequently work

More information

MEAP Edition Manning Early Access Program Get Programming with Java Version 1

MEAP Edition Manning Early Access Program Get Programming with Java Version 1 MEAP Edition Manning Early Access Program Get Programming with Java Version 1 Copyright 2018 Manning Publications For more information on this and other Manning titles go to www.manning.com welcome First,

More information

Math Modeling in Java: An S-I Compartment Model

Math Modeling in Java: An S-I Compartment Model 1 Math Modeling in Java: An S-I Compartment Model Basic Concepts What is a compartment model? A compartment model is one in which a population is modeled by treating its members as if they are separated

More information

Guide to fix the problem with Problets

Guide to fix the problem with Problets Guide to fix the problem with Problets COP 2512 - IT Programming Fundamentals In order to fix the problem of not being able to run Problets on your web browser, please follow the following steps: 1. Make

More information

II. Compiling and launching from Command-Line, IDE A simple JAVA program

II. Compiling and launching from Command-Line, IDE A simple JAVA program Contents Topic 01 - Java Fundamentals I. Introducing JAVA II. Compiling and launching from Command-Line, IDE A simple JAVA program III. How does JAVA work IV. Review - Programming Style, Documentation,

More information

Lesson 1. Hello World

Lesson 1. Hello World Lesson 1. Hello World 1.1 Create a program 1.2 Draw text on a page 1.2.-1 Create a draw text action 1.2.-2 Assign the action to an event 1.2.-3 Visually assign the action to an event 1.3 Run the program

More information