Department of Computer Science. Software Usage Guide. CSC132 Programming Principles 2. By Andreas Grondoudis

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

XP: Backup Your Important Files for Safety

Running Java Programs

Eclipse Environment Setup

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

UNic Eclipse Mini Tutorial (Updated 06/09/2012) Prepared by Harald Gjermundrod

Laboratory 1: Eclipse and Karel the Robot

Burning CDs in Windows XP

Software Installation for CS121

Getting Started (1.8.7) 9/2/2009

Instructions. First, download the file

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

Barchard Introduction to SPSS Marks

This lecture will take you through simple and practical approach while learning Java Programming language.

My First Cocoa Program

CSCI 201 Lab 1 Environment Setup

the NXT-G programming environment

My First iphone App. 1. Tutorial Overview

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

Easy Windows Working with Disks, Folders, - and Files

Setting up a ColdFusion Workstation

Chapter 2. Editing And Compiling

Purpose. Why use Java? Installing the Software. Java

Setting up your Computer

Chapter 1. Getting Started

Tutorial 1: Unix Basics

IntelliJ IDEA Getting Started Guide for FIRST Robotics Competition

Customizing DAZ Studio

Introduction to SPSS

How To Upload Your Newsletter

CSE 101 Introduction to Computers Development / Tutorial / Lab Environment Setup

Subversion was not there a minute ago. Then I went through a couple of menus and eventually it showed up. Why is it there sometimes and sometimes not?

Barchard Introduction to SPSS Marks

ENCM 339 Fall 2017: Editing and Running Programs in the Lab

The name of our class will be Yo. Type that in where it says Class Name. Don t hit the OK button yet.

Click Here to Begin OS X. Welcome to the OS X Basics Learning Module.

TRIS Teaching Resource Information Service

Your . A setup guide. Last updated March 7, Kingsford Avenue, Glasgow G44 3EU

Download and Installation Instructions. Java JDK Software for Windows

Assignment 0. Nothing here to hand in

1) Log on to the computer using your PU net ID and password.

How to build Simbody 2.2 from source on Windows

Keep Track of Your Passwords Easily

Rescuing Lost Files from CDs and DVDs

Setting Up the Development Environment

Windows XP. A Quick Tour of Windows XP Features

CSC116: Introduction to Computing - Java

DOWNLOAD OR READ : WORD DOCUMENT INTO PDF EBOOK EPUB MOBI

Taskbar: Working with Several Windows at Once

Eastside Literacy Tutor Support Word Processing Tutorial

PowerPoint Basics: Create a Photo Slide Show


Getting Started with Eclipse/Java

CSC116: Introduction to Computing - Java

Downloading Java Development Kit (JDK), the Offline Client, and Utilizing the Offline Audit Tool

AP Computer Science National Day School

Graduate e-portfolio Setup Directions

Browsing the World Wide Web with Firefox

Intro to the Apple Macintosh Operating System, OSX

Arduino IDE Friday, 26 October 2018

My First iphone App (for Xcode version 6.4)

Slide 1 CS 170 Java Programming 1 Duration: 00:00:49 Advance mode: Auto

Welcome to Kmax Installing Kmax

Network Management Utility

Chapter 1 Introduction

Game keystrokes or Calculates how fast and moves a cartoon Joystick movements how far to move a cartoon figure on screen figure on screen

Reading: Managing Files in Windows 7

LAB 6 Testing the ALU

Instruction: Download and Install R and RStudio

Object-Oriented Programming in Java

CS110/CS119 Introduction to Computing (Java) Bob Wilson S-3-176

Instructions for Using the Databases

Java/RealJ Troubleshooting Guide

Engr 123 Spring 2018 Notes on Visual Studio

3 CREATING YOUR FIRST JAVA APPLICATION (USING WINDOWS)

Spreading a Sample Across the Pads

Yup, left blank on purpose. You can use it to draw whatever you want :-)

Standard Edition (SE) application development Enterprise Edition (EE) enterprise development Micro Edition (ME) Internet of Things (IoT) development

Creating a Website Using Weebly.com (July 2012 Update)

1. Download the following two files from the File Management Lab page on the course WebCT site and save them on the desktop:

