The Java Technical Details. ICW Lecture 3 Tom Chothia

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

IT151: Introduction to Programming (java)

Introduction to Java Programming

Java Programming. Manuel Oriol, March 22nd, 2007

Notes of the course - Advanced Programming. Barbara Russo

Installation guide for Java. Step by Step Guide. A C A D G I L D Page 1

Java Programming Language Mr.Rungrote Phonkam

Getting Started with Eclipse/Java

Outline. Introduction to Java. What Is Java? History. Java 2 Platform. Java 2 Platform Standard Edition. Introduction Java 2 Platform

3 CREATING YOUR FIRST JAVA APPLICATION (USING WINDOWS)

Certified Core Java Developer VS-1036

What s NetBeans? Like Eclipse:

USING THE OOSIML/JAVA. With a Terminal Window

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.

Learning objectives. The Java Environment. Java timeline (cont d) Java timeline. Understand the basic features of Java

CSE 421 Course Overview and Introduction to Java

II. Compiling and launching from Command-Line, IDE A simple JAVA program

APIs - what are they, really? Web API, Programming libraries, third party APIs etc

Chapter 1 Introduction to Computers, Programs, and Java

History Introduction to Java Characteristics of Java Data types

Advanced Object-Oriented Programming Introduction to OOP and Java

Javac and Eclipse tutorial

Java is a high-level programming language originally developed by Sun Microsystems and released in Java runs on a variety of

CS5015 Object-oriented Software Development. Lecture: Overview of Java Platform. A. O Riordan, 2010 Most recent revision, 2014 updated for Java 8

IQTIDAR ALI Lecturer IBMS Agriculture University Peshawar

Matrex Table of Contents

CHAPTER 1. Introduction to JAVA Programming

WebSphere System Architect Code Packaging and Deployment

Component Based Software Engineering

Introduction to Programming (Java) 2/12

Lesson 01 Introduction

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

Lecture (01) Getting started. Dr. Ahmed ElShafee

This tutorial will teach you how to use Java Servlets to develop your web based applications in simple and easy steps.

USING THE OOSIML/JAVA COMPILER. With the Command Window

CMSC 132: Object-Oriented Programming II

History of Enterprise Java

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

25. DECUS Symposium THE Application Development Environment for OpenVMS

[Course Overview] After completing this module you are ready to: Develop Desktop applications, Networking & Multi-threaded programs in java.

Fundamentals of Programming. By Budditha Hettige

Lecture 1: Introduction to Java

Compiling Regular Expressions COMP360

Programming. Syntax and Semantics

I/O and Parsing Tutorial

Introduction to JAVA Programming Language

12/22/11. Java How to Program, 9/e. Help you get started with Eclipse and NetBeans integrated development environments.

Chapter 4 Java Language Fundamentals

Designing a Distributed System

Architecting Java solutions for CICS

Class Dependency Analyzer CDA Developer Guide

Java Language. Programs. Computer programs, known as software, are instructions to the computer. You tell a computer what to do through programs.

Lecture 4: Introduction to Java and your Development Environment

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

Ibis RMI User s Guide

Chapter 1: Introduction to Computers and Java

8/23/2014. Chapter Topics. Introduction. Java History. Why Program? Java Applications and Applets. Chapter 1: Introduction to Computers and Java

B.V. Patel Institute of BMC & IT, UTU 2014

Chapter 1 Introduction to Computers, Programs, and Java. What is a Computer? A Bit of History

Exercise ANTLRv4. Patryk Kiepas. March 25, 2017

The Command Shell. Fundamentals of Computer Science

CS260 Intro to Java & Android 02.Java Technology

Chapter 2 Author Notes

An Integrated Approach to Managing Windchill Customizations. Todd Baltes Lead PLM Technical Architect SRAM

Interpreting Languages for the Java Platform

Project 1. Java Control Structures 1/17/2014. Project 1 and Java Intro. Project 1 (2) To familiarize with

CT 229. CT229 Lecture Notes. Labs. Tutorials. Lecture Notes. Programming II CT229. Objectives for CT229. IT Department NUI Galway

