Chapter 1© copyright Janson Industries 20151 Java ▮ Java programming concepts ▮ Downloading the JDK ▮ Java coding and executing example This presentation.

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.
Lesson One: The Beginning Chapter 2: Processing Learning Processing Daniel Shiffman Presentation by Donald W. Smith Graphics from built-in help reference.
Raymond R. Balise Health Research and Policy
Introduction to Java IEEM241 Routing and Fleet Management Feb 3, 2005.
How to Create a Java program CS115 Fall George Koutsogiannakis.
Java Programming Working with TextPad. Using TextPad to Work with Java This text editor is designed for working with Java You can download a trial version.
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.
Marlene Galea.  The JDK (Java Development Kit)  An IDE (Integrated Development Environment) ◦ Different IDEs include:  JCreator  NetBeans  BlueJ.
SERVLETS.
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 Info Tech Applications Copyright 2003 by Janson Industries This presentation can be viewed on line at:
1 Intro to Programming & Algorithm Design Overview Copyright 2014 by Janson Industries Assg1Assg1 Assg2Assg2.
1 Chapter One A First Program Using C#. 2 Objectives Learn about programming tasks Learn object-oriented programming concepts Learn about the C# programming.
Java Programming, 2E Introductory Concepts and Techniques Chapter 2 Creating a Java Application and Applet.
A First Program Using C#
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.
Java Programming, 3e Concepts and Techniques Chapter 2 - Part 2 Creating a Java Application and Applet.
1 Mobile Computing Set Up Copyright 2015 by Janson Industries.
How Java Programs Work MIS 3023 Business Programming Concepts II The University of Tulsa Professor: Akhilesh Bajaj All slides in this presentation ©Akhilesh.
Chapter 1a© copyright Janson Industries RAD ▮ Explain Eclipse, RAD, and their relationship ▮ Basic RAD concepts ▮ How to install RAD ▮ How to import.
UCSC All rights reserved. No part of this material may be reproduced and sold. 1 IT1202-Fundamentals Of Programming (Using JAVA) Interacting with.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
Putting Applets into Web Pages.  Two things are involved in the process of putting applets onto web pages ◦ The.class files of the applet ◦ The html.
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.
Introduction to the Visual Studio.NET IDE (LAB 1 )
Java and C# [this is a bonus – it is not a required lesson] ACO101: Introduction to Computer Science.
Python From the book “Think Python”
( ) 1 ISYE 7210—Fall 2005 Design of Real-Time Interactive Simulations (in Java) Initial Notes Christine M. Mitchell Director & Professor Center for.
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
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
CHAPTER 3 GC Java Fundamentals. 2 BASICS OF JAVA ENVIRONMENT  The environment  The language  Java applications programming Interface API  Various.
Downloading and Installing Autodesk Revit 2016
9/2/ CS171 -Math & Computer Science Department at Emory University.
Object Oriented Programming Lecture 3. Introduction  In discussing Java, some items need to be clarified  The Java programming language  The Java virtual.
EIE375 BlueJ: Getting Started Dr Lawrence Cheung.
Downloading and Installing Autodesk Inventor Professional 2015 This is a 4 step process 1.Register with the Autodesk Student Community 2.Downloading the.
CMPF124: Basics Skills for Knowledge Workers Manipulating Windows GUI.
JAVA Practical Creating our first program 2. Source code file 3. Class file 4. Understanding the different parts of our program 5. Escape characters.
Tool Install How to download & install Java 6 & Eclipse updated version based on Dr. G. L. Ray’s slides.
Introduction to Python Lesson 1 First Program. Learning Outcomes In this lesson the student will: 1.Learn some important facts about PC’s 2.Learn how.
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.
Using This PowerPoint This PowerPoint presentation assumes your Computer Science teacher has provided you with the InstallingJava folder, which contains.
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.
Creating a Java Application and Applet
Chapter 4© copyright Janson Industries More GUI ▮ Events, Actions, and Listeners ▮ The Visual Editor ▮ More GUI component properties Non-graded assg.
CS1101 Using CourseMarker (CM) CM website: Updated:
Installing Java on a Home machine For Windows Users: Download/Install: Go to downloads html.
Chapter 2: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
CS 201 Lecture 1 (b) Using an IDE Tarik Booker CS 201: Introduction to Programming California State University, Los Angeles.
Chapter 1a© copyright Janson Industries RAD ▮ Explain Eclipse, RAD, and their relationship ▮ Basic RAD concepts ▮ How to install RAD ▮ How to import.
© copyright Janson Industries 2014
Installing Java on a Home machine
Development Environment
Chapter 2: The Visual Studio .NET Development Environment
A Short DOS Presentation
An Introduction to Computers and Visual Basic
Java programming lecture one
An Introduction to Computers and Visual Basic
Installing Java on a Home machine
CS115 HOW TO INSTALL THE JAVA DEVELOPMENT KIT (JDK)
An Introduction to Computers and Visual Basic
Running a Java Program using Blue Jay.
Review of Previous Lesson
Presentation transcript:

Chapter 1© copyright Janson Industries Java ▮ Java programming concepts ▮ Downloading the JDK ▮ Java coding and executing example This presentation can be viewed on line at: Ch1 Assg 3

Java Concepts Chapter 1© copyright Janson Industries ▮ 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

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

Chapter 1© copyright Janson Industries 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 command) 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 command)