CIS 231 Windows 10 Install Lab # 3

Intro. Scheme Basics. scm> 5 5. scm>

SIS offline. Getting Started

Android Studio Setup Procedure

Introduction to Puppy Linux: Installation on a USB Flash Disk

Tips & Tricks for Microsoft Word

Writing and Running Programs

1 Installation (briefly)

Lab: Supplying Inputs to Programs

A Tutorial on using Code::Blocks with Catalina 3.0.3

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #17. Loops: Break Statement

The CartIt Commerce System Installation Guide

Week - 01 Lecture - 04 Downloading and installing Python

Getting Started with Processing by Casey Reas and Ben Fry

Computer Basics: Step-by-Step Guide (Session 2)

Creating Simple Links

Tutorial to QuotationFinder_0.6

Sisulizer Three simple steps to localize

RTMS - Software Setup

What is an operating system (OS or O/S)?

Transcription:

Department of Computer Science Software Usage Guide To provide a basic know-how regarding the software to be used for CSC132 Programming Principles 2 By Andreas Grondoudis WHAT SOFTWARE AM I GOING TO NEED/USE?...2 WHERE DO I FIND THE SOFTWARE?...3 HOW DO I INSTALL THE SOFTWARE?...4 DO I NEED TO CONFIGURE ANYTHING?...5 HOW DO I USE SCITE FOR MY JAVA PROGRAMS...7 WHEN THINGS GO WRONG...8 PROGRAMMING TIPS...10 1

What software am I going to need/use? For CSC132 you are going to be using the same software that you used for CSC131. In fact, if you recently completed CSC131 then it is highly likely that you don t really need to do anything to your computer. 1. You will use the Microsoft Windows operating system (OS). It is already installed in the labs and if you bought your home PC (be it a portable or a desktop) in the last 5 years it should come with some version of Windows or other. The latest version of Windows is XP. For the purposes of the course Windows 95 or 98 or NT or 2000 are perfectly acceptable. 2. You will use the Java 2 Platform Standard Edition 5 (J2SE) from Sun. J2SE is already installed in the labs and if you recently completed CSC131 the chances are your machine already is installed and ready to go. J2SE includes the Java Development Kit (JDK) which is a collection of tools needed to compile and run your programs. If the J2SE is not installed, you are going to need it. 3. The J2SE 5.0 documentation. It is a set of HTML pages that are the specification of the language. Java contains literally thousands of methods, classes, tools and things that you can use. It is impossible to remember all of them by heart. The documentation is a point of reference for everything that is included in the kit. The documentation is an invaluable source of information. 4. You will use a program editor to write your programs. The one being used in recent years is a program called SciTE that is free, small, and simple and does exactly what is required. Frequently Asked Questions Do I have a choice in any of this? Not really when it comes to 1, 2 and 3. With the editor you can choose to use something else but this document focuses on assistance with SciTE. Any restrictions to what I can use? Yes, but only when it comes to graphic user interface development. You are not allowed to use any rapid prototyping features (drag & drop interface building). All interface programs should be completed and configured manually. 2

Where do I find the software? No need to do anything if you have decided to work in the college labs. If you are working at home (or on your portable) then this is what you can do: 1. Download the software from the relevant websites, OR 2. Bring me an empty CDR and I will put everything together for you. If you choose to download the software 1, the following details might be of assistance. Software: Root website: Download page: Directions: Software: Root website: Download page: Directions: Software: Root website: Download page: Directions: J2SE http://java.sun.com http://java.sun.com/j2se/1.5.0/download.jsp Find the popular downloads section and select the J2SE. Remember you are after the Windows-Intel platform of the software. J2SE Documentation http://java.sun.com http://java.sun.com/j2se/1.5.0/download.jsp Find the popular downloads section and select J2SE and scroll down to see a J2SE 5.0 Documentation link. (See footnote 2 about this) SciTE http://www.scintilla.org http://scintilla.sourceforge.net/scitedownload.html Locate the Windows section and find the full download link To make your life a little easier and save you some time (and money) of the download, I have downloaded all the required software and put them together on a CD. If you bring me a CDR, I will burn you a copy of the following software: J2SE o Windows Intel o Windows 64-bit AMD o Linux J2SE 5.0 Documentation o In English o In Japanese Editors collection (including SciTE and Net Beans) Frequently Asked Questions What size are the files in MB? The J2SE is about 57. The documentation is about 45. SciTE is less than 1. Net Beans is about 80 and other editors vary. 1 The operating system is not included for obvious reasons 2 There is a link to download and a link to view online. Select the download as you can then install locally and use offline. 3