Lab # 2. For today s lab:

1. Introduction. Java. Fall 2009 Instructor: Dr. Masoud Yaghini

Course Description. Learn To: : Intro to JAVA SE7 and Programming using JAVA SE7. Course Outline ::

DAY 3 J2ME Aalborg University, Mobile Device Group. Mobile. Mobile Phone Programming

Last Time. University of British Columbia CPSC 111, Intro to Computation Alan J. Hu. Readings

What is Java Platform?

Deploying Java Platform, Standard Edition (Java SE Platform) in Today s Embedded Devices

Java SE 7 Programming

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

Java language. Part 1. Java fundamentals. Yevhen Berkunskyi, NUoS

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

JavaCC: SimpleExamples

Introduction. Overview of the Course on Java. Overview of Part 1 of the Course

C++ Spring Break Packet 11 The Java Programming Language

Java Training For Six Weeks

Outline. Overview. Control statements. Classes and methods. history and advantage how to: program, compile and execute 8 data types 3 types of errors

Generic Language Technology

Chapter 2 FEATURES AND FACILITIES. SYS-ED/ Computer Education Techniques, Inc.

Introduction to Java. Liang, Introduction to Java Programming, Ninth Edition, (c) 2013 Pearson Education, Inc. All rights reserved.

COP 3402 Systems Software. Lecture 4: Compilers. Interpreters

Assoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.

Baby Steps: Some Simple Programs in C, C++, and Java

Page 1 of 6. tpfdf/rt/readme_sdo.txt. Service Data Objects (SDO) Access to z/tpfdf - PUT 05

Unit Tests. Unit Testing. What to Do in Unit Testing? Who Does it? 4 tests (test types) You! as a programmer

Attacks Against Websites 3 The OWASP Top 10. Tom Chothia Computer Security, Lecture 14

COPYRIGHTED MATERIAL

Advanced programming for Java platform. Introduction


AP Computer Science Summer Assignment (updated 5/29/2018) DUE : Sept. 4, 2018

: Primitive data types Variables Operators if, if-else do-while, while, for. // // First Java Program. public class Hello {

5 Distributed Objects: The Java Approach

J2EE Interview Questions

CHAPTER 1 Introduction to Computers and Java

Transcription:

The Java Technical Details ICW Lecture 3 Tom Chothia

Reminder of Last Time: Your programs defines Classes. Each class defines Objects. An Object is defined as having a number of Fields that store data......and a number of Methods that perform computation.

This Time: How does Java actually work. Byte code, JVMs, Classpaths,... A short history of Java What was added when and what s coming next. Pasrsing How to turn test into a data structure you can work with.

To Run a Java Program Write the source.java program. Compile the source using javac to get a.class file. Run the source using java.

To Run a Java Program Write the source.java program. Compile the source using javac to get a.class file. Run the source using java. but the.class file runs on any computer! How?

Multi-platform. Java does compile to machine code. Java compiles to Java Byte Code. Type: javap -c <ClassName> to see the byte code. Every computer must have its own Java Virtual Machine (JVM) which runs the the byte code. Every different OS must have it s own JVM

Java Program.java Compile Java to Byte Code Using javac Java Byte Code.class Run Byte Code On JVM using java Windows JVM Windows Computer Linux JVM Linux Computer Phone JVM Mobile Phone

Java Byte Code Java Byte Code is very close to assembler. But where is the system.print code?

APIs The best aspect of Java is all it's libraries, or Application Programming Interfaces (APIs) For a list standard packages see: http://java.sun.com/javase/6/docs/api/ Third party APIs exist for almost any functions.

Classloaders A classloader will load the byte code for other classes, as it is needed. This lets your byte code stay small, but still have access to all the libraries. Classloaders will be discussed futher in lecture 18.

Classpath The classpath tells the classloader where to look for the byte code. If you want to use your own libraries you must add them to the classpath. Linux/Unix: use setenv command. Windows: Control Panel>System utility. Eclipse: Eclipse>Preferences>Java>Build Path>Classapth variable

