© copyright Janson Industries 2014

Slides:



Advertisements
Similar presentations
Installing DOS and Windows98 under MS Virtual PC.
Advertisements

1 eclipse Tips. 2 What is eclipse? Eclipse is a popular IDE (Integrated Development Environment) that we will use to create, compile, execute, and test.
Lab6 – Debug Assembly Language Lab
CPSC150 Fall 2008 Dr. L. Lambert. CPSC150 Overview Syllabus Use Textbook, ask questions, extra thorough, I will post sections covered All information.
Introduction to Java IEEM241 Routing and Fleet Management Feb 3, 2005.
1 Mobile Computing Mobile First (formerly Worklight) Copyright 2015 by Janson Industries.
How to Create a Java program CS115 Fall George Koutsogiannakis.
CS115 HOW TO INSTALL THE JAVA DEVELOPMENT KIT (JDK)
Introduction to Java.
Command Console Tutorial BCIS 3680 Enterprise Programming.
CS0007: Introduction to Computer Programming Setting Up Java.
VMWare Workstation Installation. Starting Vmware Workstation Go to the start menu and start the VMware Workstation program. *Note: The following instructions.
SET UP COMPUTER ** PLEASE BE AWARE SCREENSHOTS MAY NOT MATCH **
Marlene Galea.  The JDK (Java Development Kit)  An IDE (Integrated Development Environment) ◦ Different IDEs include:  JCreator  NetBeans  BlueJ.
Editing Java programs with the BlueJ IDE. Working environments to develop (= write) programs There are 2 ways to develop (write) computer programs: 1.Using.
1 Intro to Programming & Algorithm Design Overview Copyright 2014 by Janson Industries Assg1Assg1 Assg2Assg2.
Microsoft Windows LEARNING HOW USE AN OPERATING SYSTEM 1.
1 Mobile Computing Set Up Copyright 2015 by Janson Industries.
Chapter 1a© copyright Janson Industries RAD ▮ Explain Eclipse, RAD, and their relationship ▮ Basic RAD concepts ▮ How to install RAD ▮ How to import.
Playing Music in Alice By David Yan Under the direction of Professor Susan Rodger July 2015.
Chapter 1© copyright Janson Industries Java ▮ Java programming concepts ▮ Downloading the JDK ▮ Java coding and executing example This presentation.
UCSC All rights reserved. No part of this material may be reproduced and sold. 1 IT1202-Fundamentals Of Programming (Using JAVA) Interacting with.
Java ACO101: Introduction to Computer Science. The History of Java Started out as a research project at Sun Microsystems in 1991 Code named “Green” Based.
Java and C# [this is a bonus – it is not a required lesson] ACO101: Introduction to Computer Science.
COP 3330 Notes 1/12. Today's topics Downloading Java and Eclipse Hello World Basic control structures Basic I/O Strings.
Introduction to Eclipse CSC 216 Lecture 3 Ed Gehringer Using (with permission) slides developed by— Dwight Deugo Nesa Matic
Downloading and Installing Autodesk Revit 2016
9/2/ CS171 -Math & Computer Science Department at Emory University.
Downloading and Installing Autodesk Inventor Professional 2015 This is a 4 step process 1.Register with the Autodesk Student Community 2.Downloading the.
Tool Install How to download & install Java 6 & Eclipse updated version based on Dr. G. L. Ray’s slides.
Java Programming, Second Edition Appendix A Working with Java SDK 1.4.
Chapter 2© copyright Janson Industries Java ▮ Java/PC programming environment ▮ Java syntax rules ▮ Java documentation ▮ Java/RAD coding example.
1 Installing Java on Your PC. Installing Java To develop Java programs on your PC: Install JDK (Java Development Kit) Add the directory where JDK was.
CS1101 Using CourseMarker (CM) CM website: Updated:
Installing Java on a Home machine For Windows Users: Download/Install: Go to downloads html.
Java On the ENB 116 Computers The JDK is now available on the ENB 116 computers. You can use a classroom computer rather than your own laptop or CIRCE.
การเขียนโปรแกรมภาษา จาวา Java Programming อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา Chapter 1.
CS 201 Lecture 1 (b) Using an IDE Tarik Booker CS 201: Introduction to Programming California State University, Los Angeles.
Downloading and Installing GRASP-AF Workshop Ian Robson Information Analyst, North of England Cardiovascular Network.
CACI Proprietary Information | Date 1 Upgrading to webMethods Product Suite Name: Semarria Rosemond Title: Systems Analyst, Lead Date: December 8,
Chapter 1a© copyright Janson Industries RAD ▮ Explain Eclipse, RAD, and their relationship ▮ Basic RAD concepts ▮ How to install RAD ▮ How to import.
Downloading & Installing the BIT115 Software & Programs
CS210 Intermediate Computing with Data Structures (Java)
Installing and Learning Software
Installing Java on a Home machine
Lecture 1b- Introduction
Introduction to Java Import Scanner class to use in our program
Development Environment
Installing and Learning Software
Key Ideas from day 1 slides
Java on the LEGO Mindstorms EV3
An Introduction to Computers and Visual Basic
First Class In-Service
Programming without BlueJ Week 12
Java programming lecture one
An Introduction to Computers and Visual Basic
Introduction to Java Dept. Business Computing University of Winnipeg
Installing Java on a Home machine
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
How to Run a Java Program
CS115 HOW TO INSTALL THE JAVA DEVELOPMENT KIT (JDK)
Download and Installation of code::blocks
An Introduction to Computers and Visual Basic
Introduction to Object-Oriented Programming in Alice
Java IDE Dwight Deugo Nesa Matic Portions of the notes for this lecture include excerpts from.
Running a Java Program using Blue Jay.
Chapter 1 Introducing Small Basic
Review of Previous Lesson
How to Run a Java Program
Presentation transcript:

