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

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

Running Java Programs

Getting Started with Eclipse/Java

Eclipse Environment Setup

Setting up your Computer

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

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

Chapter 2. Editing And Compiling

Purpose. Why use Java? Installing the Software. Java

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

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

How to Install (then Test) the NetBeans Bundle

CSCI 201 Lab 1 Environment Setup

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

Getting Started with Eclipse for Java

Software Installation for CS121

3 CREATING YOUR FIRST JAVA APPLICATION (USING WINDOWS)

Assignment 1. Application Development

02/03/15. Compile, execute, debugging THE ECLIPSE PLATFORM. Blanks'distribu.on' Ques+ons'with'no'answer' 10" 9" 8" No."of"students"vs."no.

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

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

Lecture (01) Getting started. Dr. Ahmed ElShafee

Burning CDs in Windows XP

Teacher Guide. Edline -Teachers Guide Modified by Brevard Public Schools Revised 6/3/08

Setting Up the Development Environment

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

IntelliJ IDEA Getting Started Guide for FIRST Robotics Competition

Download and Installation Instructions. Java JDK Software for Windows

RELAIS. Installation Guide in Windows Environment

XP: Backup Your Important Files for Safety

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

RTMS - Software Setup

Mehran Sahami Handout #5 CS 106A September 27, 2017 Downloading Eclipse

Computer Science AP 2017 Summer Assignment Mrs. McFarland

Getting Started with Java. Atul Prakash

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?

TRIS Teaching Resource Information Service

1. The Apache Derby database

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

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

A Tutorial on using Code::Blocks with Catalina 3.0.3

1.00/1.001 HowTo: Install Eclipse

IT151: Introduction to Programming (java)

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

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

Tutorial 1: Unix Basics

Using Eclipse for C Programming

500 Business Center Drive Pittsburgh, PA USA Phone: Fax: CAGE Code 1BGJ7

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

Web Questing. Go to the Web Quest site (webquest.org)

Assignment 0. Nothing here to hand in

Using Eclipse for Java. Using Eclipse for Java 1 / 1

Instructions. First, download the file

Initial Coding Guidelines

Android Studio Setup Procedure

SAP GUI 7.30 for Windows Computer

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

My First iphone App. 1. Tutorial Overview

Java TM SE 7 Release Notes Microsoft Windows Installation (32-bit)

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

My First Cocoa Program

How to build Simbody 2.2 from source on Windows

How To Upload Your Newsletter

Getting help with Edline 2. Edline basics 3. Displaying a class picture and description 6. Using the News box 7. Using the Calendar box 9

Week - 01 Lecture - 04 Downloading and installing Python

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

the NXT-G programming environment

Tips & Tricks for Microsoft Word

CS 170 Java Tools. Step 1: Got Java?

CS125 : Introduction to Computer Science. Lecture Notes #4 Type Checking, Input/Output, and Programming Style

Life Without NetBeans

Mehran Sahami Handout #5 CS 106A September 26, 2018 Downloading Eclipse

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

Intro to Microsoft Word

CS3 Midterm 1 Fall 2006

Exercise 1 Using Boolean variables, incorporating JavaScript code into your HTML webpage and using the document object

Customizing DAZ Studio

Fundamental C# Programming

Instructions for Using the Databases

CSC116: Introduction to Computing - Java

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.

Mr.Kailley s AP Chem programming Unit Set up instruction sheet for PC s (Mac will be kind of similar: good luck) 1) Go to the following website:

Getting Started (1.8.7) 9/2/2009

3. NetBeans IDE 6.0. Java. Fall 2009 Instructor: Dr. Masoud Yaghini

Lab: Supplying Inputs to Programs

Getting Started with Eclipse for Java

Handout 4: Version Control Reference

Java/RealJ Troubleshooting Guide

Lesson 1A - First Java Program HELLO WORLD With DEBUGGING examples. By John B. Owen All rights reserved 2011, revised 2015

Tips from the experts: How to waste a lot of time on this assignment

Laboratory Assignment #3 Eclipse CDT

InterPSS OpenCIM User s Guide Software Release 1.2.1

ORACLE SQL DEVELOPER

For live Java EE training, please see training courses at

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

Object-Oriented Programming in Java

CMPSCI 187 / Spring 2015 Hangman

CMSC 201 Spring 2017 Lab 01 Hello World