How do I install the software? Nowadays installations are wizard-based. Double click on the installation program, the wizard begins and all you have to do is just click Next three or four time and maybe type in the location of where you would like the software installed. Once the wizard completes you are ready to use the software. 1. The J2SE installation is a typical one. Double click on the executable that contains the kit and the wizard will start-up. In a little while you should be done and the kit installed in a folder on your hard drive. If you used the default location it should be: C:\Program files\java\jdk-1.5.0_0x Where x might be 1, 2, 3 or 4 depending 3 on your J2SE update version. 2. The editor. SciTE does not come with an installation wizard. All you get is a folder containing all the required files to start using the program. a. If you downloaded SciTE then you should have a file called wscite166.zip. What you need to do is extract the contents of that archive (the.zip file) into your C:\Program Files\ directory. b. If you use the CD I created then double click on wscite166.exe included in the SciTE directory and the self-extracting program will extract the files for you in C:\Program Files\. In either case you should have a folder on your hard drive in C:\Program files\wscite Which includes the SciTE editor 3. The documentation for J2SE does not come with an installation wizard. Whether you downloaded the documentation or use the software CD you should have a.zip archive that contains all the required files under one folder called docs. What you need to do is extract that.zip file in your JDK installation folder. This way everything relating to Java will be in one location. In the docs folder there exists an index.htm file. This is the starting point for everything in the documentation; open this page and put it in your favourites. Frequently Asked Questions What is a ZIP file and how to I use it? A zip file is an archive that contains one or more other files compressed together to economise in space. Windows XP has inbuilt support for.zip files; just right-click on a zip file to see the available commands. Earlier version of windows need archive software 4 installed. What happens if I want to install (say the J2SE) in another location? That is fine as long as you know where everything is going. Later on you are going to have to configure SciTE and let it know where J2SE is installed. 3 At the time of this writing the latest version is update 4. 4 Just go to www.tucows.com and look under the windows section for any compression software 4

Do I need to configure anything? Nothing needs to be done for J2SE and the documentation. After the J2SE installation finished and the documentation extraction completes, everything is in place. SciTE needs to be configured. You need to let SciTE know where is the J2SE installed so it can find the compiler and interpreter tools. Don t worry this is fairly straightforward. All you are required to do is type some information in a file. Just follow the steps below and you should be done in no time at all. 1. Make a note of the location that you installed J2SE. Say for example if you installed in c:\program files\java\jdk-1.5.0_03. This is your root-jdk directory. 2. Run SciTE. This is the icon that you should be looking for 3. From the menu select Options and then Open cpp.properties 4. Your SciTE will open the file and you can now make the configuration 5. First you need to find what to edit. From the menu select Search and then Find. In the dialog that comes up type the following (exactly as you see it here) command.compile.*.java 6. Click on Find Next and your SciTE will look through the document to locate the phrase. It should look something like 5

7. Here is where you configure SciTE and let it know where your J2SE is. All you need to do edit the 1 st and 3 rd lines and just after the = sign enter your root-jdk directory followed by \bin\. Remember you are supposed to use YOUR root-jdk directory. In my example the root-jdk directory is C:\program files\java\jdk-1.5.0_03 So I had to insert the following just after the 1 st and 3 rd equal signs C:\program files\java\jdk-1.5.0_03\bin\ Then the cpp.properties file (while being edited in SciTE) should look like 8. Save and close cpp.properties. That is it. SciTE is configured and now knows where the J2SE tools are located. Frequently Asked Questions Why don t we do anything to the 2 nd line? Because in Java, programs do not need to be built My J2SE is installed somewhere else, what do I do? You need to write down where you J2SE is installed and follow the steps above but don t type what is on these pages, type your J2SE path instead Don t we need to change anything else, there is a java before the = and java and javac after somewhere? No, all you need to do is enter some text after the = sign in the first and third lines I don t know where SciTE is installed, what now? The default location is c:\program files\wscite\scite.exe. If you installed/extracted somewhere else and you forgot where, then you need to use your Windows search tools and look for a file called SciTE.exe 6

How do I use SciTE for my java programs Run SciTE.exe and type the following code in the untitled file Then select File and Save the file under the name Test.java. Before the program is run it should be compiled first. You compile a java program by selecting Tools and Compile as indicated below Provided that the configuration was correct; the compiler of the JDK will check the file and create a class to run. The output of the compile is shown on the right hand side of the SciTE window. (Note you might have to resize your SciTE window) 7

When you get an >Exit code: 0 this means that everything is OK and the compile operation was successful. You may now execute the file. You execute a file by selecting Tools and then Go. The result will be as indicated below Notice: The word Hello which is what the program is supposed to do. The > Exit code: 0 that means that everything went OK. This is it. You have compiled and executed a java program called Test. When things go wrong If something was wrong say you missing the last brace then the compiler will complain by bringing up an error. The following figure illustrates 8

Notice how the compiler is actually showing you The file that has the error (Test.java) At what line (of the file) the error exists ( :7: ) and An indication of the most likely error ( } is expected ) Also note that in this instance the Exit code is 1, which indicates that something went wrong. A useful feature of SciTE is that if you double click on the error reporting line Test.java:7: } expected Then SciTE will actually take the cursor there to help you realise the mistake and correct it Frequently Asked Questions When I try to compile I get the following: >The system cannot find the file specified. Your SciTE does not know where the J2SE is installed. You need to configure your SciTE, please refer to the relevant section above When I try to compile I get too many mistakes. The right side of SciTE fills up When you type a program you have to be very careful of what you are typing. Remember Java is a case sensitive language so System.out is not the same as system.out. It is common for users to have quite a few mistakes. All you have to do is go through your code and correct them. 9

Programming tips 1. You have to be patient and persistent. Programs can take a while to complete. Don t give up 2. The compiler has nothing against you, as do the keyboard, monitor and case. They are just doing their job. 3. Java is case sensitive. This means that JOptionPane is not the same as joptionpane, and String is not the same as string. 4. Remember to save.java files with the same name as the class name that you used inside the file. If inside the file you wrote public class My_first_class then you should save this file as My_first_class.java. If you use any other name, the compiler will report error(s). 5. The compiler is very rarely wrong. If it is reporting a mistake then it means that you do have a mistake somewhere (see point 7 below) 6. When you do get 10 or even 100 scrolls worth of mistakes don t despair. Usually mistakes at the beginning of the program can cause many mistakes later on. What you should do is scrollback at the top of the right-hand-side window and try to correct the mistakes starting from the top. 7. Quite often mistakes are reported on lines that when you see them no mistake exists. This, 99% of the times, means that there is mistake somewhere above in the program. If the code is in a loop somewhere; look at the loop first and then look and the method that the loop was in and so on. Try and double-check related code (close and sometimes far) to the mistake reporting line. 8. When you do copy and paste code that you don t want to retype you have to take care to make any minor required changes. Quite often, especially when we have to paste the code in more than one place what you do is: paste everywhere first and then go back and adjust the code. The problem here is that you might have actually copied the code in, say, 10 places and went the make the adjustments in only 9 of them. Then the one place that you didn t change will: 1) Not report an error and 2) Run OK, but quite possible not as you want it. So, what you need to do is, paste the code and make the changes there and then (so that you don t forget later on). The clipboard holds the text so you can then carry on to the next paste and change. 9. When you are starting a method or a loop or anything else that might require the use of start and end braces what most people do is start with the open brace and carry on to type the code inside the brace. Then (at the end) type the closing brace. This is fine but, if you have to type something like a thousand lines (sometimes more) inside the brace, you tend to forget to put the closing brace at the end. This leads to the compile reporting (numerous sometimes) } expected. A very handy tip to use is: Write both the opening and closing brace at the same time and then take your cursor back in the middle of the two to complete the code. This way, anything you write in there (no matter how many lines it is) will be inside the braces. 10. Use the Java documentation. You might be doing something wrong without knowing it. 10