Basics of a typical java environment

Propellerads
“The creditor hath a better memory than the debtor-James Howell”

Java systems generally consist of several parts.: an environment, the language, the java applications programming iinterface(API) and various class libraries.
Java programs normally go through five phases to be executed. These are:
Edit, Compile, Load, Verify and Execute.if you are not using UNIX, windows 95/98, or windows NT, refer to the manual for your systems java environment, or ask your instructor
how to accomplish these tasks in your environment.

PHASE1
Phase 1 consists of editing a file. This is accomplished with an editor program.The
programmer types a Java program using the editor and makes corrections If necessary. When the programmer specifies that the file in the editor should be saved, the program is stored on a secondary storage
device. Java program filenames end with the .java extension. two editors widely used on UNIX systems
are vi and emacs. on windows 95/98 and windows NT simple edit programs like the DOS edit command and the windows notepad will suffice. Java’s integrated development eenvironment(IDE)
such as Sun’s Forte for Java, Borland’s JBuilder, Symantec’s Visual cafe and Microsoft’s Visual J++ have built in editors that are smoothly integrated into the programming environment. We assume the reader knows how to edit a file.

Propellerads
____________________________________________________________________________

  A simple way to make money. simply send traffic to this website and earn some money every time someone clicks on it! You could earn $1 for every click! 

http://go.oclasrv.com/afu.php?zoneid=1299976

____________________________________________________________________________

PHASE2
In phase2, thebprogrammer gives the command Javac to compile the program. The Java compiler translates the Java program into bytecodes-the language understood by the Java interpreter. To compile a program called welcome.java, type
Javac welcome.java
into the command window of your system(i.e. the MS-DOS prompt in windows 95/98 and windows NT or the shell prompt in UNIX). if the program compiled correctly, a file called welcome.class is produced. this is the file containing the bytecodes that
will be interpreted during the execution phase.

Propellerads
____________________________________________________________________________

  A simple way to make money. simply send traffic to this website and earn some money every time someone clicks on it! You could earn $1 for every click! 

http://go.oclasrv.com/afu.php?zoneid=1299976

____________________________________________________________________________

PHASE3
Phase 3 is called loading. the program must first be placed in memory before itcan be executed.This is done by the class loader, which takes the .class file containing the bytecodes and transfers them to memory. the class file can be loaded from a disk
on your system or over a network (such as your local university or company network or even the internet. There are two types of programs for which the class loader loads .class files- applications and applets. a Java application program is a program such as a word processor
program, a spreadsheet program, a drawing program, an email program etc. that is normally stored and executed from the users local computer. a Java applet is a small program that is normally stored on a remote computer that users connect to via a world wide web browser.
Applets are loaded from a remote computer into the browser, executed in the browser and discarded when execution completes. To execute an applet again, the user must point the browser at the appropriate location on the world wide web and reload the program into the browser. Applications are loaded into memory and
executed using the Java interpreter via the command Java. When executing a Java application called welcome, the command
Java welcome
invokes the interpreter for the welcome application and causes the class loader to load information used in the welcome application. The class loader is also executed when a Java applet is loaded into a wworld wide web browser such as Netscape’s Communicator, Microsoft Internet Explorer or Sun’s Hottext (Markup language). documents
HTML is used to format a document in a manner that is easily understood by the browser application. an HTML document may refer to a java applet. When the browser sees an applet referenced in an Html document, the browser launches the class loader to load the aapplet normally from the location where the HTML document is sstored. Browsers that support
Java each have a builtin Java interpreter. Once the applet is loaded , the browsers Java interpreter executes the applet. Applets can also be executed from the command line using the appletviewer command.Like Netscape communicator, internet explorer and hotjava, the appletviewer requires an html document to invoke an applet. for example , if the welcome.html file
refers to the applet, the appletviewer command is used as follows:

appletviewer Welcome.html

This causes the class loader to load the information used in the welcome applet. the appletviewer is normally referred to as a mminimal browser- it only knows how to interpret applets.

Propellerads

PHASE4
Before the bytecodes in an applet are executed by the Java interpreter built into a browser or appletviewer, they are verified by the bytecode verifier in phase4.
(this also happens in applications that download bytecodes from a network) This ensures that the bytecodes for classes that are loaded from the iinternet(referred to as downloaded cclasses ate valid and that they do not violate Java’s security restrictions.
Java enforced strong security because Java programs arriving over the network should not be able to cause damage to your files and your ssystem as computer viruses might.

____________________________________________________________________________

  A simple way to make money. simply send traffic to this website and earn some money every time someone clicks on it! You could earn $1 for every click! 

http://go.oclasrv.com/afu.php?zoneid=1299976

____________________________________________________________________________

Propellerads

PHASE5
Finally in phase 5, the computer , under the control of its CPU, interprets the program one bytecode at a time, thus performing the actions specified by the program. Programs may
not work on the first try. Each of the preceding phases can fail because of various errors that we will discuss in this text. For example, an executing program might attempt
to divide by zero (an illegal operation in Java as it is in arithmetic.) This would cause the java program to print an error message. thevprogrammer would return to the edit phase, make the necessary corrections and proceed through the remaining phases again
to determine if the corrections work properly.

Common Programming error: Errors like division by zero occur as a program runs, so these errors are known as runtime errors or execution time errors. Fatal runtime errors cause programs to terminate immediately without
having successfully performed their jobs. Non-fatal runtime errors allow programs to run to completion, often producing incorrect results.

Most programs input or output data. When we say a program prints a result, we normally mean that the result is displayed on a screen. Data may be output to other devices such as disks and hardcopy printers.

Propellerads

Leave a comment