Javac and Eclipse tutorial

Summer Assignment for AP Computer Science. Room 302

Transcription:

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?... 4 HOW DO I INSTALL THE SOFTWARE?... 5 DO I NEED TO CONFIGURE ANYTHING?... 6 HOW DO I USE SCITE FOR MY JAVA PROGRAMS... 8 WHEN THINGS GO WRONG... 9 APPENDIX A - PROGRAMMING TIPS... 10 Andreas Grondoudis for DCSE

Page has been left blank intentionally 2 Last updated by Andreas Grondoudis on: Thursday, 02 February 2012

What software am I going to need/use? The following assumes that you already have a Microsoft Windows operation system already installed. There are two pieces of software that you will require. The listing below explains 1. You will need the Java Development Kit (or JDK) version 7 (and later). JDK is a free kit containing a collection of tools needed to compile and run your programs. Please note you want the JDK not the JRE 2. You will use a program editor called SciTE. This is a free versatile text editor enabling the creation of java files for the course. I think that you should also download and install 3. The Java Documentation. [Optional but recommended (especially for CSC132)] 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. Frequently Asked Questions Q: Do I have a choice in any of this? A: Not really when it comes to 1 and 3. With the editor you can choose to use something else but please note: - this document focuses on assistance with SciTE - you are not allowed to use any application that automatically generates code Last updated by Andreas Grondoudis on: Thursday, 02 February 2012 3

Where do I find the software? No need to do anything if you have decided to work in the university s labs. If you are working at home (or on your portable) then download the software from the relevant websites. Software: Java SE 7 Download: http://www.oracle.com/technetwork/java/javase/downloads Directions: Scroll down a little bit and look for Java SE 7 and click the JDK download button. Select the correct version for your platform Software: Download Directions: Software: Download: Directions: Java SE 7 Documentation http://www.oracle.com/technetwork/java/javase/downloads Scroll down on the page and look for Java SE 7 Documentation and click the download button WSciTE 2.28 or later http://scintilla.sourceforge.net/scitedownload.html Locate the Windows section and find the full download link Frequently Asked Questions Q: What size are the downloads? A: At last writing: JDK 80MB, JavaDOC 58MB and SciTE 1MB Q: What if I use Linux or Win64? A: The JDK comes in a various versions including Solaris, Linux and Windows. Just select the appropriate platform when you download. Please note this guide focuses on Windows based development. 4 Last updated by Andreas Grondoudis on: Thursday, 02 February 2012

How do I install the software? 1. You can install the JDK by simply starting up the file you downloaded. I suggest that you change the installation directory to: C:\Program Files\Java. In a couple of clicks you should have everything ready. 2. The documentation is a.zip file that needs to be extracted in your JDK installation folder (as above). When extracted you should have a new folder C:\Program Files\Java\docs 3. The editor. SciTE does not come with an installation wizard. All you get is a.zip folder containing all the required files to start using the program. Extract the archive and you should get a folder called <wscite>. Inside this folder you will find a <SciTE.exe>. This is the editor; create a shortcut to it on your desktop and you are finished Frequently Asked Questions Q: What is a ZIP file and how to I use it? A: A zip file is an archive that contains one or more other files compressed together to economise in space. Windows XP (and later) 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 1 installed. Q: What happens if I want to install (say the Java SE) in another location? A: That is fine as long as you know where everything is going so that you know where to extract the documentation and later on configure SciTE 1 http://www.7zip.com/ provides a comparison and download links Last updated by Andreas Grondoudis on: Thursday, 02 February 2012 5

Do I need to configure anything? Nothing is required for Java SE and the documentation (provided you extracted it ok). After installation and extraction everything is in place and you can use the tools. SciTE needs to be configured. You need to let SciTE know where is the Java SE 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 Java SE. Say for example if you installed in c:\program files\java. This is your root-jdk directory. 2. Run SciTE. 3. From the menu select <Options> and then <Open cpp.properties> to open the file. 4. From the menu select <Search> and then <Find >. In the dialog that comes up type the following (exactly as you see it below) command.compile.*.java 5. Click on <Find Next> and your SciTE will look through the document to locate the phrase. It should look something like 6. Here is the only editing you are required to do. a. Edit the 1 st and 3 rd lines and b. just after the = sign enter your root-jdk directory followed by \bin\. c. Remember you are supposed to use YOUR root-jdk directory. In my example the root-jdk directory is C:\program files\java\ d. So I had to insert the following just after the 1 st and 3 rd equal signs C:\program files\java\bin\ e. Then the cpp.properties file (while being edited in SciTE) should look like 7. Don't edit anything else; save and close cpp.properties. 8. That is it. SciTE is configured and now knows where the Java SE tools are located. 6 Last updated by Andreas Grondoudis on: Thursday, 02 February 2012

