Aug 05 2008
java history chapter3
JavaServer Page
-
Main article: JavaServer Pages
JavaServer Pages (JSPs) are server-side Java EE components that generate responses, typically HTML pages, to HTTP requests from clients. JSPs embed Java code in an HTML page by using the special delimiters <% and %>. A JSP is compiled to a Java servlet, a Java application in its own right, the first time it is accessed. After that, the generated servlet creates the response.
[edit] Swing application
-
Main article: Swing (Java)
Swing is a graphical user interface library for the Java SE platform. This example Swing application creates a single window with “Hello, world!” inside:
// Hello.java (Java SE 5) import java.awt.BorderLayout; import javax.swing.*; public class Hello extends JFrame { public Hello() { super("hello"); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); setLayout(new BorderLayout()); add(new JLabel("Hello, world!")); pack(); } public static void main(String[] args) { new Hello().setVisible(true); } }
The first import statement directs the Java compiler to include the BorderLayout class from the java.awt package in the compilation; the second import includes all of the public classes and interfaces from the javax.swing package.
The Hello class extends the JFrame class; the JFrame class implements a window with a title bar and a close control.
The Hello() constructor initializes the frame by first calling the superclass constructor, passing the parameter “hello”, which is used as the window’s title. It then calls the setDefaultCloseOperation(int) method inherited from JFrame to set the default operation when the close control on the title bar is selected to WindowConstants.EXIT_ON_CLOSE — this causes the JFrame to be disposed of when the frame is closed (as opposed to merely hidden), which allows the JVM to exit and the program to terminate. Next, the layout of the frame is set to a BorderLayout; this tells Swing how to arrange the components that will be added to the frame. A JLabel is created for the string “Hello, world!” and the add(Component) method inherited from the Container superclass is called to add the label to the frame. The pack() method inherited from the Window superclass is called to size the window and lay out its contents, in the manner indicated by the BorderLayout.
The main() method is called by the JVM when the program starts. It instantiates a new Hello frame and causes it to be displayed by calling the setVisible(boolean) method inherited from the Component superclass with the boolean parameter true. Note that once the frame is displayed, exiting the main method does not cause the program to terminate because the AWT event dispatching thread remains active until all of the Swing top-level windows have been disposed.
[edit] Generics
- See also: Generics in Java
[edit] Criticism
| It has been suggested that some of the information in this article’s Criticism or Controversy section(s) be merged into other sections to achieve a more neutral presentation. (Discuss) |
-
Main article: Criticism of Java
Java’s performance has improved substantially since the early versions, and performance of JIT compilers relative to native compilers has in some tests been shown to be quite similar.[18][19][20] The performance of the compilers does not necessarily indicate the performance of the compiled code; only careful testing can reveal the true performance issues in any system.
The default look and feel of GUI applications written in Java using the Swing toolkit is very different from native applications. It is possible to specify a different look and feel through the pluggable look and feel system of Swing. Clones of Windows, GTK and Motif are supplied by Sun. Apple also provides an Aqua look and feel for Mac OS X. Though prior implementations of these looks and feels have been considered lacking,[citation needed] Swing in Java SE 6 addresses this problem by using more native widget drawing routines of the underlying platforms. Alternatively, third party toolkits such as wx4j, Qt Jambi or SWT may be used for increased integration with the native windowing system.
As in C++ and some other object-oriented languages, variables of Java’s primitive types were not originally objects. Values of primitive types are either stored directly in fields (for objects) or on the stack (for methods) rather than on the heap, as is the common case for objects (but see Escape analysis). This was a conscious decision by Java’s designers for performance reasons. Because of this, Java was not considered to be a pure object-oriented programming language. However, as of Java 5.0, autoboxing enables programmers to write as if primitive types are their wrapper classes, with their object-oriented counterparts representing classes of their own, and freely interchange between them for improved flexibility.
Java suppresses several features (such as operator overloading and multiple inheritance) for classes in order to simplify the language, to “save the programmers from themselves”, and to prevent possible errors and anti-pattern design. This has been a source of criticism,[citation needed] relating to a lack of low-level features, but some of these limitations may be worked around. Java interfaces have always had multiple inheritance.
[edit] Target
-
Main article: Java Runtime Environment
The Java Runtime Environment, or JRE, is the software required to run any application deployed on the Java Platform. End-users commonly use a JRE in software packages and Web browser plugins. Sun also distributes a superset of the JRE called the Java 2 SDK (more commonly known as the JDK), which includes development tools such as the Java compiler, Javadoc, Jar and debugger.
One of the unique advantages of the concept of a runtime engine is that errors (exceptions) should not ‘crash’ the system. Moreover, in runtime engine environments such as Java there exist tools that attach to the runtime engine and every time that an exception of interest occurs they record debugging information that existed in memory at the time the exception was thrown (stack and heap values). These Automated Exception Handling tools provide ‘root-cause’ information for exceptions in Java programs that run in production, testing or development environments.
[edit] Class libraries
- Java libraries are the compiled byte codes of source code developed by the JRE implementor to support application development in Java. Examples of these libraries are:
- The core libraries, which include:
- Collection libraries that implement data structures such as lists, dictionaries, trees and sets
- XML Processing (Parsing, Transforming, Validating) libraries
- Security
- Internationalization and localization libraries
- The integration libraries, which allow the application writer to communicate with external systems. These libraries include:
- The Java Database Connectivity (JDBC) API for database access
- Java Naming and Directory Interface (JNDI) for lookup and discovery
- RMI and CORBA for distributed application development
- User Interface libraries, which include:
- The (heavyweight, or native) Abstract Windowing Toolkit (AWT), which provides GUI components, the means for laying out those components and the means for handling events from those components
- The (lightweight) Swing libraries, which are built on AWT but provide (non-native) implementations of the AWT widgetry
- APIs for audio capture, processing, and playback
- The core libraries, which include:
- A platform dependent implementation of Java virtual machine (JVM) that is the means by which the byte codes of the Java libraries and third party applications are executed
- Plugins, which enable applets to be run in Web browsers
- Java Web Start, which allows Java applications to be efficiently distributed to end users across the Internet
- Licensing and documentation
[edit] APIs
- See also: Free Java implementations#Class library
Sun has defined three platforms targeting different application environments and segmented many of its APIs so that they belong to one of the platforms. The platforms are:
- Java Platform, Micro Edition (Java ME) — targeting environments with limited resources,
- Java Platform, Standard Edition (Java SE) — targeting workstation environments, and
- Java Platform, Enterprise Edition (Java EE) — targeting large distributed enterprise or Internet environments.
The classes in the Java APIs are organized into separate groups called packages. Each package contains a set of related interfaces, classes and exceptions. Refer to the separate platforms for a description of the packages available.
The set of APIs is controlled by Sun Microsystems in cooperation with others through the Java Community Process program. Companies or individuals participating in this process can influence the design and development of the APIs. This process has been a subject of controversy.
[edit] See also
- Comparison of programming languages
- Comparison of Java and C Sharp
- Groovy (programming language)
- Jython
- JRuby
- Pnuts
- Join Java
- JavaOne
- Javapedia
- List of integrated development environments
- List of Java virtual machines
- List of Java APIs
- List of Java scripting languages
- Java Posse
- Java version history
[edit] Notes
- ^ “The Java Language Environment” (May 1996).
- ^ “The Java Language Specification, 2nd Edition“.
- ^ Java 5.0 added several new language features (the enhanced for loop, autoboxing, varargs and annotations), after they were introduced in the similar (and competing) C# language. [1][2]
- ^ Jon Byous, Java technology: The early years. Sun Developer Network, no date [ca. 1998]. Retrieved April 22, 2005.
- ^ http://blogs.sun.com/jonathan/entry/better_is_always_different.
- ^ Heinz Kabutz, Once Upon an Oak. Artima, Retrieved April 29, 2007.
- ^ Java Study Group
- ^ Why Java Was - Not - Standardized Twice
- ^ What is ECMA–and why Microsoft cares
- ^ Java Community Process website
- ^ open.itworld.com - JAVAONE: Sun - The bulk of Java is open sourced
- ^ 1.2 Design Goals of the JavaTM Programming Language
- ^ Java SE - Licensees
- ^ James Niccolai (January 23, 2001). “Sun, Microsoft settle Java lawsuit“, JavaWorld, IDG. Retrieved on 2008-07-09.
- ^ Stroustrup: C++ Style and Technique FAQ
- ^ Using the applet Tag (The Java Tutorials > Deployment > Applets)
- ^ Deploying Applets in a Mixed-Browser Environment (The Java Tutorials > Deployment > Applets)
- ^ Performance of Java versus C++, J.P.Lewis and Ulrich Neumann, Computer Graphics and Immersive Technology Lab, University of Southern California
- ^ The Java is Faster than C++ and C++ Sucks Unbiased Benchmark
- ^ FreeTTS - A Performance Case Study, Willie Walker, Paul Lamere, Philip Kwok
[edit] References
- Jon Byous, Java technology: The early years. Sun Developer Network, no date [ca. 1998]. Retrieved April 22, 2005.
- James Gosling, A brief history of the Green project. Java.net, no date [ca. Q1/1998]. Retrieved April 29, 2007.
- James Gosling, Bill Joy, Guy Steele, and Gilad Bracha, The Java language specification, third edition. Addison-Wesley, 2005. ISBN 0-321-24678-0 (see also online edition of the specification.
- Tim Lindholm and Frank Yellin. The Java Virtual Machine specification, second edition. Addison-Wesley, 1999. ISBN 0-201-43294-3 (see also online edition of the specification).
[edit] External links
Wikibooks has a book on the topic of
At Wikiversity, you can learn about: java
- Java home page
- Java for developers
- Java SE 6 API Javadocs
- A Brief History of the Green Project
- Java: The Inside Story
- Java Was Strongly Influenced by Objective-C
- The Java Saga
- A history of Java
- The Long Strange Trip to Java
- M254 Java Everywhere (free open content documents from the Open University)
- Java Language Specification (pdf)
|
|||
|
||
|
|||||
Retrieved from “http://en.wikipedia.org/wiki/Java_%28programming_language%29“
Categories: Cleanup from section | Java programming language | Java platform | Java specification requests | C programming language family | Sun Microsystems | Concurrent programming languages | Class-based programming languages | Object-oriented programming languages | JVM programming languages | JVM programming language
Hidden categories: Articles with too many examples | All articles with unsourced statements | Articles with unsourced statements since May 2008