Chapter 1© copyright Janson Industries 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 Java Virtual Machine (JVM) ▮ To run a java application on a computer you must download a JVM/JRE (java runtime environment) ▮ But to compile you also need the java compiler ▮ Oracle (and many other vendors) offer ▮ Oracle has a JDK (Java Development Kit) that includes a JRE and the compiler

Chapter 1© copyright Janson Industries JDK (aka JSDK)

Chapter 1© copyright Janson Industries JDK on the PC ▮ Java JDK 8 is an example ▮ Use IE (not Chrome) to download the JDK: ▮ /downloads/index.html /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 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 Select the latest JDK version

Chapter 1© copyright Janson Industries 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 Specify to save the file by clicking the Save drop down button and then Save As

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

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

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

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

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

Chapter 1© copyright Janson Industries 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 To save on typing later, we’ll change directory to just JDK i.e. F:\JDK (or C:\JDK\) then click the OK button

Chapter 1© copyright Janson Industries JDK install window redisplayed with new location Click Next

Chapter 1© copyright Janson Industries 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 Choose drive to save to, then click Make New Folder Then specify jre, click OK

Chapter 1© copyright Janson Industries JRE install window redisplayed with new location

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

Chapter 1© copyright Janson Industries And again…

Chapter 1© copyright Janson Industries 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 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 JDK Install Problems? ▮ Error 1723 occurred in the installer package ▮ Lot’s of possible reasons ▮ Click here for some suggestions Click here

Chapter 1© copyright Janson Industries 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 ▮ For instance, clicking the IE icon tells Windows to “run” iexplore.exe in C:\Program Files\Internet Explorer\

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

Chapter 1© copyright Janson Industries 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 Running a pgm ▮ Let’s prove it ▮ In command prompt we specify iexplore.exe ▮ “Not recognized” message ▮ Now specify fully qualified file name (in quotes) ▮ IE started

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

Chapter 1© copyright Janson Industries Running a pgm ▮ JDK must be in the PC’s path to access the compile (javac) and run (java) commands (as well as other stuff) ▮ Path holds locations of executable 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 Will use Notepad++ to enter source code and save to a file Download Notepad++ from

Chapter 1© copyright Janson Industries Save As to your thumbdrive (so you can run anywhere)

Chapter 1© copyright Janson Industries Click Run, then OK

Chapter 1© copyright Janson Industries Click Next then I Agree

Chapter 1© copyright Janson Industries Specify a location on your thumbdrive (so you can run from anywhere) then click Next Click Next again

Chapter 1© copyright Janson Industries If installing to thumbdrive select first option, if not select third option Click Install Click Finish

Chapter 1© copyright Janson Industries Close change.log

Chapter 1© copyright Janson Industries Running a pgm Enter source code as follows (ignore colors) Then click File, Save

Chapter 1© copyright Janson Industries Start Notepad++, enter source code, and save file with type of java F:\Customer.java (must specify type as All Files) Running a pgm Save to the root of your thumbdrive (i.e. F:\) Change Save as type to Java source file then the file name to Customer.java (must leave.java in file name) Click Save

Chapter 1© copyright Janson Industries Running a pgm A couple java rules: File name (Customer) must match certain statements System.out.println() displays text Statements end in a semicolon (;)

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

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 (source code) and.class (bytecode) files ▮ If files not there, "file not found" msg displayed ▮ Solution ▮ 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 Chapter 1© copyright Janson Industries

Running Chapter 1© copyright Janson Industries ▮ The current/default directory is displayed in the command prompt ▮ In this example it is H:\

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 to be compiled (i.e. F:\ ) (type CD F:\, hit Enter, then type F:, hit Enter) ▮ 3. Convert to byte code (javac Customer.java) ▮ 4. Run the program (java Customer) Chapter 1© copyright Janson Industries

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

Chapter 1© copyright Janson Industries Possible Problems? ▮ javac or java command is not recognized ▮ Why? ▮ Customer not found: NoClassDefFoundError, ClassNotFoundException, could not find the main class ▮ Why? 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 Current directory not where Customer file is located or file name not specified correctly (extra spaces, etc.)

Chapter 1© copyright Janson Industries Possible Problems? ▮ When there are 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 statements that have errors with ^ under where it thinks there are problems

Chapter 1© copyright Janson Industries Possible Problems? ▮ 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

54 In Class Exercise ▮ Create Customer.java and enter the source code using notepad ▮ Compile and run Customer

55 Non-graded Assg3 ▮ Create a java file called Yay that displays the following: ▮ Yay! ▮ My first java program ▮ Send Yay.java as attachment to me at ▮ Specify the topic as Ch01Assg3

56 Non–graded Assg3 ▮ When Yay is run the output should look like this:

57 Graded Assignments ▮ You will have to download lab files (Word documents) for the graded assignments ▮ Create a folder on your memory stick to hold the files (and your work) called COP1000 ▮ Download the labs from the the folder Labs at the same location as the PP presentations

58 Java ▮ Java Language Companion (JLC) guide ▮ This is the Java text book ▮ In a PDF file at the same location as the PP presentations and labs ▮ Download and read

Chapter 1© copyright Janson Industries

Chapter 1© copyright Janson Industries No graded assg until C2 but you can start before

Chapter 1© copyright Janson Industries The Word doc contains several non-graded assgs (labs) and one graded assg (usually the last lab in the doc)