M257_Unit10

M257_Unit10 - Unit 10 Lets do Java Prepared by Dr Abdallah...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
Prepared by: Dr. Abdallah Mohamed, AOU-KW Unit 10 : Let’s do Java 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
1. Introduction 2. Applets 3. Servlets 4. Aglets 5. MIDlets 2
Background image of page 2
1. Introduction So far, we have mostly been concerned with the Java 2 Standard Edition (J2SE) . In this unit, we will look at Java 2 Micro Edition (J2ME) , designed for use on smaller systems with limited resources, especially the concept of MIDlets , applications which run on so-called Mobile Information Devices. Large scale systems are catered for by the Java 2 Enterprise Edition (J2EE) , which we will consider only briefly in this unit. We will address the question of where the Java software is located and where it is executed. in a complex system , Java software may run on the client, on the server (possibly as a servlet ), as an applet invoked from a web page, or even as a software agent (an aglet ) roaming around the network. Unit 10 : Let’s do Java 3
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2. Applets Applets are Java programs that are downloaded as bytecode along with a web page and run by the browser when the web page is viewed. Applets usually cannot access files on the client computer where they are executed. How an applet works A Java applet is similar to a Java application. In both cases , you write Java source code, compile it to bytecode and store it in a file with a name ending in .class . The difference comes in how this bytecode file is then invoked and executed. Java application: Java application is typically installed directly on a particular computer and run there. When an application is run, the bytecode is interpreted and executed by the Java Virtual Machine(JVM) on the computer where the application resides. Java applet The bytecode for an applet is normally run when an associated web page is loaded into a browser. The applet bytecode is actually interpreted and executed by Java-enabled browser . Applets can also be viewed using a standard application called the appletviewer this comes as part of the JDK. This is often useful for testing during development of an applet. Unit 10 : Let’s do Java 4
Background image of page 4
2. Applets How to write an applet 1) You must first define a class that extends: the Applet class from the java.applet package or its subclass JApplet from the javax.swing package. 2) Applets can use almost all the Java language features, but: a. An applet does not have a main method . It has an init method , which is invoked by the browser when the web page is loaded. b. Applets have a graphical user interface only , and use normal Swing or AWT features for this. When running in a browser, they cannot read or write using the standard streams such as System.out. For the applet GUI,
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/21/2010 for the course UK M257 taught by Professor Maiile during the Spring '10 term at Open Uni..

Page1 / 44

M257_Unit10 - Unit 10 Lets do Java Prepared by Dr Abdallah...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online