Life Without NetBeans

Size: px
Start display at page:

Download "Life Without NetBeans"

Transcription

1 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 a virtual machine capable of running Java programs. To create our own Java programs, however, we also need the Java Development Kit (JDK). If you are doing these exercises on your own personal computer, you might need to install the JDK. The two commands that we need in these exercises are javac and java. The javac command is the Java compiler - the software that compiles Java source code into runnable form (bytecode). The java command runs a Java program, but it only understands bytecode. So, it s a two-step process: compile and then run. Setup The following exercises use a command-line interface. In Windows, you can start a command-line shell by click Command Prompt in Accessories, or you can run the command cmd. We also need to make sure that the javac and java programs are available. To check this, open a command prompt and enter javac. If you see a long message instructing you about all of the options available for using the compiler, then you re good to go. You can proceed to Example 1. If you see an error message that says javac is not a recognized command (or something like that), then the computer can t find the compiler, so we need to tell it where it is. Determine where your computer s JDK is installed and note the complete path the bin folder inside the JDK. Edit your system s PATH environment variable to include the path to the JDK s bin folder. Verify that you can now see the usage message when you enter javac. Life Without NetBeans - Part A Page 1 of 12

2 Example 1 - A Simple Program Objective : write, compile, and run a simple program The source code of a Java program is saved in one or more.java files. These are just plain text files, so they can be edited from any text editor. To run a Java program, the source code (.java files) must first be compiled into bytecode (.class files). This is done with the Java Compiler, called javac. The bytecode is then run with the Java Interpreter, called java. Exercise 1. Open a text editor, such as Notepad, type in the program below, and save the file as Hello.java. The main part of the file name must match the class name in the source code ( Hello ), and the file must have a.java extension. import java.util.calendar; import java.util.date; public class Hello { public static void main(string[] args) { System.out.println("Hello World!"); Date d = Calendar.getInstance().getTime(); System.out.println("The time is " + d); } } 2. Open a command window and navigate to the folder where the.java file is saved. 3. Display the contents of the folder to make sure that the file Hello.java is there. (In Windows, use the dir command; in Linux, the ls command.) 4. Display the contents of the file. (In Windows, enter the command type Hello.java ; in Linux, enter the command cat Hello.java.) 5. Now compile the program with javac. javac Hello.java Life Without NetBeans - Part A Page 2 of 12

3 If your source code contains any syntax errors, you will see error messages displayed to the console. If you don t see any error messages, then the compilation succeeded. 6. Display the contents of the directory and observe that a.class file has now been created. 7. Now run the program with java. java Hello Note that it s just java Hello, not java Hello.class - the java interpreter assumes (and requires) that the program has a.class extension. You should see two lines of output in the console: Hello World! followed by The time is with the current system date and time. 8. Once compiled, the bytecode is independent of the source code, so it doesn t need to be in the same location. Verify this by copying the class file to another folder, navigating to that folder, and running the program. Lessons You don't need NetBeans to write, compile, and run a Java program. Once a program is compiled into bytecode, the.class files can be moved anywhere. They are now independent of the.java files. Example 2 - How NetBeans Works Objective : learn how a NetBeans project compiles and runs a program NetBeans automatically configures and runs your application. But there is nothing special about this process - it is the same as we saw in Example 1. Exercise 1. Create a project in NetBeans called HelloApp. Inside the project, create a class called Hello, and do NOT specify a package. (In the source code, there should be no package statement at the top of the file.) 2. Run the program to make sure it works. 3. Close NetBeans. Life Without NetBeans - Part A Page 3 of 12

4 4. Open a command window, move the project s classes folder and run the program with the java command. 5. Navigate to the src folder, compile the.java file with the javac command, and then run the program with the java command. Lessons There is nothing special about the way NetBeans compiles and runs your program. It just does the same thing that you can do with the raw data, using javac and then java. NetBeans moves the class files to a separate folder, but this is purely to keep things organized. It is not a requirement (although it is a very good idea). Example 3 - Packages Objective : write, compile, and run a program that uses a package Packages are just folders used to organize your source code. If you use packages (and you should), you need to replicate the folder structure in the compiled bytecode. Exercise 1. Copy the file FizzBuzz.java from the FizzBuzzApp project to an empty folder. (You will find the file in the project s src\fbmain folder.) 2. Open a command prompt and navigate to your folder. 3. Display the contents of the.java file. Note the package name declared on the first line. 4. Compile the file and verify that the.class file has been created. 5. Enter java FizzBuzz - it doesn t work. 6. Enter java fbmain\fizzbuzz (or use / if on Linux or Mac) - it doesn t work. 7. Enter java fbmain.fizzbuzz - it doesn t work. 8. Create a folder called fbmain and copy or move the.java file inside. 9. Navigate to the fbmain folder. 10. Compile the.java file and verify that the.class file has been created. 11. Enter java FizzBuzz - it doesn t work. 12. Enter java fbmain\fizzbuzz (or use / if on Linux or Mac) - it doesn t work. Life Without NetBeans - Part A Page 4 of 12

