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

Info icon This 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
Image of page 1

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

View Full Document Right Arrow Icon
1. Introduction 2. Applets 3. Servlets 4. Aglets 5. MIDlets 2
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
Image of page 3

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

View Full Document Right 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
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, you do not need to construct a Frame or JFrame object , as the browser window is used instead.
Image of page 5

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

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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern