Applets, Applications and Servlets
Java programs can be called from Web pages or run stand alone. When launched from a Web page, the program is called a Java "applet." When a non Web-based Java program is run on a user's machine, it is a Java "application." When running in a Web server, it is a Java "servlet."
Intermediate Bytecode
The source code of a Java program is compiled into an intermediate language called "bytecode," which can reside on any hardware platform. In order to run the bytecode, it must be compiled into machine code either ahead of time like a C/C++ program, just before it is needed (see JIT compiler) or via a Java Virtual Machine (JVM), which is a line-at-a-time interpreter. There are compilers and JVMs for all major hardware platforms, and the intermediate bytecode is what makes Java machine independent.
Java Vs. JavaScript
Java is a full-blown programming language, whereas JavaScript is a scripting language that is much more limited in scope. JavaScript source code is not compiled into bytecode. It is embedded within an HTML page and is primarily used to manipulate elements on the page itself. For example, JavaScript is widely used to provide drop-down menus and other interactive events on the page. See JavaScript.
A Revolution?
Java was originally developed in 1991 as a language for embedded applications such as those used in set-top boxes and other consumer-oriented devices. It became the fuel to ignite a revolution in thinking when Sun transitioned it to the Web in 1994. Java is a full-blown programming language like C and C++ and allows for the creation of sophisticated applications. Thus far, Java applications and applets have been mildly successful at the client side, but Java on the server has become very popular. Sun's J2EE enterprise model has become an application server standard (see J2EE).
Write Once-Run Anywhere
Java embodies the "write once-run anywhere" model, which has been one of the Holy Grails of computing for decades. For example, a J2EE server application can be replicated from a Unix server to a Windows server and vice versa with relative ease. Sometimes, a little tweaking is necessary; sometimes a lot, but Java is closer to "write once-run anywhere" than any development platform in the past. See Java platform, servlet, JSP, Java 2, Jini, network computer, CaffeineMark and caffeine based.
The following Java example of changing Fahrenheit to Celsius is rather wordy compared to the C example in this Encyclopedia. Java is designed for GUI-based applications, and several extra lines of code are necessary here to allow input from a terminal.
import java.io.*;
class Convert {
public static void main(String[]args)
throws IOException {
float fahr;
StreamTokenizer in=new StreamTokenizer(new
InputStreamReader(System.in));
System.out.print("Enter Fahrenheit ");
in.nextToken();
fahr = (float) in.nval;
System.out.println ("Celsius is " +
(fahr-32)*5/9);
}
}
Java Uses an Intermediate Language
Java source code is compiled into an intermediate language called "bytecode." The bytecode can be run in any hardware that has a Java Virtual Machine (JVM) for that machine platform. Thus, the "write once-run anywhere" concept.
Java Runs on Clients and Servers
When a Java program has been called by a Web page from the client machine, it is dubbed an "applet." When it runs on the server, it is known as a "servlet." When running stand alone in a user's computer, it is a Java "application."
![]() | Reproduced with permission from Computer Desktop Encyclopedia. Copyright (c) 1981-2007 The Computer Language Company Inc. All rights reserved. |
Additional Resources
- Exploring Mars with Java
- At the JavaOne conference in San Francisco Friday, James Gosling, Sun Microsystems vice president and fellow, talks to Arizona State University geological sciences professor Phil Christensen about the school's geospatial software, JMARS. The open-source project is available to the public and used by NASA to find and gather scientific data...
- Videos 2008-05-09
- SOASYNC
- SOASYNC, a global data synchonization software based on Service Oriented Architecture, can securely synchronize over 24 cross platform multi-vendor databases with custom cross database mapping incrementally and bidirectionally across the Internet. SOASYNC server runs on a wide range of operating in which Java 1.4.2 is installed. It also supports most...
- Software downloads 2008-05-09
- JavaOne: The week in video
- JavaOne: The week in videoThat is "Pushing Java FX to its limit?" and other stuffEnterprise 2.0 is pretty boring . . .If that is "Pushing Java FX to its limit," then they have a very, very long ways to go before they can even begin to compete with any other...
- Discussion threads 2008-05-08
- JavaOne: The week in video
- JavaOne has come and gone and we've learned that Sun is gunning for LiveMesh, is bringing applets back and wooing developers. Here's a look at some of the key stories: Microsoft Live Mesh to get more competition -- from Sun Sun's continuing open...
- Blog posts 2008-05-08
- JavaOne '08: Inside enterprise 2.0
- Oracle demos a new enterprise 2.0 application at the JavaOne Conference in San Francisco on Wednesday. Oracle executives Thomas Kurian and Peter Moskowitz show how Java changes an order entry application into a collaborative Web 2.0 environment.
- Videos 2008-05-08
- News to know: AMD; Oil and telecommuting; Verizon's EV-DO modem; Linux
- Notable headlines: Jason O'Grady: Review: Verizon UM150 USB EV-DO modem Gallery (right). Mary Jo Foley: Microsoft Live Mesh to get more competition -- from Sun News.com: AMD revises server road map Adrian Kingsley-Hughes: How long can AMD...
- Blog posts 2008-05-08
- AsdGraph3D Excel Addin (0_Setup)
- AsdGraph3D is an OpenGL-based Excel Addin that plots 3D points, lines, surfaces or water-tight solids directly from user-specified cell ranges (as 3D coordinates) within MS Excel worksheets (from one or several open workbooks). The tight integration with MS Excel is what differentiates AsdGraph3D from rest of the 3D plotters. AsdGrapg3D...
- Software downloads 2008-05-08
- EaSynth Look And Feel Designer (exe)
- An IDE for java Synth based look and feel, you can use it to develop your own look and feel for your products, you can also sell your look and feel to others. This IDE provide the visual editors for Synth based look and feel, which allow you to preview...
- Software downloads 2008-05-08
- Microsoft Live Mesh to get more competition -- from Sun
- Microsoft Live Mesh to get more competition -- from SunYou've got things mixed upMary,You clearly do not understand the Rich internet Applications space very well ...there a lot of mistakes in the article that i have to correct ...[b]"Sun is building on top of JavaFX"[/b]The more appropriate word here would...
- Discussion threads 2008-05-07
- JavaOne '08: Sun brings back Java applets
- Sun Microsystems demos new JavaFX powered applets at its annual JavaOne Conference in San Francisco Tuesday. Danny Coward and Ken Russell of Sun's Java SE team show how the new applets can be deployed within a Web browser or dragged over to the desktop.
- Videos 2008-05-07
- Sun's continuing open source problem
- Sun's continuing open source problemSun executives are fucking morons...and a scarey bunch in general. I once heard some brain dead Sun twit emotionally speak about Scott McNealy as their spiritual leader. It seems like every couple of months some "new" strategy will save them from their ultimate demise. Hey guys,...
- Discussion threads 2008-05-07
- Microsoft Live Mesh to get more competition -- from Sun
- At the opening day of JavaOne on May 6, Sun officials began laying out their vision for a future cloud-computing platform, code-named Hydrazine, that Sun plans to field against competitive offerings from Microsoft, Google, Amazon and others. Robert Brewin, Sun Chief Technology Officer and Distinguished Engineer, described...
- Blog posts 2008-05-07
- News to know: Vista troubleshooting, RIM, XP SP3, Apple, SAP
- Notable headlines: XP SP3: Now on Windows Update Ed Bott: Fixing Windows Vista, Part 3: Top Troubleshooting Tools [See Gallery] David Morgenstern: Is Mac OS X Leopard, Safari 3.x too dark? Larry Dignan: Cisco third...
- Blog posts 2008-05-07
- JavaFX's day in the Sun
- Dan Farber has some information about JavaFX from the JavaOne keynote today. It sounds like it wasn't a great day for demos but that we're starting to get a better picture of JavaFX and what the plans are. Michael Coté has some additional information about Sun's plans around Java as...
- Blog posts 2008-05-07
- Lightweight Time Tracker (1)
- LWTT is a very simple time-tracking program written in Java. It provides independent real-time tracking of multiple tasks (such as programming, presentations, lectures). LWTT's data are saved to a XML file under the home directory. Version 1.1.1 has resetting tasks (time consumption is set to zero), saving size, and position...
- Software downloads 2008-05-07
- Everyone loves the Eee
- I spent the day at a conference sponsored by our SIS developer. The food was excellent, which is always a solid barometer for conference success and I learned that I've forgotten too much java (X2's Aspen SIS largely uses java to interact with the relational database that sits on...
- Blog posts 2008-05-06
- JavaOne '08: Neil Young chronicles music career
- Legendary musician Neil Young shows off a new multimedia project spanning his music career. Joining Young onstage at the JavaOne Conference in San Francisco to demo the project--which uses Java and Blu-ray technology--is Sun CEO Jonathan Schwartz and Rich Green, Sun executive vice president of software.
- Videos 2008-05-06
- Profits-strapped Sun continues decade-long pitch to developers on Java dominance
- Profits-strapped Sun continues decade-long pitch to developers on Java dominanceJava, Meet .NetNow fight to the death and both die.Die, Java, die!Having wasted a couple of years working on Java-based projects, all I can say is that the language has been way over-hyped. In the real world, all Java does...
- Discussion threads 2008-05-06
- Profits-strapped Sun continues decade-long pitch to developers on Java dominance
- Leading up the the JavaOne developers conference, Sun Microsystems posted an embarrassing quarterly profit loss, is making OpenSolaris more open than ever, bringing the OpenSolaris platform value to the Amazon Web Services cloud, and is still using variations on the projectile theme to send T-shirts into the international crowd of...
- Blog posts 2008-05-06
- News to know: SAP; Hacking NASA; Apple; OpenSolaris
- Notable headlines: Nate McFeters: Hacking NASA: One small step for man, one giant leap for hackers? Common misconceptions about database security Sapphire 2008: Dennis Howlett: The changing SAP culture Larry Dignan: SAP's Apotheker: Business ByDesign costs led...
- Blog posts 2008-05-06
Neighboring Terms
Premier Vendor Content Whitepapers, webcasts & resources from our Power Center Sponsors
- Become an Intel® Premier IT Professional Member!
-
Designed specifically to address the concerns of senior IT managers at organizations with more than 100 employees, the Intel Premier IT Professional Program provides best practices via local and e-Seminars and a members-only Web site.
- Sign-up free and access best practices resources >>
- BNET Industries
- Check out BNET's newest resource for managers and executives. Need to do research on your competitors? Don't have time to read every trade pub? BNET Industries is the new source for daily news, insights, and research on 11 major industries and 9,000 public companies.
-
- The technology industry from a different angle
-
- See what's hot in the auto industry
-
- Stay on top of the energy industry