© copyright Janson Industries 2014 Java How the class works Java programming concepts Downloading the JDK Java coding and executing example Chapter 1 © copyright Janson Industries 2014

© copyright Janson Industries 2014 PP Presentations Can be viewed online or downloaded Go to: web.fscj.edu/Janson/COP2551 For all presentations and class files Chapter 1 © copyright Janson Industries 2014

© copyright Janson Industries 2014 Or you can go to my school website (web.fscj.edu/Janson) and click on this link Chapter 1 © copyright Janson Industries 2014

Click file name (link) to view online… This presentation is 4thed.Ch01.ppt Click file name (link) to view online… Chapter 1 © copyright Janson Industries 2014

© copyright Janson Industries 2014 Or choose Save as Chapter 1 © copyright Janson Industries 2014

© copyright Janson Industries 2014 How Class Works Do the non-graded exercises first They will help you solve the graded assgs I can help you with these assgs/probs Keep track of the probs and solutions You will make the same mistakes many times Graded assgs (the Tutorials in the chapter and Challenge Exs) are for you (and you alone) to complete Chapter 1 © copyright Janson Industries 2014

© copyright Janson Industries 2014 How Class Works Tutorials (chapters 1-7) are 10% of your grade Challenge Exercises (Review Exercises at the end of chapters 1-7) are 20% Extra Credit (chapters 8-10 Tutorials) are extra 5% Must do non-graded assgs to get credit for graded assgs Chapter 1 © copyright Janson Industries 2014

© copyright Janson Industries 2014 How Class Works Tests are composed of 50 multiple choice questions To get an A you will have to do the Review Exercises Strongly advise you to do all of them You can also do the end of chapter challenge exercises If you can do all these you probably know the material Chapter 1 © copyright Janson Industries 2014

© copyright Janson Industries 2014 How Class Works If you come to a lecture, listen and take notes You will not learn the material by listening to the lecture and viewing the slides once You need to study/do the material covered in the lecture and examples And doing an exercise correctly once doesn’t necessarily mean you know it! This class assumes you all have WIN 7 Chapter 1 © copyright Janson Industries 2014

