1 / 24

BPJ444: Business Programming Using Java Introduction

BPJ444: Business Programming Using Java Introduction. Tim McKenna. Introduction. The Focus of BPJ444 What is Java? The Sun Java 2 Platform Getting Started with Java Programming The IBM i5, iSeries, AS/400 Java Platform. The Focus of BPJ444. Java programming skills (85%)

braith
Download Presentation

BPJ444: Business Programming Using Java Introduction

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. BPJ444: Business Programming Using Java Introduction Tim McKenna

  2. Introduction • The Focus of BPJ444 • What is Java? • The Sun Java 2 Platform • Getting Started with Java Programming • The IBM i5, iSeries, AS/400 Java Platform

  3. The Focus of BPJ444 • Java programming skills (85%) • IBM tool and platform (15%) • IBM WebSphere Development Studio Client for iSeries which is based on Eclipse IDE. Use Eclipse. • IBM iSeries as a database platform • preparation for other courses • DOMINO, iSeries Practicum, Web Services Architecture

  4. What is Java? • invented at Sun Microsystems in 1991 by James Gosling, a Canadian. • named the new language “Oak” after looking out his office window • later renamed “Java” following a trademark search • 1994: hey, this Web thing is way cool • May 23, 1995: Java and HotJava browser officially announced • JDK 1.0 available November, 1995

  5. What is Java? • Java starts with C/C++ language form: • syntax, semantics, expressions • Java improves C/C++: • no pointers in Java … hooray • no memory manglement malloc/free • Java does automatic “garbage collection” • strings are objects, not null-terminated arrays • int, long, float are the same everywhere • out of bounds array index checking at run time

  6. Java cleans up C++ • no operator or keyword overloading • things mean what you think they mean • no header files • Java uses classes and packages • no multiple inheritance • no standalone functions • in Java, all methods belong to a class • no preprocessor • everything is in the Java language • no structures or unions • everything is in a class

  7. Java is better • for Web, business & application programming (no memory manglement) • safer than C & C++ (no pointer stuff) • rich library of programming features • more portable across platforms • downloadable Java applets can run • in anybrowser (unlike ActiveX) • safely in the Java security “sandbox”(unlike ActiveX)

  8. Java formula • Java = C++ – complexity and ambiguity + security and portability

  9. Java is Object Oriented • focus is on objects, i.e. classes of things • objects have attributes: fields or variables (data) • objects have behaviour: methods to act on data • Procedural languages like C or COBOL … • use algorithms to act on data – trusting all other programs to behave properly and not corrupt data. • data has no control of programs acting on it data's only protection is DB constraints • data and procedures are structurally independent but functionally dependent

  10. The Sun Java 2 Platform • Java mantra: “write once, run anywhere” • the same code runs on any platform • also: run anytime • same code runs on the same platform over time • today on WinXP/Pentium 32bit CISC • tomorrow on Win?? & Itanium 64 bit EPIC • (this has always been OS/400 strength… 1979 S/38 *PGM objects run on current iSeries) • criticism: “write once, test/debug everywhere” • with Java 2, this is rarely an issue anymore. • with C++, it is still true

  11. The Sun Java 2 Platform- how does it do that? • use of bytecode to achieve portability • .java source code ‘compiled’ into .class bytecode • virtual assembler language • Java Virtual Machine interprets standard bytecode and runs it on a specific platform • OS/hardware platform implements its own JVM • e.g. OS/400, Wintel, Mac, Unix, Linux • each have different Java Virtual Machines (JVM) to run standard bytecode on their local OS / hardware • some just-in-time compilation for speed • performance issues everywhere except OS/400

  12. The Sun Java 2 JDK • terminology • JRE: Java Runtime Environment • JDK: Java Development Kit • SDK: Software Development Kit (old name for JDK) • Java compiler: > javac classfile.java • Java interpreter (JVM) > java classfile • other command-line tools (e.g. javadoc, jar) • versions: 1.0, 1.1, 1.2, 1.3, 1.4, 1.5

  13. How to install Java 2 JDK? • http://java.sun.com • link: J2SE Core Java • common problems in installation • path name (“command unknown”) • classpath name (“class file not found”) • upper/lower case names • solutions: JDK documentation, General Information, Installation Notes • see BPJ444 web site for installation notes

  14. How to code, compile and run a Java program? • Java 2 JDK Environment (Windows Platform) • notepad or TextPad: type in Java source code • compile source code: > javac HelloWorld.java • run program: > java HelloWorld • Eclipse: create a project, enter code (with assistance), save a file (auto compiled), run from inside Eclipse…it's an Integrated Development Environment

  15. Getting Started with Java Programming • Two Examples: a Java application and a Java applet • The Anatomy of a Java Application • Java Applets and the Internet • The Anatomy of a Java Applet • The Java Tutorial (online): http://java.sun.com • see the Introduction web page

  16. Definitions • package: a group of related classes • sometimes called a "library" of classes • Java API: Application Program Interface • Java's many packages with many capabilities • all documented with javadoc utility into HTML pages • base package “java.lang” is automatically imported into every Java program

  17. Some Examples • a Java application (console-based) • HelloWorld.java • HelloWorld2.java • command line tools: javac, java • a Java applet • HelloWorldApplet.java • HelloWorlddemo2.html • tools: javac, appletviewer

  18. The Anatomy of a Java Application • Example: HelloWorld.java • three types of comments • line, multi-line, and javadoc • keywords: public, static, private • use of API specification • names: System, out, println • package name: java.lang • the javadoc command: • > javadoc HelloWorld.java • > runJavadoc.bat (in Week01.zip) will organize and document all .java files in a directory

  19. The Anatomy of a Java Applet • a Java program that runs in a web page subject to security restrictions • Example: HelloWorldApplet.java • keyword: import • use of API specification - names: java.applet.Applet, paint • names: packages, classes, method, objects • tools: appletviewer, Firefox

  20. IBM i5, iSeries, AS/400 Java Platform • Sun JDK compliant • the QShell Interpreter and Integrated File System (IFS) – simulated UNIX environment • AS/400 Toolbox for Java • Java classes developed by IBM to access OS/400 resources • performance optimization • the JVM is integrated with OS/400 in microcode • OS/400 Java commands: CRTJVAPGM, RUNJVA

  21. Java and IBM eServer iSeries • Approach 1: use of a workstation (or desktop) • locally develop Java code, e.g. using IBM WDSC • ftp the Java code to the IBM iSeries server Integrated File System e.g. /bpj444demo • use iSeries QShell (STRQSH) to compile & run:cd /bpj444demoset CLASSPATH . javac HelloWorld2.javajava HelloWorld2

  22. Java and IBM eServer iSeries • Approach 2: Use of IBM Operations Navigator • workstation development of Java code • “drag and drop” • from Windows Explorer to Operations Navigator • use an iSeries Integrated File System directory • RIGHT click on HelloWorld2.java to compile the code • RIGHT click on HelloWorld2.class to run the code

  23. Java and IBM eServer iSeries • Approach 3: green screen server environment • use SEU or EDTF to build Java programs • use CL commands to compile and run Java programs. e.g.===> RUNJVA CLASS(HelloWorld2) CLASSPATH('/bpj444demo')===> GO CMDJVA

  24. WebSphere Development Studio Client for iSeries • build on Eclipse technology • open source IDE: www.eclipse.org • tool for developing Java, etc. code • built-in special support for OS/400 Java - AS/400 Toolbox for Java - Enterprise Toolkit for AS/400 • www.ibm.com/software/ad/wdt400/

More Related