Instructions. First, download the file

Similar documents
The Command Shell. Fundamentals of Computer Science

Life Without NetBeans

Getting Started with Java. Atul Prakash

Setting up your Computer

Lesson 04: Our First Java Program (W01D4

CSC116: Introduction to Computing - Java

CPSC 150 Laboratory Manual. Lab 1 Introduction to Program Creation

CSC116: Introduction to Computing - Java


Getting Started with Eclipse/Java

IT151: Introduction to Programming (java)

Eclipse Environment Setup

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

CSC116: Introduction to Computing - Java

Chapter Two Bonus Lesson: JavaDoc

Introduction to REXX Programming Language

3 CREATING YOUR FIRST JAVA APPLICATION (USING WINDOWS)

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

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

IntelliJ IDEA Getting Started Guide for FIRST Robotics Competition

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

CMSC 201 Spring 2018 Lab 01 Hello World

CMSC 201 Spring 2017 Lab 01 Hello World

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

Linux File System and Basic Commands

You will need to download the Java software development kit from

COMP 110/401 WINDOWS COMMAND INTERPRETER. Instructor: Prasun Dewan (FB 150,

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

Special Edition Using Java Installing the JDK and Getting Started

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

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

Science One CS : Getting Started

You should see something like this, called the prompt :

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

Software Installation Guide

: the User (owner) for this file (your cruzid, when you do it) Position: directory flag. read Group.

Command Line Navigation and Compiling

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

lejos NXJ Problem Solving with Robots [PRSOCO601]

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

Android Studio Setup Procedure

Installation on a Macintosh

RTMS - Software Setup

Getting Started with Command Prompts

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

For live Java EE training, please see training courses at

Working Outside the Lab

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

Manually Java 7 Update Bit Windows 7

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

Introduction to Linux. Fundamentals of Computer Science

Notes By: Shailesh Bdr. Pandey, TA, Computer Engineering Department, Nepal Engineering College

Physics REU Unix Tutorial

Chapter 2. Editing And Compiling

WA1927 Introduction to Struts 2.x Using Eclipse. Classroom Setup Guide. Web Age Solutions Inc. Copyright Web Age Solutions Inc.

L.A.M.P. Stack Part I

Wentworth Institute of Technology. Engineering & Technology WIT COMP1000. Java Basics

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

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

Refresher workshop in programming for polytechnic graduates General Java Program Compilation Guide

Purpose. Why use Java? Installing the Software. Java

INFO Object-Oriented Programming

This section contains information you should review before using this book. Any updates to the information presented here will be posted at:

Object-Oriented Programming in Java

WA1958 Mobile Software Design Patterns and Architecture Android Edition. Classroom Setup Guide. Web Age Solutions Inc.

History of Java. Java was originally developed by Sun Microsystems star:ng in This language was ini:ally called Oak Renamed Java in 1995

WA1884 Introduction to Java. using Oracle JDeveloper 11g. Classroom Setup Guide. Web Age Solutions Inc. Copyright Web Age Solutions Inc.

This guide will walk you through the steps for installing and using wget on Windows.

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

CPSC 324 Topics in Java Programming

Certified Core Java Developer VS-1036

WA1739 Oracle WebLogic Server 10.3 Performance Tuning. Classroom Setup Guide. Web Age Solutions Inc. Copyright 2009 Web Age Solutions Inc.

1. Download the JDK 6, from

Dspace 5.1. Installation on Windows 7 (32 bit system)

Lecture (01) Getting started. Dr. Ahmed ElShafee

CSE 303 Lecture 2. Introduction to bash shell. read Linux Pocket Guide pp , 58-59, 60, 65-70, 71-72, 77-80

Lab: Supplying Inputs to Programs

CS 177 Recitation. Week 1 Intro to Java

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

Chapter 1 Getting Started Installing Java (v1.8) Installing Dr. Java Hello, World! Java Basics

Unit 10. Linux Operating System

WA2442 Introduction to JavaScript. Classroom Setup Guide. Web Age Solutions Inc. Copyright Web Age Solutions Inc. 1

Linux hep.wisc.edu

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

Crash Course in Unix. For more info check out the Unix man pages -orhttp:// -or- Unix in a Nutshell (an O Reilly book).

CSC111 Computer Science II

Setup and Getting Startedt Customized Java EE Training:

How to Install (then Test) the NetBeans Bundle

3. Hello World! for IDEA. Java. Summer 2008 Instructor: Dr. Masoud Yaghini

List of Slides 1 Title 2 Chapter 2: Sequential execution and program errors 3 Chapter aims 4 Section 2: Example:Hello world 5 Aim 6 Class: programs ar

Lecture 2. COMP1406/1006 (the Java course) Fall M. Jason Hinek Carleton University

1. Open VirtualBox and start your linux VM. Boot the machine and log in with the user account you created in Lab #1. Open the Terminal application.

Supplement B. Creating, Compiling and Running Java Programs from the Command Window

Setting up a compiler

If you are on a Mac/Linux box, some commands will differ, but many will be the same.

CS 170 Java Tools. Step 1: Got Java?

Installing Eclipse (C++/Java)

CSCI 161: Introduction to Programming I Lab 1a: Programming Environment: Linux and Eclipse

Welcome to Kmax Installing Kmax

Manually Java 7 Update Bits Windows 7

Transcription:

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), textedit (macintosh) or emacs (linux). Depending on how your computer is set up, you may need to first open notepad/textedit and THEN click file-->open as opposed to double clicking. When you write a program from scratch, you need to be careful of a few things: 1)On windows, when you save, make sure to save as HelloWorld.java and not HelloWorld.java.txt (select all files when you choose where to save and put HelloWorld.java in quotations) 2)On Mac, make sure when you click format that there is no button make plain text (If there is, then click the button to make it plain text) 3)Always make sure the file name matches exactly (including upper/lowercase the first line public class HelloWorld 4)Note the folder where you saved this file. This will be used later on. On Mac, it is useful to put it within a subfolder of Documents COMP-202 - Course Details 1