© copyright Janson Industries 2014 How Class Works You will need a thumb drive for the class to store all your assgs Suggestion: create a file named ICE or IFFOUND and put in some contact info for yourself This may mean you will get it back when you lose it ;-) Chapter 1 © copyright Janson Industries 2014

© copyright Janson Industries 2014 Classroom Computers The anti-virus s/w does not play nicely with RAD You need to sign on to the computers using the following: User id .\ibm PW cop2551 Chapter 1 © copyright Janson Industries 2014

How Class Works How long has it been since you took COP1000? Code.org 4/12/2018 How Class Works How long has it been since you took COP1000? Code.org Uses videos and games to get across the basic programming structures which you are already expected to understand http://learn.code.org/hoc/1

You can skip the video and go straight to the instructions Once done with instruction, close window and try exercises

The first puzzle will start

There may be more instructions, click X's to close When puzzle finished will allow you to continue to the next one or you can click to skip ahead There may be more instructions, click X's to close

Click Continue to go to next puzzle

Click Continue to go to next puzzle

If you can't figure it out, scroll down and click the help links

How Class Works There's an entire COP1000 set of lessons at 4/12/2018 How Class Works There's an entire COP1000 set of lessons at http://learn.code.org/

Unplugged activites have the theory – good to read first Then tackle the puzzles

© copyright Janson Industries 2014 Java Concepts Java source code stored in files with an extension of .java The source code is “compiled”, meaning: Translated into bytecode Bytecode stored in class files (files with an extension of .class) Bytecode is a “cross-platform program representation” that is non-executable Chapter 1 © copyright Janson Industries 2014

© copyright Janson Industries 2014 Java Concepts Cust.java (Java file) Cust.class (Class file) Java source code Java bytecode Editor Compiler Java source code javac Cust.java Programmer Programmer Chapter 1 © copyright Janson Industries 2014

© copyright Janson Industries 2014 Java Concepts Review: files with an extension of .java contain source code Review: files with an extension of .class contain “bytecode” .java files are “compiled” (javac) to create .class files Bytecode is a cross-platform program representation that is non-executable New: bytecode needs to be translated to machine language (java) Chapter 1 © copyright Janson Industries 2014

Java Virtual Machine (JVM) JVM is “the place” (i.e. s/w) where the .class files (i.e. programs) are translated The JVM is invoked with the java command The JVM translates bytecode into machine language and sends to CPU for execution (i.e. program is run) Therefore, each "type" of computer needs a unique JVM Chapter 1 © copyright Janson Industries 2014

© copyright Janson Industries 2014 Java Concepts Cust.java (Java file) Cust.class (Class file) CPU Java source code Java bytecode main method in Machine Language Editor Compiler JVM Java source code javac Cust.java java Cust Programmer Programmer Programmer Chapter 1 © copyright Janson Industries 2014

Java Virtual Machine (JVM) To run a java application on a computer you must download a JVM/JRE (java runtime environment) Oracle (and many other vendors) offer Oracle has a JDK (Java Development Kit) that includes a JRE (and compiler) Chapter 1 © copyright Janson Industries 2014

© copyright Janson Industries 2014 JDK (aka JSDK) Chapter 1 © copyright Janson Industries 2014

© copyright Janson Industries 2014 JDK on the PC Java JDK 8 is an example Use IE (not Chrome) to download the JDK: http://www.oracle.com/technetwork/java/javase/downloads/index.html Select the latest version Click on the JDK download button for the latest update (i.e. JDK 8, or JDK8u60, etc.) Select the JDK for your computer (i.e. Windows) Download to thumb drive (G:) or your C drive (at home) Chapter 1 © copyright Janson Industries 2014