5 13. Enter java fbmain.fizzbuzz - it doesn t work. 14. Navigate to the parent folder. 15. Enter java FizzBuzz - it doesn t work. 16. Enter java fbmain\fizzbuzz - it doesn t work. 17. Enter java fbmain.fizzbuzz - it works! Lessons The.class file must be inside a folder structure that matches the package structure in the source code. The program must be run from the parent folder. The run command must specify the folder name(s) followed by the program name, separated by the dot character (. ). Example 4 - Multiple Source Files (Same Package) Objective : compile and run a program containing multiple files (in the same package) Most applications contain more than one class. When the source code is compiled, there will be (at least) one.class file for each.java file. In order for the interpreter to run the application, you must tell it which class contains a main method. The.class files do not have to be in the same location as the.java files, but both sets of files must be in a folder whose name matches the package declared in the.java files. Exercise 1. Copy the src folder from the project FlightApp_SamePackage to an empty folder. 2. Navigate to the folder and then inside the src folder. 3. Display the contents of the demo folder - there should be three.java files. 4. Compile all of the files with the command: javac demo\*.java 5. Display the contents of the demo folder again - there should now be three.class files as well. Life Without NetBeans - Part A Page 5 of 12

6 6. It s a good idea to keep source files and compiled files separate (which NetBeans does). Let s do that now. 7. Go back to the root level of your folder. 8. Create a new folder called classes and inside that folder create a folder called demo. The folder structure should now look like this: 9. Copy all of the.class from src\demo to classes\demo folder. (Remember: the source code specifies a package called demo, so the source files and bytecode files must both be in demo folders - but they can be in different demo folders.) 10. To run a program containing multiple classes, you must select the class that contains a main method. In this case, it is the FlightDemo class. Navigate inside the classes folder and run the program with the command: java demo.flightdemo You should see five flights displayed to the console. Fortunately, the javac command allows you to specify a separate folder to hold the classes, and it will replicate the sub-folder package structure for you. Let s do that now. 11. Delete the classes from classes\demo and then remove the classes\demo folder (but not the classes folder itself). 12. Navigate to the src folder and compile the program with the command: javac d..\classes demo\*.java Now look in the classes folder. You will see that the demo folder has been created automatically, and the.class files have been compiled into that folder. 13. Run the program from the classes folder as you did before. Lessons Life Without NetBeans - Part A Page 6 of 12

7 Java can compile multiple source files at once. To run the program, you must know which class contains the main method. The source code (.java files) and the bytecode (.class files) both have to be placed in a folder that matches the declared package structure, but they can each be in separate folders. This is recommended, since it makes it easier to keep track of things, and makes bundling easier, as we will see later. The Java compiler (javac) can automatically create the necessary folders for the.class files and then move the files to that folder. Use the -d flag. Example 5 - Multiple Packages Objective : compile and run a program containing multiple files (in different packages) What if your source code files are in different packages? This is no problem - javac will figure it out, provided your folder structure matches the packages declared in the source code. The compiler will automatically seek out any dependencies. For example, if class Foo contains an object of type Goo, then when you compile Foo.java, the compiler will automatically compile Goo.java as well - if, that is, the folders match the declared packages. Exercise 1. Copy the src folder from the project FlightApp_DifferentPackages to an empty folder. 2. Create a folder called classes inside your folder (but outside the src folder). 3. Navigate inside the src folder. 4. Display the contents of the src folder - you should see a demo folder and a entity folder. Display the contents of each subfolder - you should see that FlightDemo.java is inside the demo folder, and Airport.java and Flight.java are inside the entity folder. 5. Compile the program with the command: javac d..\classes demo\*.java Life Without NetBeans - Part A Page 7 of 12

8 6. Now look in the classes folder. You will see that both the demo folder and the entity folder have been created automatically, and the.class files have been compiled into their correct matching folders. 7. Furthermore, the Java interpreter (java) will automatically figure out which folders to look in, based on the declared folder structure at compilation time. So, you should be able to run the program from the classes folder exactly as you did before. The interpreter will automatically look inside the entity folder to find the other classes. Try running it with the command: java demo.flightdemo Lessons The Java compiler (javac) can replicate complex folder structures and place the compiled.class files in the correct folders. The Java interpreter (java) can automatically find all the classes needed to run the program, provided that the folders the.class files are in matches the package names declared in the source code. Example 6 - Third-Party Libraries Objective : include a third-party library in your application Many of the classes you use are built into the Java environment - classes like String, Scanner, or the Calendar class used in the Hello program from Exercise 1. But sometimes you want to use a library of classes that another programmer has written. (If you have ever used FileUtils, for example, then you have used a third-party library.) These classes are usually bundled together and distributed in a single.jar file. (A.jar file is very similar to a.zip file - it is a set of files that have been compressed. We will learn more about.jar files in Part B.) As you probably know, to use the classes while you re writing your program, you must import those classes in your code, just as you import built-in Java classes, such as Scanner. In addition, however, you must also include the.jar file in the compilation process. This is because those classes are not part of the Java language itself, so you have to tell the compiler to include them. Finally, when you run the program, you must tell the interpreter where the classes are. This is because they are not in the same package as your classes. Life Without NetBeans - Part A Page 8 of 12