Jar Files If you want to bundle classes together, use a Java Archive (JAR) file. A JAR file is a zipped directory of java class files. To run a jar file type: java -jar filename To create a jar file use: jar cf jar-file input-files Or in Eclipse: File>Export>Java>Jar

Running a Java Program Write source. Compile with javac which checks the classpath packages checks types Generates byte code Run with java Java verifies the byte code Loads the byte code into the JVM. The JVM runs the program JVM execute the byte code And loads more classes as needed.

What You Need to Know Javac to compile, java to run. Set Classpath to file other class files. Normal you don t need to know about JVMs and byte code

What You Need to Know Javac to compile, java to run. Set Classpath to file other class files. Normal you don t need to know about JVMs and byte code but you might get errors when the version changes.

The Version Changes??? Yes, every few years there is a new version of Java. New JVMs can run old classes. Old JVMs cannot run all new classes. So Java is platform independed, but not JVM independed.

Java Version History Pre-Java: 1991 Sun built Oak a language for home devices. 1996: home devices going no-where. Web is huge, Oak is made into Java Development Kit 1 (JDK 1) and released.

Java Version History 1997 JDK 1.1 released. Adds: JDBC (database access) RMI (Remote Method Innvocation) 1998 J2SE 1.2 (Java 2 Platform, Standard Edition) CORBA for interaction with other languages. Swing (GUIs) becomes core. JVM updated to JIT

Java Version History 2000 J2SE 1.3 RMI now works with CORBA Support for clients to look up remote services (JNDI). Serious debugging added. 2002 JDK 1.4 assertions Reguler expressions (later in this lecture) IP6 support XML parser and XSLT Java Crypto (JCE)

Java Version History 2004 J2SE 5.0 Generics Types Better type conversion Static inport No more stubs in RMI 2006 Java SE 6 Support for old windows systems dropped 64-bit support Rhino scripting language Better JDBC

Java Version Future Java 7 (codeman Dolphin) is likely to be released in 2010. Dynamic language features (code can be changed and passed at run time). Support better support for parallel processers. Super packages.

Regular Expressions and Parsing

Regular Expressions Regular expressions describe strings based on common characteristics. They can be used to search, edit, or manipulate text and data. Once you understand the basics you'll be able to process any text you want.

Pattern and Matcher Classes Use the java.until.regex.pattern Object to define what you want to match: Pattern p = Pattern.compile( gmail ); Link it to the String you want to scan: Matcher m = p.matcher(mystring); m.match() is true is String contains gmail.

Wild Cards [abc] [a-z] = a,b or c = lowercase letter [a-za-z] = any letter \\n \\d \\s = new line = any digit =white space XY X then Y X Y X or Y (not both) X? one or zero Xs X* zero or more Xs X+ one of more Xs

What Matches With What? A: [abcd][bcde][cdef] B: [a-z]+@[.a-z]+ C: [a-za-z]@[.a-z].[a-z]+ D: GET PUT[\\s]+[//.:a-z@]* E: [A-Z@\\d]+[\\d] 1 Me@gmail.com 2 bed 3 PUT@911 4 GET http://www.x.com 5 abc@cs.bham.ac.uk

Capture Groups Capture Groups let you process data. Put brackets round the bit you want to use. And use matcher.group(n) to match the n-th group

Finding email addresses. Pattern p = Pattern.compile ( ([a-za-z\d])@([a-za-z\d]).com ) Matcher matcher = pattern.matcher(terms[0].trim()); While (m.match()) { System.out.print( user: +m.group(1)); System.out.println( host: +m.group(2)); }

Full Parsers You could parse the syntax of a language using pattern matching, but it would be a lot of work. For big grammars you should use a ``parser generator'' such as antlr or yacc. You specific the grammar and the tool builds the parser for you.

Conclusion Java byte code can run the any computer with a JVM. Set you classpath to point to the classes/jar files you want to use. Java is updating all the time. Parsers and Regular Expressions.

Next Time: The Java Crypto API Generate and handle keys. How to encrypt and decrypt public key encryption, and symmetric key encryption. Hashes Keystores