© copyright Janson Industries 2014 JDK on the PC To install the JDK: Run jdk-8(u#)-windows-i586-p.exe (where # is the latest version and update numbers) During the install, create folders to hold the JDK and JRE called jdk and jre Delete the original .exe file jdk-8(u#)-windows-i586-p.exe Chapter 1 © copyright Janson Industries 2014

Select the latest JDK version Chapter 1 © copyright Janson Industries 2014

Scroll down and click the accept agreement radio button Double click the operating system of the lab computers (Windows x86) Chapter 1 © copyright Janson Industries 2014

© copyright Janson Industries 2014 Specify to save the file by clicking the Save drop down button and then Save As Chapter 1 © copyright Janson Industries 2014

© copyright Janson Industries 2014 Create a folder called jdkzip on your thumb drive (or the C: if you will always being work on that same computer) and save the .exe file to jdkzip Chapter 1 © copyright Janson Industries 2014

Using My Computer open the jdkzip folder Chapter 1 © copyright Janson Industries 2014

© copyright Janson Industries 2014 JDK on the PC Only takes up 165 meg Final install will take up ~180 meg Run the exe file by double clicking Click the Next button Chapter 1 © copyright Janson Industries 2014

If you get this, you downloaded the wrong JDK Chapter 1 © copyright Janson Industries 2014

Or this (or any other msg), you downloaded the wrong JDK Chapter 1 © copyright Janson Industries 2014

Accept the default components (notice the JRE is just one part of the JDK) You can control where the JDK is installed by clicking the Change... button Chapter 1 © copyright Janson Industries 2014

© copyright Janson Industries 2014 To save on typing later, we’ll change directory to just JDK i.e. E:\JDK (or C:\JDK\) then click the OK button Chapter 1 © copyright Janson Industries 2014

JDK install window redisplayed with new location Click Next Don't need to create the jdk folder first. Chapter 1 © copyright Janson Industries 2014

Shows where JRE will be installed. Change to… Some students tell me this screen doesn’t appear, if it doesn’t – no problem, skip the next two slides. Chapter 1 © copyright Janson Industries 2014

Choose drive to save to, then click Make New Folder Then specify jre, click OK Chapter 1 © copyright Janson Industries 2014

JRE install window redisplayed with new location, click Next Chapter 1 © copyright Janson Industries 2014

You may have to shut down some running apps Chapter 1 © copyright Janson Industries 2014

© copyright Janson Industries 2014 And again… Depending on where you installing, could take a while (a thumb drive will take longer than a hard drive) Chapter 1 © copyright Janson Industries 2014

Two folders called jdk and jre are created (verify with My Computer) Delete jdkzip\jdk-8(u#)-windows-i586-p.exe and click the Close button Chapter 1 © copyright Janson Industries 2014

© copyright Janson Industries 2014 To verify that you installed correctly, display the contents of jdk/bin folder and make sure you have two executable files called javac and java Chapter 1 © copyright Janson Industries 2014

© copyright Janson Industries 2014 Running a pgm When you run a application in Windows, you are specifying an executable file name Executable files contain machine language On Windows machines these files have names that end in .exe Chapter 1 © copyright Janson Industries 2014

© copyright Janson Industries 2014 For instance, clicking the IE icon tells Windows to “run” iexplore.exe in C:\Program Files\Internet Explorer\ Chapter 1 © copyright Janson Industries 2014

© copyright Janson Industries 2014 C:\Program Files\Internet Explorer\iexplore.exe is a fully qualified file name Chapter 1 © copyright Janson Industries 2014

© copyright Janson Industries 2014 Running a pgm If a fully qualified file name is not specified, Windows searches 1. The default (aka current) directory 2. The locations stored in the the Environment Variable called PATH I.e. path holds all the locations Windows should search when an unqualified file name is specified You can control the value of the Path variable Let’s prove it!! Chapter 1 © copyright Janson Industries 2014

© copyright Janson Industries 2014 Running a pgm In command prompt we specify iexplore.exe You get the “Not recognized” message Now specify fully qualified file name (in quotes) Internet Explorer is started Start button, All Programs, Accessories, then Command Prompt or Start button, in search box type cmd, click on cmd.exe Chapter 1 © copyright Janson Industries 2014

© copyright Janson Industries 2014 Running a pgm Now we will set the path value path = "C:\Program Files\Internet Explorer\" In command prompt we specify iexplore.exe Internet Explorer started Chapter 1 © copyright Janson Industries 2014

© copyright Janson Industries 2014 Running a pgm JDK/bin must be in the PC’s path for Windows to access the compile (javac) and run (java) commands Path holds the locations to search for files Several ways to define path locations Each time you go to the command prompt (depending on where jdk installed) enter path=f:\jdk\bin or path=c:\jdk\bin Chapter 1 © copyright Janson Industries 2014

Running a pgm Start Notepad, enter source code, and save file with type of java F:\Customer.java (must specify type as All Files) Chapter 1 © copyright Janson Industries 2014

Running a pgm To run, bring up the Command Prompt by clicking: Start, Accessories, Command Prompt Chapter 1 © copyright Janson Industries 2014

© copyright Janson Industries 2014 Running When javac and java commands are run, at first they do the same thing as Windows They check the default directory for the java and bytecode files If files not there, "file not found" msg displayed 2 solutions Change current directory to the location of the files with the CD (change directory) command CD F:\, hit Enter, then type F:, hit Enter again Include files location in classpath variable Chapter 1 © copyright Janson Industries 2014

© copyright Janson Industries 2014 Running 1. Issue the path command so that jdk/bin is in the path 2. If necessary, change the default path to the location of the java file (i.e. F:\ ) (type CD F:\, hit Enter, then type F:, hit Enter) 3. Convert to bytecode (javac Customer.java) 4. Convert bytecode to machine language and run the program (java Customer) Chapter 1 © copyright Janson Industries 2014

Running Prompt shows the default directory Customer.java is on F:\ current directory is H:\ so “file not found” Must change current directory to location of Customer.java (i.e. F:\) Customer.java found cause default directory is F: Chapter 1 © copyright Janson Industries 2014

© copyright Janson Industries 2014 Running a pgm It’s that easy! But not very pretty both in terms of The application function and appearance The development environment So we’ll change how we do several things Chapter 1 © copyright Janson Industries 2014

Making Programming Easier Easier ways to set up path and default dir Use an IDE (Integrated Development Environment) instead of notepad Eclipse Rational Application Developer (RAD) NetBeans Learn more java so that the application GUI is PURTY Chapter 1 © copyright Janson Industries 2014

© copyright Janson Industries 2014 JDK Install Problems? Error 1723 occurred in the installer package Lot’s of possible reasons Click here for some suggestions Chapter 1 © copyright Janson Industries 2014

© copyright Janson Industries 2014 Possible Problems? javac or java command is not recognized Why? Customer file not found: NoClassDefFoundError, ClassNotFoundException, could not find the main class Path not defined correctly. Common mistakes: wrong drive letter, incorrect directory name(s), extra spaces after bin, when installing you mixed up jdk and jre directories Path not defined correctly. Common mistakes: wrong drive letter, incorrect directory name(s), extra spaces after bin, when installing mixed up jdk and jre directories. Current directory not where Customer file is located (later Classpath not defined correctly) or file name not specified correctly (extra spaces, etc.) Current directory not where Customer file is located (or per book, Classpath not defined correctly) or file name not specified correctly (extra spaces, etc.) Chapter 1 © copyright Janson Industries 2014

© copyright Janson Industries 2014 Possible Problems? When there are Java syntax errors, JVM will show: A message with useful info File name: Customer.java Line number that has the error: 10 What the problem is: ‘;’ expected The source code statement(s) that have errors with ^ under where it thinks there are problems Chapter 1 © copyright Janson Industries 2014

© copyright Janson Industries 2014 Possible Problems? Common Java syntax errors Upper case/lower case letters are different If example shows upper case letter, you must use upper case letter Forward slash (/) back slash (\) are different println (means: print line) not printIn Chapter 1 © copyright Janson Industries 2014

© copyright Janson Industries 2014 Changes We’re going to use RAD instead of notepad Ch01a slides are next Chapter 1 © copyright Janson Industries 2014

© copyright Janson Industries 2014 But first…. Class exercise: Download the JDK to the F: or C: or... I suggest your thumb drive Install it Setup the path and default directory Enter the source code (exactly as shown on the slide) javac and java to run the program Chapter 1 © copyright Janson Industries 2014