9 Exercise 1. Copy the src folder from the project App to an empty folder. 2. Create a folder called classes inside your folder (but outside the src folder). 3. Copy the file tools.jar from the App project folder to your folder. 4. Navigate inside the src folder. You should see a folder called demo and inside that folder you should see a file called Demo.java. This is the file that needs to be compiled. 5. Inside the src folder, execute the command: javac d..\classes demo\*.java 6. This command worked in Exercise 5, but now there is another library that the compiler needs. This is why you see an error message informing you that the compiler can t find the package tools. So, we have to tell the compiler where to find this library. Recall that we put the file tools.jar in the root level of the folder (outside src). So, enter the command: javac d..\classes cp..\ tools.jar demo\*.java The -cp flag is short for classpath - it is used to tell the compiler where to look any other classes that are needed. 7. Confirm that there is a.class file in the classes\demo folder. 8. Now let s run the program. Navigate inside the classes folder and execute the command: java demo. demo You will see an error message because now the interpreter can t find the external library. 9. So, copy the file tools.jar into the classes folder, and execute the command: java cp tools.jar demo. demo You will see another error message. The problem now is that when we specify the classpath as tools.jar, we are telling the interpreter to look ONLY in that jar file and not in the current folder. So, it s not looking in the current folder and therefore doesn t find the demo folder. 10. To fix this, we have to tell the interpreter to look in both places: Life Without NetBeans - Part A Page 9 of 12

10 java cp tools.jar;. demo. demo The command works, and you should see the Demo app running. The -cp string can specifiy multiple locations separated by semicolons. The dot character means the current folder. So, tools.jar;. means look in stools.jar and in the current folder. Lessons When using an external library, you must tell the compiler (javac) where the library is. When using an external library, you must tell the interpreter (java) where the library is, but you must also make sure you tell the interpreter to look for the folder that contains the regular classes. Example 7 - Non-Java Files Objective : include non-java files in your application Often your application uses non-java files, such as configuration files, data files, images, etc. These files are not compiled (since they are not Java), but when you run the program, you need to tell the interpreter where to find the files. Exercise 1. Create a new empty folder and copy all of the following from the project HangmanApp into your folder: The src folder - contains.java files. The images folder - contains.png image files. The file countries.txt. The file cputils.jar 2. Create a folder called classes inside your folder (but outside the src folder). 3. Take a moment to examine the contents of the folders. 4. Navigate inside the src folder and compile the program with the command: javac d..\classes cp..\cputils.jar hangman\*.java Life Without NetBeans - Part A Page 10 of 12

11 5. Verify that the.class files have been created inside classes\hangman. 6. Navigate to the classes folder. As in the previous exercise, we will also need to copy the third-party library to this location. 7. Copy the file cputils.jar from the root level of your folder to classes. 8. Execute the command: java cp cputils.jar;. hangman.mainform You will see a popup error message informing you that the application can t find the file countries.txt. This is a file that the application needs, but it s not a Java file, so it wasn t compiled. 9. Copy the file countries.txt from the root level of your folder to classes. 10. Try running the application again. This time you ll see a popup error message informing you that the application can t find the file Hangman-0.png. The application also needs all of the image files in the images folder, so copy that folder from the root level of your folder to classes. 11. The application should now run successfully. Life Without NetBeans - Part A Page 11 of 12

12 Comprehensive Exercise Perform the following tasks using only a terminal shell. Do not use NetBeans (or any other IDE). 1. Copy everything from the ImageBuilder folder to an empty folder. 2. Quickly read the source code in CreateImageFromBinary.java to get a sense of how the code works. In particular, note the locations of where it is reading its input and where it is saving its output. 3. Create a folder at the root level of your folder called classes. 4. Compile the application into the classes folder. 5. Inside classes create/copy whatever you need so that the application will run. 6. Run the application from the classes folder. 7. Verify that two images - big.jpeg and small.jpeg have been created. 8. Verify that the images are valid by opening them in an image viewer. Life Without NetBeans - Part A Page 12 of 12

Instructions. First, download the file

Instructions. First, download the file Instructions First, download the file http://www.cs.mcgill.ca/~cs202/2012-09/web/lectures/dan/unit0/helloworld.java from the course webpage. You can view this file in a program such as notepad (windows),

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

Certified Core Java Developer VS-1036

Certified Core Java Developer VS-1036 VS-1036 1. LANGUAGE FUNDAMENTALS The Java language's programming paradigm is implementation and improvement of Object Oriented Programming (OOP) concepts. The Java language has its own rules, syntax, structure

More information

Javac and Eclipse tutorial

Javac and Eclipse tutorial Javac and Eclipse tutorial Author: Balázs Simon, BME IIT, 2013. Contents 1 Introduction... 2 2 JRE and JDK... 2 3 Java and Javac... 2 4 Environment variables... 3 4.1 Setting the environment variables

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

The Command Shell. Fundamentals of Computer Science

