1 / 9

Java Applets and Applications

Java Applets and Applications. Contents. Compilation of java programs into bytecode Applets and the Internet HTML files Executing applets on the Internet Java Applications. Binary executable for UNIX. Compiler for UNIX. Source program. Binary executable for Windows.

oke
Download Presentation

Java Applets and Applications

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. Java Applets and Applications Contents • Compilation of java programs into bytecode • Applets and the Internet • HTML files • Executing applets on the Internet • Java Applications

  2. Binary executable for UNIX Compiler for UNIX Source program Binary executable for Windows Compiler for Windows Binary executable for MAC OS Compiler for MAC Compilation of most other higher level languages Programs must be recompiled (and possibly revised) to be ported to another platform (machine make and operating sys.)

  3. JVM for UNIX Bytecode (platform independent) Java Source Program Java Compiler JVM for Windows JVM for MAC OS The Java Runtime Environment The Java Virtual Machine (JVM) interprets the compiled bytecode into platform specific instructions.

  4. Java Applets and the Internet An applet is a kind of java program that is specially designed for running on the Internet An Applet is a compiled (bytecode) file that must be accessed through a link in an HTML file. Applet files (copies) are sent by the Web Server on which they reside to the local machines that request access (by clicking on the link in the HTML file that was originally requested). Applets run on the local machine! The platform independence of java enables programs that were compiled into bytecode files on one machine to run on any other platform that has its own JVM.

  5. Local Terminal Remote WEB Server HTML Applet file Internet Connection HTML file Java bytecode Browser HTML file Execute Applet program Request HTML file Send HTML file Send Applet Applet (bytecode) Request Applet JVM Applet Java Applets and the Internet contains

  6. Java Applets and the Internet Security Browsers capable of running applets enforce a security policy that protects the local machine from untrusted code. Applets are run in a restricted environment called a “sandbox” that prevents untrusted, remotely generated code from performing actions such as Reading from or writing to files on the local host Deleting files from the local host Creating or listing files or directories Making the local host quit

  7. Java Applets and the Internet Example – an HTML file with an embedded java applet <HTML> <HEAD> <TITLE> My First Applet </TITLE> </HEAD> <BODY> <APPLET code = HelloWorld.class height = 350 width = 400> </APPLET> </BODY> </HTML> HTML tags that are interpreted by a browser Tags are enclosed in angle brackets and indicate desired screen effects An HTML instruction is delimited by beginning and end tags HTML web pages have two sections – contents of the body described here File name of requested applet Dimensions (in pixels) of the “box” in which the applet will be displayed

  8. My First Applet Microsoft Internet Explorer title X Hello World body applet Java Applets and the Internet Browser window Example of previous HTLM file running on a browser

  9. Java Applications Java programs designed to run only on the local machine are called applications. Applications must contain one (and only one) class with a function main( ). When the compiled bytecode program is executed, the compiler will look for and run function main( ). In this course you will be writing application programs exclusively for much or all of the semester. Java applications are considered “trusted code” and have full access to the resources of the system.

More Related