Frequently Asked Questions Q: My Java SE is installed somewhere else, what do I do? A:You need to write down where you Java SE is installed and follow the steps above but don t type what is on these pages, type your Java SE path instead. If you are not able to find it manually, do a search in windows and try locating a file called 'javac.exe' or 'java.exe' Q: Don t we need to change anything else, there is a java before the = and java and javac after somewhere? A: No Q: Do I need to do anything to the second line? A: No Q: I don t know where SciTE is installed, what now? A: 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 Q: I am looking at the Java directory now and there is no bin folder there. What is wrong? A: Sometimes the machine might also include a Java Runtime Environment installation and that is usually installed in C:\program files\java\jre6 or C:\program files\java\jre7 or something similar. Please make sure that you are not looking in that folder. You should make a note of the folder you installed the java development kit. Q: I have completed the configuration but when I try to compile I still get nowhere? Or I get the following errors >The system cannot find the file specified... or >'c:\program' is not recognized as an internal... A: Something is wrong with your configuration retry the steps above making certain that you are actually using the correct folder for your java SE. Last updated by Andreas Grondoudis on: Thursday, 02 February 2012 7

How do I use SciTE for my java programs Run SciTE and type the following code in a new file Then select <File> and <Save> the file under the name Test.java. Now that the file is ready you move on to the compilation of the file. You compile a java program by selecting <Tools> and <Compile Ctrl+F7>. Provided that the configuration was correct; the compiler checks the file and creates a class that can be executed (or run as we say). The output of the compilation is shown on the right hand side of the SciTE window (see below). When you get an >Exit code: 0 this means that everything is OK and the compile operation was successful. Having the file compiled means that we can now run it (or execute it).you execute a file by selecting <Tools> and <Go F5> (or just press the F5 key). The result will be as indicated below The Hello that you see is the execution of the program. The >Exit code: 0 means that execution terminates normally and no errors were reported. This is it. You have compiled and executed a java program called Test. 8 Last updated by Andreas Grondoudis on: Thursday, 02 February 2012

When things go wrong If something was wrong; say you missing the last curly bracket '}' then the compiler will complain by bringing up an error. The following figure illustrates. Notice that line 7 (on the left) is now empty and that the compiler output on the right includes details of 1 error. In the second line of the complier output the compile is showing you: 1) the file in error (Test.java) 2) the line of the error (:6:) and 3) a short error explanation (reached end of file while parsing). Also note that the Exit code is now 1 which means that something went wrong and errors were reported. By double clicking on the error reporting line the editor will take you there (see below) After you correct the error; save the file, compile again and you should be ready to execute. Frequently Asked Questions Q: When I try to compile I get the following: >The system cannot find the file specified... or >'c:\program' is not recognized as an internal... A: Your SciTE does not know where the J2SE is installed. You need to configure your SciTE, please refer to the relevant section above. Q: When I try to compile I get too many mistakes. The right side of SciTE fills up A: When you type a program you have to be very careful of what you are typing. Java is a case sensitive language so System.out is not the same as system.out. It is common for (new) users to have quite a few mistakes. All you have to do is go through your code and correct them Last updated by Andreas Grondoudis on: Thursday, 02 February 2012 9

Appendix A - 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; don t take your frustration out on them. 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 do NOT despair. Usually mistakes at the beginning of the program can cause many mistakes later on. What you should do is scroll-back at the top of the compiler output 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 to 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 possibly 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 many lines inside the brace, you tend to forget to put the closing brace at the end. This leads to the compiler 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. 11. Using Netbeans or Eclipse as your editor: o o CSC131 students: should avoid it. When typing they offer help or autocomplete. That is ok when typing but when writing an exam you will NOT have that and you might find yourself not remembering how to write something simple. CSC132 students: you are not allowed to (especially for GUI development) 10 Last updated by Andreas Grondoudis on: Thursday, 02 February 2012