The Command Shell. Fundamentals of Computer Science The Command Shell Fundamentals of Computer Science Outline Starting the Command Shell Locally Remote Host Directory Structure Moving around the directories Displaying File Contents Compiling and Running

More information

Lesson 04: Our First Java Program (W01D4

Lesson 04: Our First Java Program (W01D4 Lesson 04: Our First Java Program (W01D4) Balboa High School Michael Ferraro Lesson 04: Our First Java Program (W01D4 Do Now Start a terminal shell. From there, issue these commands

More information

Getting Started with Eclipse/Java

Getting Started with Eclipse/Java Getting Started with Eclipse/Java Overview The Java programming language is based on the Java Virtual Machine. This is a piece of software that Java source code is run through to produce executables. The

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

Running Java Programs

Running Java Programs Running Java Programs Written by: Keith Fenske, http://www.psc-consulting.ca/fenske/ First version: Thursday, 10 January 2008 Document revised: Saturday, 13 February 2010 Copyright 2008, 2010 by Keith

More information

Eclipse Environment Setup

Eclipse Environment Setup Eclipse Environment Setup Adapted from a document from Jeffrey Miller and the CS201 team by Shiyuan Sheng. Introduction This lab document will go over the steps to install and set up Eclipse, which is

More information

Life Without NetBeans

Life Without NetBeans Life Without NetBeans Part C Web Applications Background What is a WAR? A Java web application consists a collection of Java servlets and regular classes, JSP files, HTML files, JavaScript files, images,

More information

CSC116: Introduction to Computing - Java

CSC116: Introduction to Computing - Java CSC116: Introduction to Computing - Java Course Information Introductions Website Syllabus Computers First Java Program Text Editor Helpful Commands Java Download Intro to CSC116 Instructors Course Instructor:

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

Lesson 01 Introduction

Lesson 01 Introduction Lesson 01 Introduction MIT 12043, Fundamentals of Programming By: S. Sabraz Nawaz Lecturer in Management & IT M.Sc. In IS (SLIIT), PGD in IS (SLIIT), BBA (Hons.) Spl. in IS (SEUSL), MCP Programs Computer

More information

These two items are all you'll need to write your first application reading instructions in English.

These two items are all you'll need to write your first application reading instructions in English. IFRN Instituto Federal de Educação, Ciência e Tecnologia do RN Curso de Tecnologia em Análise e Desenvolvimento de Sistemas Disciplina: Inglês Técnico Professor: Sandro Luis de Sousa Aluno(a) Turma: Data:

More information

CSC116: Introduction to Computing - Java

CSC116: Introduction to Computing - Java CSC116: Introduction to Computing - Java Intro to CSC116 Course Information Introductions Website Syllabus Computers First Java Program Text Editor Helpful Commands Java Download Course Instructor: Instructors

More information

Introduction to Java. Lecture 1 COP 3252 Summer May 16, 2017

Introduction to Java. Lecture 1 COP 3252 Summer May 16, 2017 Introduction to Java Lecture 1 COP 3252 Summer 2017 May 16, 2017 The Java Language Java is a programming language that evolved from C++ Both are object-oriented They both have much of the same syntax Began

More information

Getting Started with Java. Atul Prakash

Getting Started with Java. Atul Prakash Getting Started with Java Atul Prakash Running Programs C++, Fortran, Pascal Python, PHP, Ruby, Perl Java is compiled into device-independent code and then interpreted Source code (.java) is compiled into

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

Introduction to Java. Java Programs Classes, Methods, and Statements Comments Strings Escape Sequences Identifiers Keywords

Introduction to Java. Java Programs Classes, Methods, and Statements Comments Strings Escape Sequences Identifiers Keywords Introduction to Java Java Programs Classes, Methods, and Statements Comments Strings Escape Sequences Identifiers Keywords Program Errors Syntax Runtime Logic Procedural Decomposition Methods Flow of Control

More information

Working with the Command Line

Working with the Command Line Working with the Command Line Useful Commands cd ls cp mv Running a Java Program Writing Your Code Compiling Your Program Running Your Program Running a Scala Program Useful Commands At its heart, the

More information

JVM interprets the Java bytecode, controls how it interacts with the operating system and manages memory.

JVM interprets the Java bytecode, controls how it interacts with the operating system and manages memory. Appendix 2 Installing the Java Development Kit A2.1. Why Java? Presented in May 1995 and developed by J. Gosling and P. Naughton of Sun Microsystems, Java is an object-oriented programming language. It

More information

The Computer System. Hardware = Physical Computer. Software = Computer Programs. People = End Users & Programmers. people

The Computer System. Hardware = Physical Computer. Software = Computer Programs. People = End Users & Programmers. people The Computer System Hardware = Physical Computer The equipment associated with a computer system. hardware software people The set of instructions that tell a computer what to do. Use the power of the

More information

Slide 1 Java Programming 1 Lecture 2D Java Mechanics Duration: 00:01:06 Advance mode: Auto

Slide 1 Java Programming 1 Lecture 2D Java Mechanics Duration: 00:01:06 Advance mode: Auto Java Programming 1 Lecture 2D Java Mechanics Slide 1 Java Programming 1 Lecture 2D Java Mechanics Duration: 00:01:06 To create your own Java programs, you follow a mechanical process, a well-defined set

More information

Object-Oriented Programming in Java

Object-Oriented Programming in Java CSCI/CMPE 3326 Object-Oriented Programming in Java Course Information, JVM, Compile and Run, IDE, Android Studio Dr. Dongchul Kim Department of Computer Science University of Texas Rio Grande Valley Course

More information

Tutorial 1 CSC 201. Java Programming Concepts عؾادئماظربجمةمبادؿكدامماجلاصا

Tutorial 1 CSC 201. Java Programming Concepts عؾادئماظربجمةمبادؿكدامماجلاصا Tutorial 1 CSC 201 Java Programming Concepts عؾادئماظربجمةمبادؿكدامماجلاصا م- م- م- م- م- Chapter 1 1. What is Java? 2. Why Learn Java? a. Java Is Platform Independent b. Java is Easy to learn 3. Programming

More information

Chapter 4 Java Language Fundamentals

Chapter 4 Java Language Fundamentals Chapter 4 Java Language Fundamentals Develop code that declares classes, interfaces, and enums, and includes the appropriate use of package and import statements Explain the effect of modifiers Given an

More information

http://java.sun.com/docs/books/tutorial/getstarted/index.html1 Getting Started THIS chapter gives a quick introduction to the Java TM technology. First, we explain what the Java platform is and what it

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

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

Fundamentals of Programming. By Budditha Hettige

Fundamentals of Programming. By Budditha Hettige Fundamentals of Programming By Budditha Hettige Overview Exercises (Previous Lesson) The JAVA Programming Languages Java Virtual Machine Characteristics What is a class? JAVA Standards JAVA Keywords How

More information

Lec 3. Compilers, Debugging, Hello World, and Variables

Lec 3. Compilers, Debugging, Hello World, and Variables Lec 3 Compilers, Debugging, Hello World, and Variables Announcements First book reading due tonight at midnight Complete 80% of all activities to get 100% HW1 due Saturday at midnight Lab hours posted

More information

Computer Science 62 Lab 8

Computer Science 62 Lab 8 Computer Science 62 Lab 8 Wednesday, March 26, 2014 Today s lab has two purposes: it is a continuation of the binary tree experiments from last lab and an introduction to some command-line tools. The Java

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

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

Adding Existing Source Code in NetBeans CS288, Autumn 2005 Lab 002 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

More information

CT 229. CT229 Lecture Notes. Labs. Tutorials. Lecture Notes. Programming II CT229. Objectives for CT229. IT Department NUI Galway

CT 229. CT229 Lecture Notes. Labs. Tutorials. Lecture Notes. Programming II CT229. Objectives for CT229. IT Department NUI Galway Lecture Notes CT 229 Programming II Lecture notes, Sample Programs, Lab Assignments and Tutorials will be available for download at: http://www.nuigalway.ie/staff/ted_scully/ct229/ Lecturer: Dr Ted Scully

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

Linux File System and Basic Commands

Linux File System and Basic Commands Linux File System and Basic Commands 0.1 Files, directories, and pwd The GNU/Linux operating system is much different from your typical Microsoft Windows PC, and probably looks different from Apple OS

More information

CPS109 Lab 1. i. To become familiar with the Ryerson Computer Science laboratory environment.

CPS109 Lab 1. i. To become familiar with the Ryerson Computer Science laboratory environment. CPS109 Lab 1 Source: Partly from Big Java lab1, by Cay Horstmann. Objective: i. To become familiar with the Ryerson Computer Science laboratory environment. ii. To obtain your login id and to set your

More information

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

Using Eclipse for C Programming

Using Eclipse for C Programming Using Eclipse for C Programming George Ferguson ferguson@cs.rochester.edu June 2018 Abstract Students are used to using the Eclipse IDE for programming in Java. This document describes how to install and

More information

Outline. Overview. Control statements. Classes and methods. history and advantage how to: program, compile and execute 8 data types 3 types of errors

Outline. Overview. Control statements. Classes and methods. history and advantage how to: program, compile and execute 8 data types 3 types of errors Outline Overview history and advantage how to: program, compile and execute 8 data types 3 types of errors Control statements Selection and repetition statements Classes and methods methods... 2 Oak A

More information

Programming Principles 1 (CSC131) & 2 (CSC132) Software usage guide

Programming Principles 1 (CSC131) & 2 (CSC132) Software usage guide School of Sciences Department of Computer Science and Engineering Programming Principles 1 (CSC131) & 2 (CSC132) Software usage guide WHAT SOFTWARE AM I GOING TO NEED/USE?... 3 WHERE DO I FIND THE SOFTWARE?...

More information

Chapter Two Bonus Lesson: JavaDoc

Chapter Two Bonus Lesson: JavaDoc We ve already talked about adding simple comments to your source code. The JDK actually supports more meaningful comments as well. If you add specially-formatted comments, you can then use a tool called

More information

You should now start on Chapter 4. Chapter 4 introduces the following concepts

You should now start on Chapter 4. Chapter 4 introduces the following concepts Summary By this stage, you have met the following principles : the relationship between classes and objects that a class represents our understanding of something weʼre interested in, in a special and

More information

CompSci 125 Lecture 02

CompSci 125 Lecture 02 Assignments CompSci 125 Lecture 02 Java and Java Programming with Eclipse! Homework:! http://coen.boisestate.edu/jconrad/compsci-125-homework! hw1 due Jan 28 (MW), 29 (TuTh)! Programming:! http://coen.boisestate.edu/jconrad/cs125-programming-assignments!

More information

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

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG 1 Notice Reading Assignment Chapter 1: Introduction to Java Programming Homework 1 It is due this coming Sunday

More information

Lab # 2. For today s lab:

Lab # 2. For today s lab: 1 ITI 1120 Lab # 2 Contributors: G. Arbez, M. Eid, D. Inkpen, A. Williams, D. Amyot 1 For today s lab: Go the course webpage Follow the links to the lab notes for Lab 2. Save all the java programs you

More information

Class 1: Homework. Intro to Computer Science CSCI-UA.0101 New York University Courant Institute of Mathematical Sciences Fall 2017

Class 1: Homework. Intro to Computer Science CSCI-UA.0101 New York University Courant Institute of Mathematical Sciences Fall 2017 Intro to Computer Science CSCI-UA.0101 New York University Courant Institute of Mathematical Sciences Fall 2017 1 1. Please obtain a copy of Introduction to Java Programming, 11th (or 10th) Edition, Brief

More information

Get JAVA. I will just tell you what I did (on January 10, 2017). I went to:

Get JAVA. I will just tell you what I did (on January 10, 2017). I went to: Get JAVA To compile programs you need the JDK (Java Development Kit). To RUN programs you need the JRE (Java Runtime Environment). This download will get BOTH of them, so that you will be able to both

More information

CSCI 1103: Introduction

CSCI 1103: Introduction CSCI 1103: Introduction Chris Kauffman Last Updated: Wed Sep 13 10:43:47 CDT 2017 1 Logistics Reading Eck Ch 1 Available online: http://math.hws.edu/javanotes/ Reading ahead is encouraged Goals Basic Model

More information

CSC116: Introduction to Computing - Java

CSC116: Introduction to Computing - Java CSC116: Introduction to Computing - Java Course Information Introductions Website Syllabus Schedule Computing Environment AFS (Andrew File System) Linux/Unix Commands Helpful Tricks Computers First Java

More information

lejos NXJ Problem Solving with Robots [PRSOCO601]

lejos NXJ Problem Solving with Robots [PRSOCO601] lejos NXJ Problem Solving with Robots [PRSOCO601] Thomas Devine http://noucamp thomas.devine@lyit.ie February 20, 2008 1 Contents 1 lejos NXJ 4 1.1 Introducing the Java Development.......................

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

GETTING STARTED. The longest journey begins with a single step. In this chapter, you will learn about: Compiling and Running a Java Program Page 2

GETTING STARTED. The longest journey begins with a single step. In this chapter, you will learn about: Compiling and Running a Java Program Page 2 ch01 11/17/99 9:16 AM Page 1 CHAPTER 1 GETTING STARTED The longest journey begins with a single step. CHAPTER OBJECTIVES In this chapter, you will learn about: Compiling and Running a Java Program Page

More information

13 th Windsor Regional Secondary School Computer Programming Competition

13 th Windsor Regional Secondary School Computer Programming Competition SCHOOL OF COMPUTER SCIENCE 13 th Windsor Regional Secondary School Computer Programming Competition Hosted by The School of Computer Science, University of Windsor WORKSHOP I [ Overview of the Java/Eclipse

More information

Java Puzzle Ball Nick Ristuccia

Java Puzzle Ball Nick Ristuccia Java Puzzle Ball Nick Ristuccia Lesson 0 What is Java? Lesson 0 is Optional Lesson 1 is where the real fun starts! But you'll need Java 8 or higher installed to run Java Puzzle Ball. Lesson 0 gives an

More information

INFO Object-Oriented Programming

INFO Object-Oriented Programming INFO0062 - Object-Oriented Programming Programming in Java with a terminal Jean-François Grailet University of Liège Faculty of Applied Sciences Academic Year 2018-2019 1 / 13 About using a terminal Under

More information

Building Java Programs. Introduction to Programming and Simple Java Programs

Building Java Programs. Introduction to Programming and Simple Java Programs Building Java Programs Introduction to Programming and Simple Java Programs 1 A simple Java program public class Hello { public static void main(string[] args) { System.out.println("Hello, world!"); code

More information

Intro to Linux. this will open up a new terminal window for you is super convenient on the computers in the lab

Intro to Linux. this will open up a new terminal window for you is super convenient on the computers in the lab Basic Terminal Intro to Linux ssh short for s ecure sh ell usage: ssh [host]@[computer].[otheripstuff] for lab computers: ssh [CSID]@[comp].cs.utexas.edu can get a list of active computers from the UTCS

More information

IT151: Introduction to Programming (java)

IT151: Introduction to Programming (java) IT151: Introduction to Programming (java) Programming Basics Program A set of instructions that a computer uses to do something. Programming / Develop The act of creating or changing a program Programmer

More information

COMP 110 Project 1 Programming Project Warm-Up Exercise

COMP 110 Project 1 Programming Project Warm-Up Exercise COMP 110 Project 1 Programming Project Warm-Up Exercise Creating Java Source Files Over the semester, several text editors will be suggested for students to try out. Initially, I suggest you use JGrasp,

More information

Lecture 1: Overview of Java

Lecture 1: Overview of Java Lecture 1: Overview of Java What is java? Developed by Sun Microsystems (James Gosling) A general-purpose object-oriented language Based on C/C++ Designed for easy Web/Internet applications Widespread

More information

Programming with Java

Programming with Java Java-At-A-Glance Widely used, high-level programming language Programming with Java Developed by Sun Microsystems in 1995 (which was acquired by Oracle Corporation in 2010) An object-oriented programming

More information

USING THE OOSIML/JAVA COMPILER. With the Command Window

USING THE OOSIML/JAVA COMPILER. With the Command Window USING THE OOSIML/JAVA COMPILER With the Command Window On Windows Operating System José M. Garrido Department of Computer Science December 2017 College of Computing and Software Engineering Kennesaw State

More information

Programming in Java Prof. Debasis Samanta Department of Computer Science Engineering Indian Institute of Technology, Kharagpur

Programming in Java Prof. Debasis Samanta Department of Computer Science Engineering Indian Institute of Technology, Kharagpur Programming in Java Prof. Debasis Samanta Department of Computer Science Engineering Indian Institute of Technology, Kharagpur Lecture 04 Demonstration 1 So, we have learned about how to run Java programs

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

CS260 Intro to Java & Android 02.Java Technology

CS260 Intro to Java & Android 02.Java Technology CS260 Intro to Java & Android 02.Java Technology CS260 - Intro to Java & Android 1 Getting Started: http://docs.oracle.com/javase/tutorial/getstarted/index.html Java Technology is: (a) a programming language

More information

Java applets & the RealJ IDE

Java applets & the RealJ IDE Java applets & the RealJ IDE Java applets must be Prepared as source text in the Java language Then compiled (translated) into runnable form Then run or viewed by a WWW browser (or an appletviewer) To

More information

Eclipse. JVM, main method and using Eclipse. Dr. Siobhán Drohan. Produced by: Department of Computing and Mathematics

Eclipse. JVM, main method and using Eclipse. Dr. Siobhán Drohan. Produced by: Department of Computing and Mathematics Eclipse JVM, main method and using Eclipse Produced by: Dr. Siobhán Drohan Department of Computing and Mathematics http://www.wit.ie/ Topics list Files in Java. Java Virtual Machine. main method. Eclipse

More information

Code Ninjas: Introduction to Computer Science. Macomb Science Olympiad Presented by Swati Dharia

Code Ninjas: Introduction to Computer Science. Macomb Science Olympiad Presented by Swati Dharia Code Ninjas: Introduction to Computer Science Macomb Science Olympiad Presented by Swati Dharia Intro to Java Programming The three basic steps required to get a simple program running. As with any application,

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

Java: Comment Text. Introduction. Concepts

Java: Comment Text. Introduction. Concepts Java: Comment Text Introduction Comment text is text included in source code that is ignored by the compiler and does not cause any machine-language object code to be generated. It is written into the

More information

ASSIGNMENT 5 Data Structures, Files, Exceptions, and To-Do Lists

ASSIGNMENT 5 Data Structures, Files, Exceptions, and To-Do Lists ASSIGNMENT 5 Data Structures, Files, Exceptions, and To-Do Lists COMP-202B, Winter 2009, All Sections Due: Tuesday, April 14, 2009 (23:55) You MUST do this assignment individually and, unless otherwise

More information

What you need to know about Java and JetTrac Licensing

What you need to know about Java and JetTrac Licensing What you need to know about Java and JetTrac Licensing This document is designed to get you up to speed on the multi-platform nature of the JetTrac Products, and the licensing system that protects them

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

CS 11 java track: lecture 1

CS 11 java track: lecture 1 CS 11 java track: lecture 1 Administrivia need a CS cluster account http://www.cs.caltech.edu/ cgi-bin/sysadmin/account_request.cgi need to know UNIX www.its.caltech.edu/its/facilities/labsclusters/ unix/unixtutorial.shtml

More information

How to Install (then Test) the NetBeans Bundle

How to Install (then Test) the NetBeans Bundle How to Install (then Test) the NetBeans Bundle Contents 1. OVERVIEW... 1 2. CHECK WHAT VERSION OF JAVA YOU HAVE... 2 3. INSTALL/UPDATE YOUR JAVA COMPILER... 2 4. INSTALL NETBEANS BUNDLE... 3 5. CREATE

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

CS Introduction to Computational and Data Science. Instructor: Renzhi Cao Computer Science Department Pacific Lutheran University Spring 2017

CS Introduction to Computational and Data Science. Instructor: Renzhi Cao Computer Science Department Pacific Lutheran University Spring 2017 CS 133 - Introduction to Computational and Data Science Instructor: Renzhi Cao Computer Science Department Pacific Lutheran University Spring 2017 Previous class We have learned the path and file system.

More information

CHAPTER 1 Introduction to Computers and Java

CHAPTER 1 Introduction to Computers and Java CHAPTER 1 Introduction to Computers and Java Copyright 2016 Pearson Education, Inc., Hoboken NJ Chapter Topics Chapter 1 discusses the following main topics: Why Program? Computer Systems: Hardware and

More information

Just Enough Eclipse What is Eclipse(TM)? Why is it important? What is this tutorial about?

Just Enough Eclipse What is Eclipse(TM)? Why is it important? What is this tutorial about? Just Enough Eclipse What is Eclipse(TM)? Eclipse is a kind of universal tool platform that provides a feature-rich development environment. It is particularly useful for providing the developer with an

More information

page 1 Murach s Beginning Java 2 Table of Contents Murach s Beginning Java 2 (Includes Version 1.3 & 1.4) - 2 Introduction - 3

page 1 Murach s Beginning Java 2 Table of Contents Murach s Beginning Java 2 (Includes Version 1.3 & 1.4) - 2 Introduction - 3 Table of Contents Murach s Beginning Java 2 (Includes Version 1.3 & 1.4) - 2 Introduction - 3 Section I The essence of Java programming Chapter 1 - How to get started with Java - 6 Chapter 2 - Java language

More information

Java Language. Programs. Computer programs, known as software, are instructions to the computer. You tell a computer what to do through programs.

Java Language. Programs. Computer programs, known as software, are instructions to the computer. You tell a computer what to do through programs. Introduction to Programming Java Language Programs Computer programs, known as software, are instructions to the computer. You tell a computer what to do through programs. Programs are written using programming

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

1B1a Programming I Getting Started

1B1a Programming I Getting Started 1B1a Programming I Getting Started Agenda Definitions. What is programming? What is Java? Writing your first program. Classes and Objects. 1 2 Reading You should be reading chapters 1 & 2 of the text book.

More information

CHAPTER 1. Introduction to JAVA Programming

CHAPTER 1. Introduction to JAVA Programming CHAPTER 1 Introduction to JAVA Programming What java is Java is high level You can use java to write computer applications that computes number,process words,play games,store data, etc. History of Java.

More information

Unix/Linux Basics. Cpt S 223, Fall 2007 Copyright: Washington State University

Unix/Linux Basics. Cpt S 223, Fall 2007 Copyright: Washington State University Unix/Linux Basics 1 Some basics to remember Everything is case sensitive Eg., you can have two different files of the same name but different case in the same folder Console-driven (same as terminal )

More information

ASSIGNMENT 5 Objects, Files, and a Music Player

ASSIGNMENT 5 Objects, Files, and a Music Player ASSIGNMENT 5 Objects, Files, and a Music Player COMP-202A, Fall 2009, All Sections Due: Thursday, December 3, 2009 (23:55) You MUST do this assignment individually and, unless otherwise specified, you

More information

COMP1007 Principles of Programming

COMP1007 Principles of Programming Agenda COMP1007 Principles of Programming Definitions. What is programming? What is Java? Writing your first program. Classes and Objects. 3 Reading Program You should be reading chapters 1 & 2 of the

More information

Introduction to Java

Introduction to Java Introduction to Java Module 1: Getting started, Java Basics 22/01/2010 Prepared by Chris Panayiotou for EPL 233 1 Lab Objectives o Objective: Learn how to write, compile and execute HelloWorld.java Learn

More information

IntelliJ IDEA Getting Started Guide for FIRST Robotics Competition

IntelliJ IDEA Getting Started Guide for FIRST Robotics Competition IntelliJ IDEA 2016.1 Getting Started Guide for FIRST Robotics Competition 1 PRE-REQUISITES GitHub account. Knowledge of your computer and how to use it. Administrator Account on your computer. Access to

More information

Java with Eclipse: Setup & Getting Started

Java with Eclipse: Setup & Getting Started Java with Eclipse: Setup & Getting Started Originals of slides and source code for examples: http://courses.coreservlets.com/course-materials/java.html Also see Java 8 tutorial: http://www.coreservlets.com/java-8-tutorial/

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

Introduction to Java Programming

Introduction to Java Programming Introduction to Java Programming Lecture 1 CGS 3416 Spring 2017 1/9/2017 Main Components of a computer CPU - Central Processing Unit: The brain of the computer ISA - Instruction Set Architecture: the specific

More information

Programming In Java Prof. Debasis Samanta Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Programming In Java Prof. Debasis Samanta Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Programming In Java Prof. Debasis Samanta Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture - 06 Demonstration II So, in the last lecture, we have learned

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

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

St. Edmund Preparatory High School Brooklyn, NY

St. Edmund Preparatory High School Brooklyn, NY AP Computer Science Mr. A. Pinnavaia Summer Assignment St. Edmund Preparatory High School Name: I know it has been about 7 months since you last thought about programming. It s ok. I wouldn t want to think

More information