Mac Instructions Most likely, on a Macintosh computer, Java is already installed. All you need to do is open up a terminal prompt to be able to run it. Click applications--->utilities and look for a program called terminal You'll probably want to drag it to the bottom of the screen as you'll use it frequently Now open this program and a black box will appear. Type pwd and then enter You'll see a folder on your computer. It will most likely be something like: /Users/daniel The first thing you need to do is change folders to where you saved HelloWorld.java If you saved it in a folder such as Documents/ something or other you can type cd Documents/comp202/exampleprogram (if you have spaces in your folders then you need to do cd Documents\comp 202\example program with quotes around the folder path) Now skip ahead a few slides to the merged instructions COMP-202 - Course Details 2

1)If you don't have Java development kit installed, install it. Make sure to get version 6 at least. http://www.oracle.com/technetwork/java/javase/documentation/install-windows-152927.html (instructions) http://www.oracle.com/technetwork/java/javase/downloads/jdk6u35-downloads-1836443.html (link to download the update is fine) http://download.cnet.com/java-se-6-0-jdk-6/3000-2212_4-10857945.html (also should work) 2)Install Java by double clicking the exe and following the instructions COMP-202 - Course Details 3

3)The next step is to locate the folder that Java is installed in. It should be something like: C:\Program Files\java\jdk1.6\ Now within this folder, look for a folder called bin and inside this an exe file called javac The exe javac is what you will use to convert your source code written in the programming language Java, to something the computer can understand better. However, you will not run the program javac in the usual way of double clicking it. COMP-202 - Course Details 4

3)The next step is to locate the folder that Java is installed in. It should be something like: C:\Program Files\java\jdk1.6\ Now within this folder, look for a folder called bin and inside this an exe file called javac. Select this whole path (including /bin but not javac) and copy it using ctrl+c if necessary) It is important you copy it EXACTLY The exe javac is what you will use to convert your source code written in the programming language Java, to something the computer can understand better. However, you will not run the program javac in the usual way of double clicking it. COMP-202 - Course Details 5

4)Tell your computer where it can find javac and java by adding this path you copied to your environment variable called PATH http://docs.oracle.com/javase/tutorial/essential/environment/paths.html -Follow the instructions at the above link. You'll want to make sure that the PATH variable includes something like the following: C:\Java\jdk1.6.0\bin;C:\Windows\System32\;C:\Windows\;C:\Windows\System 32\Wbem The bold is the path you copied in the previous step. If it is not there, then you need to add it by adding a ; at the end of list, then put the path there. Make sure this is EXACTLY the path where the file javac and java can be found. Note that this step you will only need to do one time COMP-202 - Course Details 6

5)Type start-->run. Then type cmd. A black box should appear. Type javac and then enter COMP-202 - Course Details 7

6)If you get a message such as command not found it means you did not properly install Java or set up the path in the prior steps. If you get a more verbose message starting with no input files then congratulations, you have properly installed everything and we can now go on to run a Java program. If you can't fix this but you are able to find a file javac on your computer, another option, in the short run is to type: C:\program files\jdk1.6.0\bin\javac HelloWorld.java (or whatever folder your file javac is in). COMP-202 - Course Details 8

7)First, notice at the prompt that a folder is displayed. In the screen shot above it is C:\Documents and Settings\Administrator You need to make this folder match the folder that you saved your.java file in. To do this there are a few ways. The simplest is to type: cd the full path with the folder (e.g. cd C:\comp202\testprograms ) Also can do it one directory at a time: cd foo -->changes into a folder foo that is inside current folder cd.. ---> changes to parent folder cd C:\ --> changes to root folder D: ----> changes to D drive COMP-202 - Course Details 9

Merged instructions : Compiling your code Once you have changed folders and have everything set up, type: javac HelloWorld.java then hit enter. If this works successfully, you will see nothing at this point. If you then look inside the folder by typing dir on windows or ls on Mac (or view in the normal way to view folders with graphics), you'll see a file HelloWorld.class now This file is the file that was created by the program javac. It is your source code (human text) converted to a format the computer can understand. This is called compiling your code If any grammatical errors occurred in your program, you will get errors at this point and no new.class file will be created. (Experiment with this by, for example, deleting one of the { from the HelloWorld.java file and see what happens) COMP-202 - Course Details 10

Merged instructions : Running your program Once you create the.class file, you can run your program by typing: java HelloWorld Be careful because it is case sensitive. Typing java helloworld will give an error. If everything worked, the words Hello world! should print to the screen. Congratulations! In Java you will always run a.class file, hence it is not necessary (or allowed) to type java HelloWorld.class as this means something entirely different. COMP-202 - Course Details 11