Contents - Cultural View
Contents - Cultural View
Contents - Cultural View
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
<strong>Contents</strong><br />
Articles<br />
Java (programming language) 1<br />
Web Language 15<br />
AgentSheets 16<br />
Oak (programming language) 19<br />
Lightweight Java 21<br />
.properties 22<br />
Apache Harmony 24<br />
Apache Muse 30<br />
Apache Shiro 31<br />
Java applet 32<br />
Associació d'Usuaris de Java de Catalunya 40<br />
Automated exception handling 48<br />
Bean Scripting Framework 49<br />
CJAN 50<br />
Celtix 52<br />
Chainsaw (log file viewer) 53<br />
clone (Java method) 54<br />
Comparison of Java and C Sharp 58<br />
Comparison of Java and C++ 82<br />
Comparison of the Java and .NET platforms 93<br />
Constant interface 100<br />
Java 4K Game Programming Contest 102<br />
CookXml 106<br />
Cougaar 109<br />
Deterministic Parallel Java 110<br />
Devoxx 110<br />
Doclets 111<br />
Elastic Path 112<br />
Electronic Disturbance Theater 113<br />
Event dispatching thread 116<br />
Facelets 118<br />
final (Java) 120<br />
FloodNet 122<br />
FormEngine 123
Generics in Java 124<br />
G-java 129<br />
GlassFish Metro 130<br />
James Gosling 132<br />
Gray Flimmer 134<br />
Todd Greanier 135<br />
Head First (book series) 136<br />
Jim Hugunin 137<br />
Inner class 138<br />
Interface (Java) 140<br />
Internet Foundation Classes 143<br />
JAD (JAva Decompiler) 146<br />
JAD (file format) 147<br />
JAMWiki 149<br />
JGroups 151<br />
JPicus 152<br />
Java Class Library 153<br />
Java Classloader 156<br />
Java compiler 159<br />
Java Development Kit 160<br />
Java Interface Definition Language 163<br />
Java resource bundle 163<br />
Java TV 164<br />
Java Work Framework 166<br />
Java annotation 168<br />
Java collections framework 172<br />
Java concurrency 173<br />
Java syntax 175<br />
Java: <strong>View</strong> Technologies and Frameworks 198<br />
JavaBeans Activation Framework 201<br />
JavaThreads 201<br />
javac 202<br />
JavaFX 204<br />
Jawin 208<br />
JExamples 209<br />
Jfig 210<br />
Jikes 211<br />
jnSynch 212
Michael Kölling 212<br />
List of Java keywords 214<br />
Marker interface pattern 220<br />
Name mangling 221<br />
Patrick Naughton 230<br />
New I/O 231<br />
Object type (object-oriented programming) 237<br />
Omniscient Debugger 239<br />
OpenJDK 239<br />
PHP/Java Bridge 244<br />
Java package 245<br />
Parboiled (Java) 248<br />
Plain Old Java Object 250<br />
Pluggable look and feel 253<br />
Primitive wrapper class 255<br />
Project Semplice 256<br />
Quark Framework 257<br />
REPLAY (software) 266<br />
Real time Java 268<br />
Resource (Java) 269<br />
Restlet 270<br />
Retrotranslator 272<br />
SLAMD 273<br />
SLAMD Server 275<br />
SLF4J 275<br />
Bruno Souza 277<br />
Static import 278<br />
StormMQ 279<br />
strictfp 280<br />
String Buffer 281<br />
Sun Web Developer Pack 283<br />
Swing (Java) 284<br />
SwingLabs 290<br />
Synth Look and Feel 292<br />
TeachScheme! 294<br />
The Java Posse 297<br />
Unified Expression Language 298<br />
Java Virtual Machine 299
Xerlin 304<br />
XStream 306<br />
References<br />
Article Sources and Contributors 308<br />
Image Sources, Licenses and Contributors 313<br />
Article Licenses<br />
License 314
Java (programming language) 1<br />
Java (programming language)<br />
Paradigm Object-oriented, structured, imperative<br />
Appeared in 1995<br />
Designed by Sun Microsystems (Now owned by Oracle Corporation)<br />
Developer James Gosling & Sun Microsystems<br />
Stable release Java Standard Edition 6 (1.6.0_21) (July 7, 2010)<br />
Typing discipline Static, strong, safe, nominative, manifest<br />
Major<br />
implementations<br />
Dialects Generic Java, Pizza<br />
Influenced by<br />
Numerous; primarily: OpenJDK, HotSpot<br />
Ada 83, C++, C#, [1] Delphi Object Pascal, [2] Eiffel, [3] Generic Java, Mesa, [4] Modula-3, [5] Objective-C, [6]<br />
UCSD Pascal, [7] [8] Smalltalk<br />
Influenced Ada 2005, BeanShell, C#, Clojure, D, ECMAScript, Groovy, J#, JavaScript, PHP, Python, Scala<br />
OS Cross-platform (multi-platform)<br />
License GNU General Public License / Java Community Process<br />
Usual file extensions .java, .class, .jar<br />
Website [9]<br />
Java Programming at Wikibooks<br />
Java is a programming language originally developed by James Gosling at Sun Microsystems<br />
(which is now a subsidiary of Oracle Corporation) and released in 1995 as a core component<br />
of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++<br />
but has a simpler object model and fewer low-level facilities. Java applications are typically<br />
compiled to bytecode (class file) that can run on any Java Virtual Machine (JVM) regardless<br />
of computer architecture. Java is a general-purpose, concurrent, class-based, object-oriented<br />
language that is specifically designed to have as few implementation dependencies as possible.<br />
It is intended to let application developers "write once, run anywhere". Java is currently one of<br />
the most popular programming languages in use, and is widely used from application software<br />
[10] [11]<br />
to web applications.<br />
Duke, the Java<br />
The original and reference implementation Java compilers, virtual machines, and class libraries were developed by<br />
Sun from 1995. As of May 2007, in compliance with the specifications of the Java Community Process, Sun<br />
relicensed most of its Java technologies under the GNU General Public License. Others have also developed<br />
mascot<br />
alternative implementations of these Sun technologies, such as the GNU Compiler for Java and GNU Classpath.
Java (programming language) 2<br />
History<br />
James Gosling and Patrick Naughton initiated the Java language project in June 1991 for use in one of his many<br />
set-top box projects. [12] Java was originally designed for interactive television, but it was too advanced. [13] The<br />
language was initially called Oak after an oak tree that stood outside Gosling's office; it went by the name Green<br />
later, and was later renamed Java, from a list of random words. [14] Gosling aimed to implement a virtual machine<br />
and a language that had a familiar C/C++ style of notation. [15]<br />
Sun Microsystems released the first public implementation as Java 1.0 in 1995. It promised "Write Once, Run<br />
Anywhere" (WORA), providing no-cost run-times on popular platforms. Fairly secure and featuring configurable<br />
security, it allowed network- and file-access restrictions. Major web browsers soon incorporated the ability to run<br />
Java applets within web pages, and Java quickly became popular. With the advent of Java 2 (released initially as<br />
J2SE 1.2 in December 1998–1999), new versions had multiple configurations built for different types of platforms.<br />
For example, J2EE targeted enterprise applications and the greatly stripped-down version J2ME for mobile<br />
applications (Mobile Java). J2SE designated the Standard Edition. In 2006, for marketing purposes, Sun renamed<br />
new J2 versions as Java EE, Java ME, and Java SE, respectively.<br />
In 1997, Sun Microsystems approached the ISO/IEC JTC1 standards body and later the Ecma International to<br />
formalize Java, but it soon withdrew from the process. [16] Java remains a de facto standard, controlled through the<br />
Java Community Process. [17] At one time, Sun made most of its Java implementations available without charge,<br />
despite their proprietary software status. Sun generated revenue from Java through the selling of licenses for<br />
specialized products such as the Java Enterprise System. Sun distinguishes between its Software Development Kit<br />
(SDK) and Runtime Environment (JRE) (a subset of the SDK); the primary distinction involves the JRE's lack of the<br />
compiler, utility programs, and header files.<br />
On November 13, 2006, Sun released much of Java as open source software under the terms of the GNU General<br />
Public License (GPL). On May 8, 2007, Sun finished the process, making all of Java's core code available under free<br />
software/open-source distribution terms, aside from a small portion of code to which Sun did not hold the<br />
copyright. [18]<br />
Sun's vice-president Rich Green has said that Sun's ideal role with regards to Java is as an "evangelist." [19]<br />
Principles<br />
There were five primary goals in the creation of the Java language: [20]<br />
1. It should be "simple, object oriented, and familiar".<br />
2. It should be "robust and secure".<br />
3. It should be "architecture neutral and portable".<br />
4. It should execute with "high performance".<br />
5. It should be "interpreted, threaded, and dynamic".<br />
Practices<br />
Java Platform<br />
One characteristic of Java is portability, which means that computer programs written in the Java language must run<br />
similarly on any supported hardware/operating-system platform. This is achieved by compiling the Java language<br />
code to an intermediate representation called Java bytecode, instead of directly to platform-specific machine code.<br />
Java bytecode instructions are analogous to machine code, but are intended to be interpreted by a virtual machine<br />
(VM) written specifically for the host hardware. End-users commonly use a Java Runtime Environment (JRE)<br />
installed on their own machine for standalone Java applications, or in a Web browser for Java applets.
Java (programming language) 3<br />
Standardized libraries provide a generic way to access host-specific features such as graphics, threading and<br />
networking.<br />
A major benefit of using bytecode is porting. However, the overhead of interpretation means that interpreted<br />
programs almost always run more slowly than programs compiled to native executables would. Just-in-Time<br />
compilers were introduced from an early stage that compile bytecodes to machine code during runtime. Over the<br />
years, this JVM built-in feature has been optimized to a point where the JVM's performance competes with natively<br />
compiled C code.<br />
Implementations<br />
Sun Microsystems officially licenses the Java Standard Edition platform for Linux, [21] Mac OS X, [22] and Solaris.<br />
Although in the past Sun has licensed Java to Microsoft, the license has expired and has not been renewed. [23]<br />
Through a network of third-party vendors and licensees, [24] alternative Java environments are available for these and<br />
other platforms.<br />
Sun's trademark license for usage of the Java brand insists that all implementations be "compatible". This resulted in<br />
a legal dispute with Microsoft after Sun claimed that the Microsoft implementation did not support RMI or JNI and<br />
had added platform-specific features of their own. Sun sued in 1997, and in 2001 won a settlement of $20 million as<br />
well as a court order enforcing the terms of the license from Sun. [25] As a result, Microsoft no longer ships Java with<br />
Windows, and in recent versions of Windows, Internet Explorer cannot support Java applets without a third-party<br />
plugin. Sun, and others, have made available free Java run-time systems for those and other versions of Windows.<br />
Platform-independent Java is essential to the Java EE strategy, and an even more rigorous validation is required to<br />
certify an implementation. This environment enables portable server-side applications, such as Web services, Java<br />
Servlets, and Enterprise JavaBeans, as well as with embedded systems based on OSGi, using Embedded Java<br />
environments. Through the new GlassFish project, Sun is working to create a fully functional, unified open source<br />
implementation of the Java EE technologies.<br />
Sun also distributes a superset of the JRE called the Java Development Kit (commonly known as the JDK), which<br />
includes development tools such as the Java compiler, Javadoc, Jar and debugger.<br />
Performance<br />
Programs written in Java have a reputation for being slower and requiring more memory than those written in some<br />
other languages. [26] However, Java programs' execution speed improved significantly with the introduction of<br />
Just-in-time compilation in 1997/1998 for Java 1.1, [27] [28] [29] the addition of language features supporting better<br />
code analysis (such as inner classes, StringBuffer class, optional assertions, etc.), and optimizations in the Java<br />
Virtual Machine itself, such as HotSpot becoming the default for Sun's JVM in 2000.<br />
To boost even further the speed performances that can be achieved using the Java language Systronix made JStik, [30]<br />
a microcontroller based on the aJile Systems [31] line of embedded Java processors. In addition, the widely used ARM<br />
family of CPUs has hardware support for executing Java bytecode through its Jazelle option.<br />
Automatic memory management<br />
Java uses an automatic garbage collector to manage memory in the object lifecycle. The programmer determines<br />
when objects are created, and the Java runtime is responsible for recovering the memory once objects are no longer<br />
in use. Once no references to an object remain, the unreachable memory becomes eligible to be freed automatically<br />
by the garbage collector. Something similar to a memory leak may still occur if a programmer's code holds a<br />
reference to an object that is no longer needed, typically when objects that are no longer needed are stored in<br />
containers that are still in use. If methods for a nonexistent object are called, a "null pointer exception" is thrown. [32]<br />
[33]
Java (programming language) 4<br />
One of the ideas behind Java's automatic memory management model is that programmers can be spared the burden<br />
of having to perform manual memory management. In some languages memory for the creation of objects is<br />
implicitly allocated on the stack, or explicitly allocated and deallocated from the heap. Either way, the responsibility<br />
of managing memory resides with the programmer. If the program does not deallocate an object, a memory leak<br />
occurs. If the program attempts to access or deallocate memory that has already been deallocated, the result is<br />
undefined and difficult to predict, and the program is likely to become unstable and/or crash. This can be partially<br />
remedied by the use of smart pointers, but these add overhead and complexity. Note that garbage collection does not<br />
prevent 'logical' memory leaks, i.e. those where the memory is still referenced but never used.<br />
Garbage collection may happen at any time. Ideally, it will occur when a program is idle. It is guaranteed to be<br />
triggered if there is insufficient free memory on the heap to allocate a new object; this can cause a program to stall<br />
momentarily. Explicit memory management is not possible in Java.<br />
Java does not support C/C++ style pointer arithmetic, where object addresses and unsigned integers (usually long<br />
integers) can be used interchangeably. This allows the garbage collector to relocate referenced objects, and ensures<br />
type safety and security.<br />
As in C++ and some other object-oriented languages, variables of Java's primitive data types are not objects. Values<br />
of primitive types are either stored directly in fields (for objects) or on the stack (for methods) rather than on the<br />
heap, as commonly true for objects (but see Escape analysis). This was a conscious decision by Java's designers for<br />
performance reasons. Because of this, Java was not considered to be a pure object-oriented programming language.<br />
However, as of Java 5.0, autoboxing enables programmers to proceed as if primitive types were instances of their<br />
wrapper class.<br />
Syntax<br />
The syntax of Java is largely derived from C++. Unlike C++, which combines the syntax for structured, generic, and<br />
object-oriented programming, Java was built almost exclusively as an object oriented language. All code is written<br />
inside a class and everything is an object, with the exception of the intrinsic data types (ordinal and real numbers,<br />
boolean values, and characters), which are not classes for performance reasons.<br />
Java suppresses several features (such as operator overloading and multiple inheritance) for classes in order to<br />
simplify the language and to prevent possible errors and anti-pattern design.<br />
Java uses similar commenting methods to C++. There are three different styles of comment: a single line style<br />
marked with two slashes (//), a multiple line style opened with a slash asterisk (/*) and closed with an asterisk slash<br />
(*/) and the Javadoc commenting style opened with a slash and two asterisks (/**) and closed with an asterisk slash<br />
(*/). The Javadoc style of commenting allows the user to run the Javadoc executable to compile documentation for<br />
the program.<br />
Example:<br />
//This is an example of a single line comment using two slashes<br />
/* This is an example of a multiple line comment using the slash<br />
and asterisk. This type of comment can be used to hold a lot of<br />
information<br />
or deactivate code but it is very important to remember to close the<br />
comment. */<br />
/** This is an example of a multiple line Javadoc comment<br />
which allows compilation from Javadoc of this comment. */
Java (programming language) 5<br />
Examples<br />
Hello world<br />
The traditional Hello world program can be written in Java as:<br />
// Outputs "Hello, world!" and then exits<br />
public class HelloWorld {<br />
}<br />
public static void main(String[] args) {<br />
}<br />
System.out.println("Hello world!");<br />
Source files must be named after the public class they contain, appending the suffix .java, for example,<br />
HelloWorld.java. It must first be compiled into bytecode, using a Java compiler, producing a file named<br />
HelloWorld.class. Only then can it be executed, or 'launched'. The java source file may only contain one public class<br />
but can contain multiple classes with less than public access and any number of public inner classes.<br />
A class that is not declared public may be stored in any .java file. The compiler will generate a class file for each<br />
class defined in the source file. The name of the class file is the name of the class, with .class appended. For class<br />
file generation, anonymous classes are treated as if their name were the concatenation of the name of their enclosing<br />
class, a $, and an integer.<br />
The keyword public denotes that a method can be called from code in other classes, or that a class may be used by<br />
classes outside the class hierarchy. The class hierarchy is related to the name of the directory in which the .java file<br />
is.<br />
The keyword static in front of a method indicates a static method, which is associated only with the class and not<br />
with any specific instance of that class. Only static methods can be invoked without a reference to an object. Static<br />
methods cannot access any method variables that are not static.<br />
The keyword void indicates that the main method does not return any value to the caller. If a Java program is to exit<br />
with an error code, it must call System.exit() explicitly.<br />
The method name "main" is not a keyword in the Java language. It is simply the name of the method the Java<br />
launcher calls to pass control to the program. Java classes that run in managed environments such as applets and<br />
Enterprise JavaBean do not use or need a main() method. A java program may contain multiple classes that have<br />
main methods, which means that the VM needs to be explicitly told which class to launch from.<br />
The main method must accept an array of String objects. By convention, it is referenced as args although any other<br />
legal identifier name can be used. Since Java 5, the main method can also use variable arguments, in the form of<br />
public static void main(String... args), allowing the main method to be invoked with an arbitrary number of String<br />
arguments. The effect of this alternate declaration is semantically identical (the args parameter is still an array of<br />
String objects), but allows an alternative syntax for creating and passing the array.<br />
The Java launcher launches Java by loading a given class (specified on the command line or as an attribute in a JAR)<br />
and starting its public static void main(String[]) method. Stand-alone programs must declare this method explicitly.<br />
The String[] args parameter is an array of String objects containing any arguments passed to the class. The<br />
parameters to main are often passed by means of a command line.<br />
Printing is part of a Java standard library: The System class defines a public static field called out. The out object is<br />
an instance of the PrintStream class and provides many methods for printing data to standard out, including<br />
println(String) which also appends a new line to the passed string.<br />
The string "Hello, world!" is automatically converted to a String object by the compiler.
Java (programming language) 6<br />
A more comprehensive example<br />
// OddEven.java<br />
import javax.swing.JOptionPane;<br />
public class OddEven {<br />
// "input" is the number that the user gives to the computer<br />
private int input; // a whole number("int" means integer)<br />
/*<br />
* This is the constructor method. It gets called when an object of<br />
the OddEven type<br />
* is being created.<br />
*/<br />
public OddEven() {<br />
/*<br />
* Code not shown for simplicity. In most Java programs<br />
constructors can initialize objects<br />
* with default values, or create other objects that this object<br />
might use to perform its<br />
* functions. In some Java programs, the constructor may simply be<br />
an empty function if nothing<br />
* needs to be initialized prior to the functioning of the object.<br />
In this program's case, an<br />
* empty constructor would suffice, even if it is empty. A<br />
constructor must exist, however if the<br />
one.<br />
}<br />
* user doesn't put one in then the compiler will create an empty<br />
*/<br />
// This is the main method. It gets called when this class is run<br />
through a Java interpreter.<br />
public static void main(String[] args) {<br />
/*<br />
* This line of code creates a new instance of this class<br />
called "number" (also known as an<br />
* Object) and initializes it by calling the constructor. The<br />
next line of code calls<br />
you for a number<br />
}<br />
* the "showDialog()" method, which brings up a prompt to ask<br />
*/<br />
OddEven number = new OddEven();<br />
number.showDialog();<br />
public void showDialog() {<br />
/*
Java (programming language) 7<br />
dialog box<br />
* "try" makes sure nothing goes wrong. If something does,<br />
* the interpreter skips to "catch" to see what it should do.<br />
*/<br />
try {<br />
/*<br />
converted into<br />
instead of a word.<br />
calculate() that will<br />
* The code below brings up a JOptionPane, which is a<br />
* The String returned by the "showInputDialog()" method is<br />
* an integer, making the program treat it as a number<br />
* After that, this method calls a second method,<br />
* display either "Even" or "Odd."<br />
*/<br />
input =<br />
Integer.parseInt(JOptionPane.showInputDialog("Please Enter A Number"));<br />
calculate();<br />
} catch (NumberFormatException e) {<br />
/*<br />
* Getting in the catch block means that there was a<br />
problem with the format of<br />
of a number.<br />
* the number. Probably some letters were typed in instead<br />
*/<br />
numerical value.");<br />
}<br />
/*<br />
}<br />
System.err.println("ERROR: Invalid input. Please type in a<br />
* When this gets called, it sends a message to the interpreter.<br />
* The interpreter usually shows it on the command prompt (For<br />
Windows users)<br />
}<br />
* or the terminal (For Linux users).(Assuming it's open)<br />
*/<br />
private void calculate() {<br />
}<br />
if (input % 2 == 0) {<br />
System.out.println("Even");<br />
} else {<br />
}<br />
System.out.println("Odd");<br />
• The import statement imports the JOptionPane class from the javax.swing package.<br />
• The OddEven class declares a single private field of type int named input. Every instance of the OddEven class<br />
has its own copy of the input field. The private declaration means that no other class can access (read or write) the
Java (programming language) 8<br />
input field.<br />
• OddEven() is a public constructor. Constructors have the same name as the enclosing class they are declared in,<br />
and unlike a method, have no return type. A constructor is used to initialize an object that is a newly created<br />
instance of the class.<br />
• The calculate() method is declared without the static keyword. This means that the method is invoked using a<br />
specific instance of the OddEven class. (The reference used to invoke the method is passed as an undeclared<br />
parameter of type OddEven named this.) The method tests the expression input % 2 == 0 using the if keyword to<br />
see if the remainder of dividing the input field belonging to the instance of the class by two is zero. If this<br />
expression is true, then it prints Even; if this expression is false it prints Odd. (The input field can be equivalently<br />
accessed as this.input, which explicitly uses the undeclared this parameter.)<br />
• OddEven number = new OddEven(); declares a local object reference variable in the main method named<br />
number. This variable can hold a reference to an object of type OddEven. The declaration initializes number by<br />
first creating an instance of the OddEven class, using the new keyword and the OddEven() constructor, and then<br />
assigning this instance to the variable.<br />
• The statement number.showDialog(); calls the calculate method. The instance of OddEven object referenced by<br />
the number local variable is used to invoke the method and passed as the undeclared this parameter to the<br />
calculate method.<br />
• input = Integer.parseInt(JOptionPane.showInputDialog("Please Enter A Number")); is a statement that<br />
converts the type of String to the primitive data type int by using a utility function in the primitive wrapper class<br />
Integer.<br />
Special classes<br />
Applet<br />
Java applets are programs that are embedded in other applications, typically in a Web page displayed in a Web<br />
browser.<br />
// Hello.java<br />
import javax.swing.JApplet;<br />
import java.awt.Graphics;<br />
public class Hello extends JApplet {<br />
}<br />
public void paintComponent(Graphics g) {<br />
}<br />
g.drawString("Hello, world!", 65, 95);<br />
The import statements direct the Java compiler to include the javax.swing.JApplet and java.awt.Graphics classes<br />
in the compilation. The import statement allows these classes to be referenced in the source code using the simple<br />
class name (i.e. JApplet) instead of the fully qualified class name (i.e. javax.swing.JApplet).<br />
The Hello class extends (subclasses) the JApplet (Java Applet) class; the JApplet class provides the framework for<br />
the host application to display and control the lifecycle of the applet. The JApplet class is a JComponent (Java<br />
Graphical Component) which provides the applet with the capability to display a graphical user interface (GUI) and<br />
respond to user events.<br />
The Hello class overrides the paintComponent(Graphics) method inherited from the Container superclass to<br />
provide the code to display the applet. The paintComponent() method is passed a Graphics object that contains the<br />
graphic context used to display the applet. The paintComponent() method calls the graphic context
Java (programming language) 9<br />
drawString(String, int, int) method to display the "Hello, world!" string at a pixel offset of (65, 95) from the<br />
upper-left corner in the applet's display.<br />
<br />
<br />
<br />
<br />
Hello World Applet<br />
<br />
<br />
<br />
<br />
<br />
<br />
An applet is placed in an HTML document using the HTML element. The applet tag has three attributes<br />
set: code="Hello" specifies the name of the JApplet class and width="200" height="200" sets the pixel width and<br />
height of the applet. Applets may also be embedded in HTML using either the object or embed element, [34] although<br />
support for these elements by Web browsers is inconsistent. [35] However, the applet tag is deprecated, so the object<br />
tag is preferred where supported.<br />
The host application, typically a Web browser, instantiates the Hello applet and creates an AppletContext for the<br />
applet. Once the applet has initialized itself, it is added to the AWT display hierarchy. The paintComponent()<br />
method is called by the AWT event dispatching thread whenever the display needs the applet to draw itself.<br />
Servlet<br />
Java Servlet technology provides Web developers with a simple, consistent mechanism for extending the<br />
functionality of a Web server and for accessing existing business systems. Servlets are server-side Java EE<br />
components that generate responses (typically HTML pages) to requests (typically HTTP requests) from clients. A<br />
servlet can almost be thought of as an applet that runs on the server side—without a face.<br />
// Hello.java<br />
import java.io.*;<br />
import javax.servlet.*;<br />
public class Hello extends GenericServlet {<br />
public void service(ServletRequest request, ServletResponse<br />
response)<br />
}<br />
}<br />
throws ServletException, IOException {<br />
response.setContentType("text/html");<br />
final PrintWriter pw = response.getWriter();<br />
pw.println("Hello, world!");<br />
pw.close();<br />
The import statements direct the Java compiler to include all of the public classes and interfaces from the java.io<br />
and javax.servlet [36] packages in the compilation.
Java (programming language) 10<br />
The Hello class extends the GenericServlet [37] class; the GenericServlet class provides the interface for the server<br />
to forward requests to the servlet and control the servlet's lifecycle.<br />
The Hello class overrides the service(ServletRequest, ServletResponse) [38] method defined by the Servlet [39]<br />
interface to provide the code for the service request handler. The service() method is passed a ServletRequest [40]<br />
object that contains the request from the client and a ServletResponse [41] object used to create the response returned<br />
to the client. The service() method declares that it throws the exceptions ServletException [42] and IOException if a<br />
problem prevents it from responding to the request.<br />
The setContentType(String) [43] method in the response object is called to set the MIME content type of the<br />
returned data to "text/html". The getWriter() [44] method in the response returns a PrintWriter object that is used<br />
to write the data that is sent to the client. The println(String) method is called to write the "Hello, world!" string to<br />
the response and then the close() method is called to close the print writer, which causes the data that has been<br />
written to the stream to be returned to the client.<br />
JavaServer Pages<br />
JavaServer Pages (JSP) are server-side Java EE components that generate responses, typically HTML pages, to<br />
HTTP requests from clients. JSPs embed Java code in an HTML page by using the special delimiters . A<br />
JSP is compiled to a Java servlet, a Java application in its own right, the first time it is accessed. After that, the<br />
generated servlet creates the response.<br />
Swing application<br />
Swing is a graphical user interface library for the Java SE platform. It is possible to specify a different look and feel<br />
through the pluggable look and feel system of Swing. Clones of Windows, GTK+ and Motif are supplied by Sun.<br />
Apple also provides an Aqua look and feel for Mac OS X. Where prior implementations of these looks and feels may<br />
have been considered lacking, Swing in Java SE 6 addresses this problem by using more native GUI widget drawing<br />
routines of the underlying platforms.<br />
This example Swing application creates a single window with "Hello, world!" inside:<br />
// Hello.java (Java SE 5)<br />
import javax.swing.*;<br />
public class Hello extends JFrame {<br />
}<br />
public Hello() {<br />
}<br />
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);<br />
add(new JLabel("Hello, world!"));<br />
pack();<br />
public static void main(String[] args) {<br />
}<br />
new Hello().setVisible(true);<br />
The first import includes all of the public classes and interfaces from the javax.swing package.<br />
The Hello class extends the JFrame class; the JFrame class implements a window with a title bar and a close<br />
control.<br />
The Hello() constructor initializes the frame by first calling the superclass constructor, passing the parameter "hello",<br />
which is used as the window's title. It then calls the setDefaultCloseOperation(int) method inherited from JFrame
Java (programming language) 11<br />
to set the default operation when the close control on the title bar is selected to<br />
WindowConstants.EXIT_ON_CLOSE — this causes the JFrame to be disposed of when the frame is closed (as<br />
opposed to merely hidden), which allows the JVM to exit and the program to terminate. Next, a JLabel is created for<br />
the string "Hello, world!" and the add(Component) method inherited from the Container superclass is called to add<br />
the label to the frame. The pack() method inherited from the Window superclass is called to size the window and lay<br />
out its contents.<br />
The main() method is called by the JVM when the program starts. It instantiates a new Hello frame and causes it to<br />
be displayed by calling the setVisible(boolean) method inherited from the Component superclass with the boolean<br />
parameter true. Once the frame is displayed, exiting the main method does not cause the program to terminate<br />
because the AWT event dispatching thread remains active until all of the Swing top-level windows have been<br />
disposed.<br />
Generics<br />
In 2004 generics were added to the Java language, as part of J2SE 5.0. Prior to the introduction of generics, each<br />
variable declaration had to be of a specific type. For container classes, for example, this is a problem because there is<br />
no easy way to create a container that accepts only specific types of objects. Either the container operates on all<br />
subtypes of a class or interface, usually Object, or a different container class has to be created for each contained<br />
class. Generics allow compile-time type checking without having to create a large number of container classes, each<br />
containing almost identical code.<br />
Class libraries<br />
• Java libraries are the compiled<br />
bytecodes of source code developed<br />
by the JRE implementor to support<br />
application development in Java.<br />
Examples of these libraries are:<br />
• The core libraries, which<br />
include:<br />
• Collection libraries that<br />
implement data structures<br />
such as lists, dictionaries,<br />
trees and sets<br />
• XML Processing (Parsing,<br />
Transforming, Validating) libraries<br />
• Security<br />
• Internationalization and localization libraries<br />
Java Platform and Class libraries diagram<br />
• The integration libraries, which allow the application writer to communicate with external systems. These<br />
libraries include:<br />
• The Java Database Connectivity (JDBC) API for database access<br />
• Java Naming and Directory Interface (JNDI) for lookup and discovery<br />
• RMI and CORBA for distributed application development<br />
• JMX for managing and monitoring applications<br />
• User interface libraries, which include:<br />
• The (heavyweight, or native) Abstract Window Toolkit (AWT), which provides GUI components, the<br />
means for laying out those components and the means for handling events from those components
Java (programming language) 12<br />
• The (lightweight) Swing libraries, which are built on AWT but provide (non-native) implementations of the<br />
AWT widgetry<br />
• APIs for audio capture, processing, and playback<br />
• A platform dependent implementation of Java Virtual Machine (JVM) that is the means by which the byte codes<br />
of the Java libraries and third party applications are executed<br />
• Plugins, which enable applets to be run in Web browsers<br />
• Java Web Start, which allows Java applications to be efficiently distributed to end-users across the Internet<br />
• Licensing and documentation.<br />
Documentation<br />
Javadoc is a comprehensive documentation system, created by Sun Microsystems, used by many Java developers. It<br />
provides developers with an organized system for documenting their code. Whereas normal comments in Java and C<br />
are set off with /* and */, the multi-line comment tags, Javadoc comments have an extra asterisk at the beginning, so<br />
that the tags are /** and */.<br />
Editions<br />
Java Card<br />
Micro Edition (ME)<br />
Standard Edition (SE)<br />
Enterprise Edition (EE)<br />
PersonalJava (discontinued)<br />
Sun has defined and supports four editions of Java targeting different application environments and segmented many<br />
of its APIs so that they belong to one of the platforms. The platforms are:<br />
• Java Card for smartcards.<br />
• Java Platform, Micro Edition (Java ME) — targeting environments with limited resources.<br />
• Java Platform, Standard Edition (Java SE) — targeting workstation environments.<br />
• Java Platform, Enterprise Edition (Java EE) — targeting large distributed enterprise or Internet environments.<br />
The classes in the Java APIs are organized into separate groups called packages. Each package contains a set of<br />
related interfaces, classes and exceptions. Refer to the separate platforms for a description of the packages available.<br />
The set of APIs is controlled by Sun Microsystems in cooperation with others through the Java Community Process<br />
program. Companies or individuals participating in this process can influence the design and development of the<br />
APIs. This process has been a subject of controversy.<br />
Sun also provided an edition called PersonalJava that has been superseded by later, standards-based Java ME<br />
configuration-profile pairings.
Java (programming language) 13<br />
See also<br />
• Comparison of programming languages<br />
• Comparison of Java and C++<br />
• Comparison of Java and C#<br />
• JavaOne<br />
• Javapedia<br />
• List of Java virtual machines<br />
References<br />
• List of Java APIs<br />
• List of JVM languages<br />
• C#<br />
• Java version history<br />
• Oak<br />
• Jon Byous, Java technology: The early years [45] . Sun Developer Network, no date [ca. 1998]. Retrieved April<br />
22, 2005.<br />
• James Gosling, A brief history of the Green project [46] . Java.net, no date [ca. Q1/1998]. Retrieved April 29, 2007.<br />
• James Gosling, Bill Joy, Guy Steele, and Gilad Bracha, The Java language specification, third edition.<br />
Addison-Wesley, 2005. ISBN 0-321-24678-0 (see also online edition of the specification [47] ).<br />
• Tim Lindholm and Frank Yellin. The Java Virtual Machine specification, second edition. Addison-Wesley, 1999.<br />
ISBN 0-201-43294-3 (see also online edition of the specification [48] ).<br />
External links<br />
• Sun Microsystems: Java home page [49]<br />
• Sun Microsystems: Developer Resources for Java Technology [50] .<br />
• Chamber of Chartered Java Professionals International: Professionalism for Java Technology [51] .<br />
• Sun Microsystems: Java Language Specification 3rd Edition [52] .<br />
• Java SE 6 API Javadocs<br />
• A Brief History of the Green Project [46]<br />
• Michael O'Connell: Java: The Inside Story [53] , SunWord, July 1995.<br />
• Patrick Naughton: Java Was Strongly Influenced by Objective-C [54] (no date).<br />
• David Bank: The Java Saga [55] , Wired Issue 3.12 (December 1995).<br />
• Shahrooz Feizabadi: A history of Java [56] in: Marc Abrams, ed., World Wide Web – Beyond the Basics, Prentice<br />
Hall, 1998.<br />
• Patrick Naughton: The Long Strange Trip to Java [57] , March 18, 1996.<br />
• Open University (UK): M254 Java Everywhere [58] (free open content documents).<br />
• is-research GmbH: List of programming languages for a Java Virtual Machine [59] .<br />
• How Java's Floating-Point Hurts Everyone Everywhere [60] , by W. Kahan and Joseph D. Darcy, University of<br />
California, Berkeley.<br />
References<br />
[1] Java 5.0 added several new language features (the enhanced for loop, autoboxing, varargs and annotations), after they were introduced in the<br />
similar (and competing) C# language (http:/ / www. barrycornelius. com/ papers/ java5/ ) (http:/ / www. levenez. com/ lang/ )<br />
[2] "About Microsoft's "Delegates"" (http:/ / java. sun. com/ docs/ white/ delegates. html). . Retrieved 2010-01-11. "We looked very carefully at<br />
Delphi Object Pascal and built a working prototype of bound method references in order to understand their interaction with the Java<br />
programming language and its APIs. [...] Our conclusion was that bound method references are unnecessary and detrimental to the language.<br />
This decision was made in consultation with Borland International, who had previous experience with bound method references in Delphi<br />
Object Pascal."<br />
[3] "The Java Language Environment" (http:/ / java. sun. com/ docs/ white/ langenv/ Intro. doc1. html#943). May 1996. .<br />
[4] "The Java Language Specification, 2nd Edition" (http:/ / java. sun. com/ docs/ books/ jls/ second_edition/ html/ intro. doc. html#237601). .<br />
[5] "The A-Z of Programming Languages: Modula-3" (http:/ / www. computerworld. com. au/ index. php/<br />
id;1422447371;pp;3;fp;4194304;fpid;1). Computerworld.com.au. . Retrieved 2010-06-09.
Java (programming language) 14<br />
[6] Patrick Naughton cites Objective-C as a strong influence on the design of the Java programming language, stating that notable direct<br />
derivatives include Java interfaces (derived from Objective-C's protocol) and primitive wrapper classes. (http:/ / cs. gmu. edu/ ~sean/ stuff/<br />
java-objc. html)<br />
[7] TechMetrix Research (1999). "History of Java" (http:/ / www. fscript. org/ prof/ javapassport. pdf). Java Application Servers Report. . "The<br />
project went ahead under the name "green" and the language was based on an old model of UCSD Pascal, which makes it possible to generate<br />
interpretive code"<br />
[8] "A Conversation with James Gosling – ACM Queue" (http:/ / queue. acm. org/ detail. cfm?id=1017013). Queue.acm.org. 2004-08-31. .<br />
Retrieved 2010-06-09.<br />
[9] http:/ / www. oracle. com/ technetwork/ java/<br />
[10] "Programming Language Popularity" (http:/ / www. langpop. com/ ). 2009. . Retrieved 2009-01-16.<br />
[11] "TIOBE Programming Community Index" (http:/ / www. tiobe. com/ index. php/ content/ paperinfo/ tpci/ index. html). 2009. . Retrieved<br />
2009-05-06.<br />
[12] Byous, Jon (ca. 1998). "Java technology: The early years" (http:/ / java. sun. com/ features/ 1998/ 05/ birthday. html). Sun Developer<br />
Network. Sun Microsystems. . Retrieved 2005-04-22.<br />
[13] "The History of Java Technology" (http:/ / www. java. com/ en/ javahistory/ ). Sun Developer Network. ca. 1995. . Retrieved 2010-04-30.<br />
[14] "Jonathan Schwartz's Blog: Different Isn't Always Better, But Better's Always Different" (http:/ / blogs. sun. com/ jonathan/ entry/<br />
better_is_always_different). Blogs.sun.com. . Retrieved 2010-06-09.<br />
[15] Heinz Kabutz, Once Upon an Oak (http:/ / www. artima. com/ weblogs/ viewpost. jsp?thread=7555). Artima. Retrieved April 29, 2007.<br />
[16] Java Study Group (http:/ / www. open-std. org/ JTC1/ SC22/ JSG/ ); Why Java Was – Not – Standardized Twice (http:/ / csdl2. computer.<br />
org/ comp/ proceedings/ hicss/ 2001/ 0981/ 05/ 09815015. pdf); What is ECMA—and why Microsoft cares (http:/ / techupdate. zdnet. com/<br />
techupdate/ stories/ main/ 0,14179,2832719,00. html)<br />
[17] "Java Community Process website" (http:/ / www. jcp. org/ en/ home/ index). Jcp.org. 2010-05-24. . Retrieved 2010-06-09.<br />
[18] "JAVAONE: Sun – The bulk of Java is open sourced" (http:/ / open. itworld. com/ 4915/ 070508opsjava/ page_1. html). open.itworld.com. .<br />
Retrieved 2010-06-09.<br />
[19] "Sun’s Evolving Role as Java Evangelist" (http:/ / onjava. com/ pub/ a/ onjava/ 2002/ 04/ 17/ evangelism. html). O'Reilly Media. .<br />
[20] "1.2 Design Goals of the JavaTM Programming Language" (http:/ / java. sun. com/ docs/ white/ langenv/ Intro. doc2. html). Java.sun.com.<br />
1999-01-01. . Retrieved 2010-06-09.<br />
[21] Andy Patrizio (2006). "Sun Embraces Linux With New Java License" (http:/ / www. internetnews. com/ dev-news/ article. php/ 3606656).<br />
Internet News. Web Media Brands. . Retrieved 2009-09-29.<br />
[22] "Java for Mac OS X" (http:/ / developer. apple. com/ java/ ). Apple Developer Connection. Apple. . Retrieved 2009-09-29.<br />
[23] "Microsoft Java Virtual Machine Support" (http:/ / www. microsoft. com/ mscorp/ java/ default. mspx). Microsoft.com. . Retrieved<br />
2010-06-09.<br />
[24] "Java SE – Licensees" (http:/ / java. sun. com/ javase/ licensees. jsp). Java.sun.com. 2008-08-12. . Retrieved 2010-06-09.<br />
[25] James Niccolai (January 23, 2001). "Sun, Microsoft settle Java lawsuit" (http:/ / www. javaworld. com/ javaworld/ jw-01-2001/<br />
jw-0124-iw-mssuncourt. html). JavaWorld (IDG). . Retrieved 2008-07-09.<br />
[26] Jelovic, Dejan. "Why Java Will Always Be Slower than C++" (http:/ / www. jelovic. com/ articles/ why_java_is_slow. htm). . Retrieved<br />
2008-02-15.<br />
[27] "Symantec's Just-In-Time Java Compiler To Be Integrated Into Sun JDK 1.1" (http:/ / www. symantec. com/ about/ news/ release/ article.<br />
jsp?prid=19970407_03). .<br />
[28] "Apple Licenses Symantec's Just In Time (JIT) Compiler To Accelerate Mac OS Runtime For Java" (http:/ / findarticles. com/ p/ articles/<br />
mi_hb6676/ is_/ ai_n26150624). .<br />
[29] "Java gets four times faster with new Symantec just-in-time compiler" (http:/ / www. infoworld. com/ cgi-bin/ displayStory. pl?980416.<br />
ehjdk. htm). .<br />
[30] "Official JStik Website" (http:/ / www. jstik. com/ ). Jstik.com. . Retrieved 2010-06-09.<br />
[31] "aJile Systems Inc" (http:/ / www. ajile. com/ index. php?option=com_content& task=view& id=21& Itemid=28). Ajile.com. . Retrieved<br />
2010-06-09.<br />
[32] "NullPointerException" (http:/ / java. sun. com/ j2se/ 1. 4. 2/ docs/ api/ java/ lang/ NullPointerException. html). Java.sun.com. . Retrieved<br />
2010-06-09.<br />
[33] "Exceptions in Java" (http:/ / www. artima. com/ designtechniques/ exceptions. html). Artima.com. . Retrieved 2010-08-10.<br />
[34] "Using the applet Tag (The Java Tutorials > Deployment > Applets)" (http:/ / java. sun. com/ docs/ books/ tutorial/ deployment/ applet/<br />
applettag. html). Java.sun.com. . Retrieved 2010-06-09.<br />
[35] "Deploying Applets in a Mixed-Browser Environment (The Java Tutorials > Deployment > Applets)" (http:/ / java. sun. com/ docs/ books/<br />
tutorial/ deployment/ applet/ mixedbrowser. html). Java.sun.com. . Retrieved 2010-06-09.<br />
[36] http:/ / java. sun. com/ javaee/ 6/ docs/ api/ javax/ servlet/ package-summary. html<br />
[37] http:/ / java. sun. com/ javaee/ 6/ docs/ api/ javax/ servlet/ GenericServlet. html<br />
[38] http:/ / java. sun. com/ javaee/ 6/ docs/ api/ javax/ servlet/ Servlet. html#service(javax. servlet. ServletRequest,javax. servlet.<br />
ServletResponse)<br />
[39] http:/ / java. sun. com/ javaee/ 6/ docs/ api/ javax/ servlet/ Servlet. html<br />
[40] http:/ / java. sun. com/ javaee/ 6/ docs/ api/ javax/ servlet/ ServletRequest. html
Java (programming language) 15<br />
[41] http:/ / java. sun. com/ javaee/ 6/ docs/ api/ javax/ servlet/ ServletResponse. html<br />
[42] http:/ / java. sun. com/ javaee/ 6/ docs/ api/ javax/ servlet/ ServletException. html<br />
[43] http:/ / java. sun. com/ javaee/ 6/ docs/ api/ javax/ servlet/ ServletResponse. html#setContentType(java. lang. String)<br />
[44] http:/ / java. sun. com/ javaee/ 6/ docs/ api/ javax/ servlet/ ServletResponse. html#getWriter()<br />
[45] http:/ / java. sun. com/ features/ 1998/ 05/ birthday. html<br />
[46] https:/ / duke. dev. java. net/ green/<br />
[47] http:/ / java. sun. com/ docs/ books/ jls/ index. html<br />
[48] http:/ / java. sun. com/ docs/ books/ vmspec/ 2nd-edition/ html/ VMSpecTOC. doc. html<br />
[49] http:/ / www. java. com/<br />
[50] http:/ / java. sun. com/<br />
[51] http:/ / www. ccjpint. org/<br />
[52] http:/ / java. sun. com/ docs/ books/ jls/ third_edition/ html/ j3TOC. html<br />
[53] http:/ / sunsite. uakom. sk/ sunworldonline/ swol-07-1995/ swol-07-java. html<br />
[54] http:/ / cs. gmu. edu/ ~sean/ stuff/ java-objc. html<br />
[55] http:/ / www. wired. com/ wired/ archive/ 3. 12/ java. saga. html<br />
[56] http:/ / ei. cs. vt. edu/ ~wwwbtb/ book/ chap1/ java_hist. html<br />
[57] http:/ / www. blinkenlights. com/ classiccmp/ javaorigin. html<br />
[58] http:/ / computing. open. ac. uk/ m254/<br />
[59] http:/ / www. is-research. de/ info/ vmlanguages/<br />
[60] http:/ / www. eecs. berkeley. edu/ ~wkahan/ JAVAhurt. pdf<br />
Web Language<br />
HP's Web Language (formerly known as WebL and renamed to avoid a possible trademark conflict [1] ) is a<br />
scripting language for automating tasks on the World-Wide Web. It is an imperative, interpreted programming<br />
language implemented in Java and running on the Java Platform that has built-in support for common web protocols<br />
like HTTP and FTP, and popular data types like HTML and XML.<br />
External links<br />
• Archived Web site [2]<br />
References<br />
[1] "FAQ - Why the name change?" (http:/ / web. archive. org/ web/ 20070428123803/ http:/ / www. hpl. hp. com/ downloads/ crl/ webl/ faq.<br />
html#name). . Retrieved 2009-03-20.<br />
[2] http:/ / web. archive. org/ web/ 20070507043202/ http:/ / www. hpl. hp. com/ downloads/ crl/ webl/ index. html
AgentSheets 16<br />
AgentSheets<br />
rule based visual programming<br />
Paradigm object-oriented, educational, Conversational Programming<br />
Appeared in 1999<br />
Designed by Alexander Repenning<br />
Stable<br />
release<br />
3.0 (February 7, 2010)<br />
Influenced by Lisp, Logo, Smalltalk<br />
Influenced Etoys, Scratch<br />
OS OS X, Windows, Linux<br />
Website http:/ / www. agentsheets. com<br />
AgentSheets is an educational Cyberlearning [1] tool to create Web-based simulation games. AgentSheets is used<br />
worldwide to teach students programming and related information technology skills through game design. The<br />
built-in drag-and-drop language is accessible enough that students without programming background can make their<br />
own simple Frogger-like game, and publish it on the Web, in their first session. At the same time, AgentSheets is<br />
powerful enough to make sophisticated The Sims-like games with artificial intelligence. To transition from visual<br />
programming to more traditional programming students can render their games into Java source code.<br />
AgentSheets is supported by a middle and high school curriculum called Scalabable Game Design aligned with the<br />
ISTE National Educational Technology Standards (NETS). The mission of this project is to reinvent computer<br />
science in public schools by motivating & educating all students including women and underrepresented<br />
communities to learn about computer science through game design starting at the middle school level. Through this<br />
curriculum students build increasingly sophisticated games and, as part of this process, learn about computational<br />
concepts at the level of computational thinking that are relevant to game design as well as to computational science.<br />
The curriculum is made available through the Scalable Game Design Wiki [2] . Research investigating motivational<br />
aspects of computer science education in public schools is currently exploring the introduction of game design in<br />
representative regions of the USA including technology hubs, inner city, rural and remote/tribal areas. Previous<br />
research has already found that game design with AgentSheets is universally accessible across gender as well as<br />
ethnicity and is not limited to students interested in playing video games [3] .<br />
The results [4] of the NSF ITEST program supported research investigating motivational and educational aspects of<br />
introducing computer science at the middle school level are extremely positive in terms of motivational levels,<br />
number of participants and participation of women and underrepresented communities. The participation is<br />
extremely high because most middle schools participating in the study have made Scalable Game Design a module<br />
that is part of existing required courses (e.g., computer power with keyboarding and power point). Many of the<br />
middle schools instruct all of their students in scalable game design reaching in some schools over 900 students per
AgentSheets 17<br />
year, per school. Of the well over 1000 students participating in the project in the first semester over 52% were girls.<br />
Of the girls 85% enjoyed the scalable game design course and 78% would like to take another game design course.<br />
Similar to a spreadsheet, an agentsheet is a computational grid. Unlike spreadsheets, this grid does not just contain<br />
numbers and strings but so called agents. These agents are represented by pictures, can be animated, make sounds,<br />
react to mouse/keyboard interactions, can read web pages, can speak and even recognize speech commands (Mac).<br />
This grid is well suited to build computational science applications modeling complex scientific phenomena with up<br />
to tens of thousands of agents. The grid is useful to build agent-based simulations including cellular automata or<br />
diffusion-based models. These models are used in a wide variety of applications. How does a mudslide work? When<br />
does a bridge collapse? How fragile are ecosystems? This ability to support game as well as computational science<br />
applications with the inclusion of scientific visualizations makes AgentSheets a unique computational thinking tool<br />
that is used computer science and STEM education.<br />
This work including research, development and commercialization is supported by the National Science Foundation.<br />
Any opinions, findings, and conclusions or recommendations expressed in this material are those of the authors and<br />
do not necessarily reflect the views of the National Science Foundation.<br />
How AgentSheets is used<br />
AgentSheets is used in a number of contexts worldwide:<br />
• Middle school students create food web simulations to explore the<br />
complexity of ecological systems<br />
• Middle school computer clubs students build computer games<br />
ranging from simple arcade classic such as Frogger to sophisticated<br />
AI-based games such as The Sims.<br />
• High school students use AgentSheets as story telling and<br />
simulation tool of historical events such as the César Chávez grape<br />
boycott [5]<br />
• High school students simulate predator prey worlds and analyzed<br />
data created with spreadsheets and plots<br />
• After school science programs show students how to build their own<br />
science simulations ranging from forest fire simulations to the spreading of viruses.<br />
• High school students use AgentSheets as introduction to programming tool [6]<br />
• Graduate and undergraduate courses on educational game design use AgentSheets to prototype, playtest, refine,<br />
and publish simple educational games [7]<br />
• Research exploring Artificial intelligence and collaborative agents, e.g., Antiobjects<br />
History<br />
The original goal of this research was to explore new models of computational thinking. The first prototype of<br />
AgentSheets ran in 1989 at the University of Colorado, NCAR, Connection Machine 2. The Connection Machine is<br />
a highly parallel computer with up to 64,000 CPUs. Realizing how hard it was to program the Connection Machine<br />
the insight that "CPU cycles will always be ultimately cheaper than cognitive cycles" led to the exploration of<br />
several new programming paradigms:<br />
• Agent-Based Graphical Rewrite Rules: (1991) Behavior such as a train following train tracks can be specified<br />
through before/after rules. These rules can be created by programming by example. The user would tell the<br />
system to watch the train; the user would move the train on train track one step and stop recording; the system<br />
would create the rule allowing trains to follow train tracks. Agent-Based Graphical Rewrite Rules were later also<br />
used in the KidSim/Cocoa/Creator kid programming tool.
AgentSheets 18<br />
• Semantical Rewrite Rules: (1994) It became clear that Agent-Based Graphical Rewrite Rules used in<br />
AgentSheets91 and KidSim/Cocoa/Creator were not powerful enough for a number of applications that required<br />
more general pattern. For instance, it was simple to create a rule to make a train follow a straight segment of train<br />
track but the number of rules quickly exploded when trying to have trains follow all combinations of turns and<br />
intersections. Semantic rewrite rules could interpret rules topologically. With a single rule a user could create a<br />
complete train that follows train track behavior.<br />
• Programming by Analogous Examples: (1995) New behavior can be created through analogies. For instance<br />
the behavior of a car can be described as analogy to trains. A car moves on a road like a train on a train track. A<br />
challenge to this approach is conceptual exception handling. Analogies are often either incomplete or too general.<br />
This requires that users can refine programs produced by Programming by Analogous Examples.<br />
• Tactile Programming: (1996) AgentSheets becomes the world's first drag and drop educational programming<br />
environment. Drag and drop interfaces can be used to compose syntactically correct programs. In Visual<br />
AgenTalk (VAT), a rule-based visual programming language, users create rules by dragging and dropping<br />
conditions and actions from palettes. The tactile aspect of Visual AgenTalk allows users to perceive through drag<br />
and drop what programs do. By dragging and dropping conditions, actions, rules and even methods onto agents<br />
they see the consequence of invoking program fragment without having to write a test program. Similar drag and<br />
drop programming can later be found in the Etoys language (part of Squeak), in Alice and in Scratch.<br />
• AgentSheets Inc.: (1996) With the support of the National Science Foundation AgentSheets has become a<br />
commercial product. The programming model has been extended, more interaction modalities have been added<br />
(e.g., speech recognition (Mac)), scientific visualization has been refined (e.g., 3D real time plotting (Mac)), and<br />
AgentSheets has been localized (e.g., Japanese and Greek).<br />
• Scalable Game Design: (2008) A game design based free curriculum covering computational thinking ideas from<br />
elementary to graduate school based on AgentSheets. The mission of Scalable Game Design is to: Reinventing<br />
computer science in public schools by motivating & educating all students including women and<br />
underrepresented communities to learn about computer science through game design starting at the middle school<br />
level. The project is funded by the National Science Foundation.<br />
• Conversational Programming: (2010) AgentSheets 3 is the world first programming environment supporting<br />
computational thinking by providing information about the meaning of the program. Unlike visual programming<br />
approaches, which only help with syntactic challenges, such as avoiding missing semicolons, Conversational<br />
Programming helps with the semantics, that is the meaning of your program. Is this condition true right now?<br />
Would this rule fire? Why does that rule fail? A conversational programming agent will tell all this and more in a<br />
non intrusive kind of way.<br />
See also<br />
• Web based simulation (WBS)<br />
External links<br />
• Middle school students making games after 2 hours (YouTube HD movie) [8]<br />
• AgentSheets papers [9]<br />
• Educational use of AgentSheets in the Edutech Wiki [10]<br />
• AgentSheets Inc [11]<br />
• AgentSheets European Union Project (Greek) [12]
AgentSheets 19<br />
References<br />
[1] Cyberlearning defined by the National Science Foundation (http:/ / www. nsf. gov/ pubs/ 2008/ nsf08204/ nsf08204. pdf)<br />
[2] Scalable Game Design Wiki (http:/ / scalablegamedesign. cs. colorado. edu/ wiki/ )<br />
[3] publications related to the Scalable Game Design project (http:/ / scalablegamedesign. cs. colorado. edu/ wiki/ Publications)<br />
[4] http:/ / scalablegamedesign. cs. colorado. edu/ gamewiki/ images/ 2/ 27/ Scalable_Game_Design_Results. pdf<br />
[5] grape boycott project with simulation (http:/ / l3d. cs. colorado. edu/ systems/ agentsheets/ New-Vista/ grape-boycott/ )<br />
[6] An example GK-12 NSF program using AgentSheets: the Memphis Tri-P-LETS project (http:/ / triplets. cs. memphis. edu/ index.<br />
php?page=project)<br />
[7] sample games called gamelets (http:/ / www. cs. colorado. edu/ ~ralex/ courses/ gamelet2006/ gamelets/ Space Invaders/ index. html)<br />
[8] http:/ / www. youtube. com/ watch?v=hcS2CPrYUdY<br />
[9] http:/ / www. cs. colorado. edu/ ~ralex/ papers/<br />
[10] http:/ / edutechwiki. unige. ch/ en/ AgentSheets<br />
[11] http:/ / www. agentsheets. com<br />
[12] http:/ / www. agentsheets. gr<br />
Oak (programming language)<br />
Oak was a programming language created by James Gosling in 1991, initially for Sun Microsystems set-top box<br />
project. The language later evolved to become Java.<br />
The name Oak was used by Gosling after an oak tree that stood outside his office.<br />
History<br />
In 1991, Sun Microsystems was attempting to develop a new technology for programming next generation smart<br />
appliances, which Sun expected to be a major new opportunity.<br />
The team originally considered using C++, but rejected the idea for several reasons (see Java history).<br />
Initially, Gosling attempted to modify and extend C++ but soon abandoned that in favor of creating a new platform<br />
called Green and an entirely new language, which he called Oak, after the tree that stood just outside his office [1] .<br />
By the summer of 1992, they were able to demonstrate portions of the new platform including the Green OS, the<br />
Oak language, the libraries, and the hardware. Their first attempt, demonstrated on September 3, 1992, focused on<br />
building a PDA device named Star7 star7 which had a graphical interface and a smart agent called "Duke" to assist the<br />
user.<br />
Oak was renamed Java in 1994 after a trademark search revealed that Oak was used by Oak Technology [2] . Java 1.0<br />
was finally shipped in 1996 [3] .<br />
Differences with Java<br />
Oak was the basis for what Java 1.0 became later, but there were also some differences [4] [5] : Several concepts were<br />
planned in the Oak specification but remained not implemented in the original language because of time constraints:<br />
• unsigned primitive types turned out never to be implemented in Java [6] .<br />
• The enum keyword for enumerated types was implemented in Java for Java 5.0.<br />
• The assert keyword was implemented in Java for Java 1.4 [7]<br />
Other concepts were different than, or improved later, for Java:<br />
• abstract methods were defined as in C++.<br />
• The package private access level did not exist in Oak. Classes with no access modifier were considered private.<br />
And finally some concepts were later scraped out:<br />
• All exceptions were unchecked.
Oak (programming language) 20<br />
• It was possible by the unprotect keyword to write code that would not signal asynchronous exceptions.<br />
See also<br />
• Java (programming language)<br />
• Java version history<br />
External links<br />
• Oak language specification [8]<br />
• Alternative site for Oak language specification [9]<br />
• Java early history [46]<br />
References<br />
[1] Jon Byous (April 2003). "Java Technology: The Early Years" (http:/ / java. sun. com/ features/ 1998/ 05/ birthday. html). Sun Microsystems. .<br />
Retrieved 2009-08-02.<br />
[2] Kieron Murphy (1996-04-10). "So why did they decide to call it Java?" (http:/ / www. javaworld. com/ javaworld/ jw-10-1996/<br />
jw-10-javaname. html). javaworld.com. . Retrieved 2009-08-03. "The lawyers had told us that we couldn't use the name 'OAK' because [it was<br />
already trademarked by] Oak Technologies," said Frank Yellin, a senior engineer at Sun. "So a brainstorming session was held to come up<br />
with ideas for a new name"<br />
[3] Jonathan I. Schwartz (2007-08-30). "Different Isn't Always Better, But Better's Always Different" (http:/ / blogs. sun. com/ jonathan/ entry/<br />
better_is_always_different). . Retrieved 2009-08-02.<br />
[4] Heinz Kabutz (2003-07-15). "Once Upon an Oak ..." (http:/ / www. artima. com/ weblogs/ viewpost. jsp?thread=7555). artima.com. .<br />
Retrieved 2009-08-02.<br />
[5] "Oak language specification" (https:/ / duke. dev. java. net/ green/ OakSpec0. 2. ps). Sun Microsystems. . Retrieved 2009-08-02.<br />
[6] "Java and unsigned int, unsigned short, unsigned byte, unsigned long, etc. (Or rather, the lack thereof)" (http:/ / www. darksleep. com/ player/<br />
JavaAndUnsignedTypes. html). . Retrieved 2009-08-02.<br />
[7] "A Simple Assertion Facility For the Java Programming Language" (http:/ / java. sun. com/ docs/ books/ jls/ assert-spec. html). Sun<br />
Microsystems. . Retrieved 2009-08-02.<br />
[8] https:/ / duke. dev. java. net/ green/ OakSpec0. 2. ps<br />
[9] http:/ / www. me. umn. edu/ ~shivane/ blogs/ cafefeed/ resources/ 14-jun-2007/ OakSpec0. 2. zip
Lightweight Java 21<br />
Lightweight Java<br />
Lightweight Java (LJ) is a fully-formalized and extensible minimal imperative fragment of Java. [1] [2] The language<br />
was designed for academic purposes within the Computer Laboratory, University of Cambridge. The definition of LJ<br />
was proven type-sound in Isabelle/HOL.<br />
References<br />
[1] http:/ / portal. acm. org/ citation. cfm?doid=1297027. 1297064<br />
[2] http:/ / www. cl. cam. ac. uk/ research/ pls/ javasem/ lj/
.properties 22<br />
.properties<br />
Filename<br />
extension<br />
Type of format ASCII<br />
.properties<br />
.properties is a file extension for files mainly used in Java related technologies to store the configurable parameters<br />
of an application. They can also be used for storing strings for Internationalization and localization; these are known<br />
as Property Resource Bundles.<br />
Each parameter is stored as a pair of strings, one storing the name of the parameter (called the key), and the other<br />
storing the value.<br />
Format<br />
Each line in a .properties file normally stores a single property. Several formats are possible for each line, including<br />
key=value, key = value, key:value, and key value.<br />
.properties files can use the number sign (#) or the exclamation mark (!) as the first non blank character in a line to<br />
denote that all text following it is a comment. The backwards slash is used to escape a character. An example of a<br />
properties file is provided below.<br />
# You are reading the ".properties" entry.<br />
! The exclamation mark can also mark text as comments.<br />
website = http://en.wikipedia.org/<br />
language = English<br />
# The backslash below tells the application to continue reading<br />
# the value onto the next line.<br />
message = Welcome to \<br />
Wikipedia!<br />
# Add spaces to the key<br />
key\ with\ spaces = This is the value that could be looked up with the key "key with spaces".<br />
# Unicode<br />
tab : \u0009<br />
In the example above, website would be a key, and its corresponding value would be<br />
http://en.wikipedia.org/. While the number sign and the exclamation mark marks text as comments, it<br />
has no effect when it is part of a property. Thus, the key message has the value Welcome to Wikipedia!<br />
and not Welcome to Wikipedia. Note also that all of the whitespace in front of Wikipedia! is excluded<br />
completely.<br />
The encoding of a .properties file is ISO-8859-1, also known as Latin-1. All non-Latin-1 characters must be entered<br />
by using Unicode escape characters, e. g. \uHHHH where HHHH is a hexadecimal index of the character in the<br />
Unicode character set. This allows for using .properties files as resource bundles for localization. A non-Latin-1 text<br />
file can be converted to a correct .properties file by using the native2ascii tool that is shipped with the JDK or by<br />
using a tool, such as po2prop [1] , that manages the transformation from a bilingual localization format into .properties<br />
escaping.
.properties 23<br />
See also<br />
• java.util.Properties.load(java.io.Reader) - gives the precise semantics of well-formed Java property files<br />
• java.util.PropertyResourceBundle - describes property resource bundles<br />
• YAML is used by some for more complex configuration formats.<br />
References<br />
[1] Translate Toolkit's po2prop (http:/ / translate. sourceforge. net/ wiki/ toolkit/ po2prop) converts native character encodings in a Gettext PO<br />
file into correctly escaped ascii without the need for native2ascii
Apache Harmony 24<br />
Apache Harmony<br />
Developer(s) Apache Software Foundation<br />
Stable release 5.0M14<br />
6.0M2 / June 7, 2010<br />
Development status Active<br />
Written in C++ and Java<br />
Operating system Windows and Linux<br />
Type Java Virtual Machine and Java Library<br />
License Apache License 2.0<br />
Website http:/ / harmony. apache. org<br />
Apache Harmony is an open source / free Java implementation from the Apache Software Foundation, starting with<br />
Java SE 5 and 6. It will be licensed under the Apache License, Version 2. It was announced in early May 2005 and<br />
on October 25, 2006, the Board of Directors voted to make Apache Harmony a top-level project.<br />
History<br />
Initiation<br />
The Harmony project was initially conceived as an effort to unite all developers of the Free Java implementations.<br />
Many developers expected that it would be the project above the GNU, Apache and other communities. GNU<br />
developers were invited into and participated during the initial, preparatory planning. Later it was decided not to use<br />
the code from GNU Classpath, and that Harmony would use an incompatible license; therefore blocking the sharing<br />
of code between Harmony and existing free Java projects. Apache developers would then write the needed classes<br />
from scratch and expect necessary large code donations from software companies.<br />
Reasons for rewriting from scratch<br />
The main reason for disagreements between the GNU Classpath and Apache projects is due to differences between<br />
the GNU General Public License (GNU Classpath's license also contains the linking exception) and Apache License.<br />
These disagreements are inspired by various organizations and individuals [1] that prefer the Apache License, which<br />
allows for closed source derived works. GNU Classpath can also be linked [2] with proprietary code, but it is legally<br />
difficult to make a closed source derivative of GNU Classpath itself. However, many free software developers think<br />
that the licenses and philosophy of these communities are not different enough to split the efforts, and the inability to<br />
find compromises is frequently estimated negatively. The occasionally appearing suggestion to view these projects<br />
as opposing forces does not find wide support. Enthusiasts of the free software tend to break the discussion with the<br />
simple words that "more free software is not a problem". [3]<br />
Difficulties to obtain a TCK license from Sun<br />
The Apache Software Foundation sent a letter to Sun Microsystems CEO, Jonathan Schwartz, on April 10, 2007,<br />
regarding their inability to acquire an acceptable license for the Java SE 5 Technology Compatibility Kit (TCK), a<br />
test kit needed by the project to demonstrate compatibility with the Java SE 5 specification, as required by the Sun<br />
specification license for Java SE 5. [4] What makes the license unacceptable for ASF is the fact that it imposes rights<br />
restrictions through limits on the "field of use" available to users of Harmony, not compliant with the Java<br />
Community Process rules. [5]
Apache Harmony 25<br />
Sun answered on a company blog [6][7] that it intended to create an open source implementation of the Java<br />
platform under GPL, including the TCK, but that their current priority was to make the Java Platform accessible to<br />
the GNU/Linux community under GPL as quickly as possible.<br />
This answer triggered some reactions, either criticizing Sun for not responding "in a sufficiently open manner" to an<br />
open letter [8], or rather Apache Software Foundation; some think that ASF acted unwisely to aggressively demand<br />
something they could have obtained with more diplomacy from Sun, especially considering the timescale of the<br />
opening class library [9] [10] .<br />
Since Sun's release of OpenJDK, Sun has released a specific license to allow to run the TCK in the OpenJDK context<br />
for any GPL implementation deriving substantially from OpenJDK [11] .<br />
Use in Android SDK<br />
Dalvik, the Virtual Machine used in Google's Android platform, use a subset of Harmony for the core of its Class<br />
Library [12] . However, Dalvik does not align to Java SE nor Java ME Class Library profiles (for example J2ME<br />
classes, AWT and Swing are not supported). Instead it uses its own library [13] , built on top of a subset of Harmony.<br />
Development team<br />
Apache Harmony started from being mostly developed by several companies, receiving large code contributions at<br />
once. However, the general discussions on the mailing lists were always opened for everyone, and later the Apache<br />
Software foundation mentors put a lot of effort [14] to bring the development process more in line with the Apache<br />
way, [15] and it seems that their efforts were highly successful. In November 1, 2006, the current team of committers<br />
consisted of 16 developers, 12 of them from IBM and Intel. [16]<br />
Recent development status<br />
Apache Harmony was accepted among the official Apache projects on 29 October 2006.<br />
Architecture<br />
The Dynamic Runtime Layer virtual machine consists of the following components:<br />
1. The VM core: with its subcomponents concentrates most of the JVM control functions.<br />
2. The porting layer: hides platform-specific details from other VM components behind a single interface and is<br />
based on the Apache Portable Runtime layer.<br />
3. The Garbage Collector: allocates Java objects in the heap memory and reclaims unreachable objects using<br />
various algorithms<br />
4. Execution Manager: selects the execution engine for compiling a method, handles profiles and the dynamic<br />
recompilation logic.<br />
5. Class Library: is a Java standard library.<br />
6. The thread manager that handle Operating system threading<br />
7. The execution engine: consists of the following:<br />
1. The just-in-time compiler for compilation and execution of method code.<br />
2. The interpreter for easier debugging.
Apache Harmony 26<br />
Support Platform and Operating System<br />
The project provide a portable implementation that ease development on many platforms and operating systems. The<br />
main focus is on Windows and Linux operating systems on x86 and x86-64 architectures. [17]<br />
IA32 (Pentium III or<br />
better)<br />
x86-64 (Intel 64,<br />
AMD64)<br />
Windows<br />
2000<br />
In progress<br />
Windows XP, Server 2003,<br />
Vista<br />
Linux RHEL, SLES, Debian,<br />
Gentoo, Fedora<br />
Yes Yes<br />
FreeBSD AIX Mac OS<br />
In<br />
progress<br />
X<br />
N/A N/A<br />
N/A Yes Yes N/A N/A N/A<br />
Itanium (IA64, IPF) N/A In progress Yes N/A N/A N/A<br />
PPC32 N/A N/A In progress N/A N/A N/A<br />
PPC64<br />
N/A N/A<br />
In progress<br />
N/A<br />
In<br />
progress<br />
zSeries (31 bit) N/A N/A In progress N/A N/A N/A<br />
Class Library Coverage<br />
The expected donations from software companies were<br />
actually received. The Apache Harmony now contains the<br />
working code, including the Swing, AWT and Java 2D<br />
code which were contributed by Intel.<br />
The part of the implemented classes is still smaller than in<br />
GNU Classpath (97.7% in the trunk versus almost 100%<br />
as of July 2007 [18] ), despite some non-trivial applications<br />
were shown being running in 2006 JavaOne international<br />
conference.<br />
Also Harmony's test suite is less extensive than GNU<br />
Classpath's for now (20000 tests [19] versus 50000 [20] as of October 2006).<br />
Java Platform diagram showing Class Library<br />
The progress of the Apache Harmony project can be tracked against J2SE 1.4 and Java SE 5.0. [21] Also, there is a<br />
branch for Harmony v6.0 in development for Java SE 6.0.<br />
Apache Harmony developers integrate several existing, field-tested open-source projects to meet their goal (not<br />
reinventing the wheel). Many of these projects are mature and well known and other part of the library need be<br />
writing from scratch.<br />
This is a list of existing open source components that are used in the Apache Harmony project; some of them were in<br />
use before the project started.<br />
N/A
Apache Harmony 27<br />
Component Description<br />
ICU Mature C/C++ and Java libraries for Unicode support, software internationalization and software globalization.<br />
Apache Xalan An XSLT stylesheet processor for Java and C++ which implements the XPath language.<br />
Apache Xerces An XML parser library for Java, C++ and Perl<br />
Apache Portable<br />
Runtime<br />
Cross-platform abstraction library provides platform independence.<br />
Apache CXF Robust and high performance Web Services framework work over protocols such as SOAP, XML/HTTP, RESTful HTTP,<br />
and CORBA.<br />
BCEL Libraries for decomposing, modifying, and recomposing binary Java classes (i.e., bytecode)<br />
MX4J Java Management Extensions (JMX) tools for managing and monitoring applications, system objects, devices and service<br />
oriented networks.<br />
vmmagic Set of extensions to the Java language to facilitate systems programming in Java by adding direct memory operations etc.<br />
Bouncy Castle Libraries collection of lightweight cryptography for Java and C#.<br />
ANTLR language tool that provides a framework for constructing recognizers, interpreters, compilers, and translators from<br />
Documentation<br />
grammatical descriptions containing actions in a variety of target languages.<br />
Harmony is currently less documented than the alternative free Java implementations. For instance, in GNU<br />
Classpath every method of the central CORBA class (ORB) has the explaining comment both in the standard<br />
abstract API class [22] and implementation [23]. In the Yoko [24] project, used by Harmony [25], the majority of<br />
methods both in the standard declaration [26] and implementing class [27] were not documented (at the end of<br />
October, 2006). Also, GNU Classpath supported both older and current CORBA features (same as Sun's<br />
implementation). Harmony, differently, left the central method of the older standard (ORB.connect(Object)) fully<br />
unimplemented.<br />
Tools<br />
A complete implementation of the Java platform also requires a compiler that translates Java source code into<br />
bytecodes, a program that manages JAR files, a debugger, and an applet viewer and web browser plugin, to name a<br />
few. Harmony currently has the compiler, appletviewer, jarsigner, javah, javap, keytool, policytool, and unpack200<br />
[28].<br />
Virtual machine support<br />
Harmony currently has seven virtual machine implementations that run Harmony Class Library, all of which were<br />
donations by external groups:<br />
• JC Harmony Edition VM, "JCHEVM," based on the JCVM's interpreter, contributed by the author, Archie Cobbs.<br />
• BootJVM, a simple bootstrapping virtual machine, contributed by Daniel Lydick.<br />
• SableVM, an advanced, portable interpreter, contributed by authors from the Sable Research Group; and the<br />
Dynamic Runtime Layer Virtual Machine.<br />
• DRLVM, a just-in-time compiler contributed by Intel.<br />
• BEA announced the availability of an evaluation version of JRockit VM running Apache Harmony Class<br />
Library [29] .<br />
• JikesRVM, an open-source meta-circular JVM that use the Apache Harmony Class Library [30] .<br />
• Ja.NET SE - the open source project is providing a Java 5 JDK (class libraries, tools, etc.) that run on the .NET<br />
CLR. Ja.NET SE is based on the Apache Harmony Class Libraries [31] .
Apache Harmony 28<br />
In the end of November, 2006, the language support provided by these virtual machine was still incomplete, and the<br />
build instructions recommended to use IBM's proprietary J9 instead to run the class library test suite. However, this<br />
is not necessary anymore (as of July 2007). The DRLVM virtual machine is currently (as of July 2006) under heavy<br />
development, so a fast improvement of its features can be expected.<br />
Applications status<br />
Since its conception, Harmony has steadily grown in its ability to execute non-trivial Java applications (see here<br />
[32] ). As of July 2007, supported applications include:<br />
• Eclipse : 99.3% of the 36000 RI test pass on Harmony's DRLVM + class library. [33].<br />
• Apache Tomcat : 100% of the RI tests pass [34].<br />
• JUnit : 100% of the RI tests pass [35].<br />
• Apache Ant : 97% of the RI tests pass. [36].<br />
• other applications pass with a high success rate, such as Apache Derby, Apache Axis, Log4j, Apache Velocity,<br />
Apache Cocoon, jEdit, and Apache Commons.<br />
However, Harmony's incomplete library prevents it from launching some other applications:<br />
• ArgoUML: because it requires a Java applet implementation, which is still not available in Harmony.<br />
• Apache Geronimo runs on Apache Harmony with some issues and workarounds [37] .<br />
• Vuze, formerly Azureus, because of unimplemented security classes.<br />
See also<br />
• GNU Classpath<br />
• List of Java virtual machines<br />
• Free Java implementations<br />
• Java Class Library<br />
External links<br />
• Official website [38]<br />
• Apache Harmony FAQ [39]<br />
• Apache Harmony source code repository [40]<br />
• JavaOne 2006 Online Harmony Session [41]<br />
• JavaOne 2007 Online Harmony Session [42]<br />
• Apache Harmony [43] by Geir Magnusson Jr at JavaPolis 2006<br />
• The Java open source debate [44] - a good summary of the debate<br />
References<br />
[1] Mark Wielaard (2006-05-24). "Toward a free Java" (http:/ / lwn. net/ Articles/ 184967/ ). LWN.net. .<br />
[2] "GNU Classpath License" (http:/ / www. gnu. org/ software/ classpath/ license. html). .<br />
[3] Dalibor Topic (2006-06-01). "Harmony, JavaONE 2007 and other thoughts" (http:/ / developer. classpath. org/ pipermail/ classpath/<br />
2006-June/ 000965. html). .<br />
[4] Open Letter to Sun Microsystems (http:/ / www. apache. org/ jcp/ sunopenletter. html)<br />
[5] According to ASF, 1) a specification lead cannot impose any contractual condition or covenant that would limit or restrict the right of any<br />
licensee to create or distribute such Independent Implementations (section 5.C.III), and 2) a specification lead must license all necessary IP<br />
royalty-free to any compatible implementation of a specification (section 5.B).<br />
[6] http:/ / blogs. sun. com/ ontherecord/<br />
[7] http:/ / java. sys-con. com/ read/ 360602. htm<br />
[8] http:/ / ianskerrett. wordpress. com/ 2007/ 04/ 16/ the-silence-from-an-open-sun/<br />
[9] http:/ / gnu. wildebeest. org/ diary/ 2007/ 04/ 21/ openjck/
Apache Harmony 29<br />
[10] Gilbert, Dave (2007-04-16). "Five Reasons Why Apache Will Regret That Open Letter" (http:/ / jroller. com/ page/<br />
dgilbert?entry=five_reasons_why_apache_will). . Retrieved 2008-03-08.<br />
[11] "OPENJDK COMMUNITY TCK LICENSE AGREEMENT V 1.1" (http:/ / openjdk. java. net/ legal/ openjdk-tck-license. pdf) (PDF). Sun<br />
Microsystems. . Retrieved 2008-03-08. "Subject to and conditioned upon its Licensee Implementation being substantially derived from<br />
OpenJDK Code and, if such Implementation has or is to be distributed to a third party, its being distributed under the GPL License, Sun<br />
hereby grants to Licensee, to the extent of Sun's Intellectual Property Rights in the TCK, a worldwide, personal, non-exclusive,<br />
non-transferable, limited license to use the TCK internally and solely for the purpose of developing and testing Licensee Implementation."<br />
[12] "Google's Android SDK Bypasses Java ME in Favor of Java Lite and Apache Harmon" (http:/ / www. infoq. com/ news/ 2007/ 11/<br />
android-java). infoq.com. 2007-11-12. . Retrieved 2009-05-31. "Instead of providing a full version of the Java SE or Java ME Google has<br />
diverged on two fronts. First, a limited subset of the core Java packages is provided. (...) By going this route Android is following in the<br />
footsteps of another Google project GWT which uses Java as its development language but does not support the full JDK."<br />
[13] "Package Index" (http:/ / developer. android. com/ reference/ packages. html). Open Handset Alliance. . Retrieved 2009-05-31.<br />
[14] Leo Simons (2006-07-24). ""We would like all the development to happen right here"" (http:/ / article. gmane. org/ gmane. comp. java.<br />
harmony. devel/ 10742). .<br />
[15] "The Apache Way" (http:/ / incubator. apache. org/ learn/ theapacheway. html). .<br />
[16] "List of Apache Harmony Committers" (http:/ / incubator. apache. org/ harmony/ contributors. html). .<br />
[17] Apache Harmony supported platforms and operating systems (http:/ / harmony. apache. org/ supported_platforms. html)<br />
[18] that a class is implemented does not imply that this class behaves as requested in the RI but the empty declaration is not an implemented<br />
method - some core functionality must be present. GNU Classpath uses special class of exception to mark stubs and do not count them as<br />
implemented methods<br />
[19] http:/ / wiki. apache. org/ harmony/ Unit_Tests_Pass_on_DRLVM<br />
[20] http:/ / www. object-refinery. com/ classpath/ mauve/ report/<br />
[21] Apache Harmony Library Coverage against Java SE 5.0 (http:/ / people. apache. org/ ~chunrong/ latest-harmony-japi. html)<br />
[22] http:/ / cvs. savannah. gnu. org/ viewcvs/ *checkout*/ classpath/ org/ omg/ CORBA/ ORB. java?rev=1. 2. 2. 12& root=classpath<br />
[23] http:/ / cvs. savannah. gnu. org/ viewcvs/ *checkout*/ classpath/ gnu/ CORBA/ OrbFunctional. java?rev=1. 6& root=classpath<br />
[24] http:/ / incubator. apache. org/ yoko/<br />
[25] http:/ / www. mail-archive. com/ yoko-dev@incubator. apache. org/ msg01428. html<br />
[26] http:/ / svn. apache. org/ repos/ asf/ incubator/ yoko/ trunk/ yoko-spec-corba/ src/ main/ java/ org/ omg/ CORBA/ ORB. java<br />
[27] http:/ / svn. apache. org/ repos/ asf/ incubator/ yoko/ trunk/ core/ src/ main/ java/ org/ apache/ yoko/ orb/ OBCORBA/ ORB_impl. java<br />
[28] http:/ / incubator. apache. org/ harmony/ roadmap. html#General<br />
[29] BEA JRockit VM under a binary, evaluation-only license (http:/ / mail-archives. apache. org/ mod_mbox/ harmony-dev/ 200701. mbox/<br />
)<br />
[30] Announcing Jikes RVM 3.0 + Apache Harmony (http:/ / mail-archives. apache. org/ mod_mbox/ harmony-dev/ 200808. mbox/<br />
)<br />
[31] Ja.NET SE an open source project is providing a Java 5 JDK running on the .NET CLR (http:/ / www. janetdev. org/ )<br />
[32] http:/ / wiki. apache. org/ harmony/ Application_Status<br />
[33] http:/ / wiki. apache. org/ harmony/ Eclipse_Unit_Tests_Pass_on_DRLVM#PassRate_2007<br />
[34] http:/ / wiki. apache. org/ harmony/ Apache_Tomcat<br />
[35] http:/ / wiki. apache. org/ harmony/ JUnit<br />
[36] http:/ / wiki. apache. org/ harmony/ Apache_Ant<br />
[37] Running Geronimo on Harmony (http:/ / cwiki. apache. org/ confluence/ display/ GMOxDOC20/ Apache+ Harmony)<br />
[38] http:/ / harmony. apache. org/<br />
[39] http:/ / mail-archives. apache. org/ mod_mbox/ incubator-general/ 200505. mbox/<br />
%3CE3603144-2C26-4C31-896D-6CC7445A63EB@apache. org%3E<br />
[40] http:/ / svn. apache. org/ viewcvs. cgi/ incubator/ harmony/ enhanced/ classlib/ trunk/ modules/<br />
[41] http:/ / developers. sun. com/ learning/ javaoneonline/ 2006/ coreplatform/ TS-3752. html<br />
[42] http:/ / developers. sun. com/ learning/ javaoneonline/ j1sessn. jsp?sessn=TS-7820& yr=2007& track=6<br />
[43] http:/ / parleys. com/ display/ PARLEYS/ Apache+ Harmony?showComments=true<br />
[44] http:/ / www. osnews. com/ story. php?news_id=10806
Apache Muse 30<br />
Apache Muse<br />
The Apache Muse Project is a Java-based implementation of the Web Services Resource Framework (WSRF),<br />
WS-BaseNotification (WSN), and Web Services Distributed Management (WSDM) specifications.<br />
See also<br />
• Service-oriented architecture (SOA)<br />
• Apache Tomcat (Servlet Container)<br />
• SOAP (Simple Object Access Protocol)<br />
• WSDL (Web Service Description Language)<br />
External links<br />
• Homepage of Apache Muse [1]<br />
• Homepage of the Web Services Project @ Apache [2]<br />
• Homepage of Apache Axis [3]<br />
• Homepage of Apache Axis2 [4]<br />
• SAAJ from Sun [5]<br />
• Lomboz-Plugin for Eclipse [6]<br />
References<br />
[1] http:/ / ws. apache. org/ muse/<br />
[2] http:/ / ws. apache. org/<br />
[3] http:/ / ws. apache. org/ axis<br />
[4] http:/ / ws. apache. org/ axis2/<br />
[5] http:/ / java. sun. com/ webservices/ saaj/ index. jsp<br />
[6] http:/ / lomboz. objectweb. org/
Apache Shiro 31<br />
Apache Shiro<br />
Developer(s) Apache Software Foundation<br />
Stable release incubation / March 4, 2009<br />
Written in Java<br />
Operating<br />
system<br />
Cross-platform<br />
Type java security framework<br />
License Apache License 2.0<br />
Website [1]<br />
Apache Shiro (formerly known as jSecurity and Apache KI) is a java security framework designed to have a clean<br />
object model, and easy to plugin. Apache Ki has been renamed to Apache Shiro . [2]<br />
Overview<br />
Shiro is designed to be easier to use than JAAS and to be accessible to non-java applications. Shiro supports Role<br />
and User permissions, and has bindings for web applications (JSecurityFilter). The permissions can be stored on a<br />
LDAP or on a database (via JDBC). It also integrates with Spring framework<br />
Example<br />
//Permissions can be checked using object-based permissions<br />
PrinterPermission perm = new PrinterPermission("hplaserjet");<br />
if(perm.isPermitted()) {<br />
//show print button<br />
} else {<br />
}<br />
See also<br />
//grey out button<br />
• Java Authentication and Authorization Service (JAAS)<br />
• Enterprise_JavaBean#Security EJB Container-Managed Security<br />
• JGuard [3] , an LGPL-licensed security framework<br />
• Spring Security, an Apache-licensed Java security framework<br />
External links<br />
• Apache Shiro homepage [1]<br />
• Apache Shiro Presentation [4]<br />
• JSecurity Tutorial by Bruce Philips [5]
Apache Shiro 32<br />
References<br />
[1] http:/ / incubator. apache. org/ shiro/<br />
[2] "Ki to Shiro renaming vote" (http:/ / n2. nabble. com/ Apache-JSecurity-Ki-Project-Rename---VOTE-RESULT-td3057020. html#a3057020).<br />
.<br />
[3] http:/ / jguard. xwiki. com/ xwiki/ bin/ view/ Main/ WebHome<br />
[4] http:/ / www. jsecurity. org/ files/ JSecurity. pdf<br />
[5] http:/ / www. brucephillips. name/ blog/ index. cfm/ 2009/ 4/ 5/ An-Introduction-to-Ki-formerly-JSecurity--A-Beginners--Tutorial-Part-1<br />
Java applet<br />
A Java applet is an applet delivered to the users in the form of Java<br />
bytecode. Java applets can run in a Web browser using a Java Virtual<br />
Machine (JVM), or in Sun's Applet<strong>View</strong>er, a stand-alone tool for<br />
testing applets. Java applets were introduced in the first version of the<br />
Java language in 1995. Java applets are usually written in the Java<br />
programming language but they can also be written in other languages<br />
that compile to Java bytecode such as Jython, [7] Ruby, [8] or Eiffel. [9]<br />
Applets are used to provide interactive features to web applications<br />
that cannot be provided by HTML alone. They can capture mouse<br />
input (like rotating 3D object) and also have controls like buttons or<br />
check boxes. In response to the user action an applet can change the<br />
provided graphic content. This makes applets well suitable for<br />
demonstration, visualization and teaching. There are online applet<br />
collections for studying various subjects, from physics [10] to heart<br />
physiology. [3] Applets are also used to create online game collections<br />
that allow players to compete against live opponents in real-time.<br />
An applet can also be a text area only, providing, for instance, a cross<br />
platform command-line interface to some remote system. [11] If needed,<br />
an applet can leave the dedicated area and run as a separate window.<br />
However, applets have very little control over web page content<br />
outside the applet dedicated area, so they are less useful for improving<br />
the site appearance in general (while applets like news tickers [12] or<br />
WYSIWYG editors [13] are also known). Applets can also play media in<br />
formats that are not natively supported by the browser [14]<br />
Java applets run at a speed that is comparable to (but generally slower<br />
than) other compiled languages such as C++, but many times faster<br />
than JavaScript. [15] In addition they can use 3D hardware acceleration<br />
that is available from Java. This makes applets well suited for non<br />
trivial, computation intensive visualizations.<br />
HTML pages may embed parameters that are passed to the applet.<br />
Hence the same applet may appear differently depending on the<br />
parameters that were passed. The first implementations involved<br />
downloading an applet class by class. While classes are small files,<br />
Java applet that was created as a supplementary<br />
demonstration material of the scientific<br />
publication. [1] and is available from the<br />
university site<br />
Java applet that uses 3D hardware acceleration,<br />
downloading from the server 3D files in .pdb<br />
format to visualize [2]
Java applet 33<br />
there are frequently a lot of them, so applets got a reputation as slow<br />
loading components. However, since jars were introduced, an applet is<br />
usually delivered as a single file that has a size of the bigger image<br />
(hundreds of kilobytes to several megabytes).<br />
Since Java's bytecode is platform independent, Java applets can be<br />
executed by browsers for many platforms, including Microsoft<br />
Windows, Unix, Mac OS and Linux. It is also trivial to run a Java<br />
applet as an application with very little extra code. This has the<br />
advantage of running a Java applet in offline mode without the need<br />
for any Internet browser software and also directly from the<br />
development IDE.<br />
Many Java developers, blogs and magazines are recommending that<br />
[16] [17]<br />
the Java Web Start technology be used in place of Applets.<br />
A Java Servlet is sometimes informally compared to be "like" a<br />
server-side applet, but it is different in its language, functions, and in<br />
each of the characteristics described here about applets.<br />
Technical information<br />
Java applets are executed in a sandbox by most web browsers,<br />
preventing them from accessing local data like clipboard or file system.<br />
The code of the applet is downloaded from a web server and the<br />
browser either embeds the applet into a web page or opens a new<br />
window showing the applet's user interface.<br />
A Java applet extends the class java.applet.Applet, or in the case of a<br />
Swing applet, javax.swing.JApplet. The class must override methods<br />
from the applet class to set up a user interface inside itself (Applet is a<br />
descendant of Panel which is a descendant of Container. As applet<br />
inherits from container, it has largely the same user interface<br />
possibilities as an ordinary Java application, including regions with<br />
user specific visualization.<br />
The domain from where the applet executable has been downloaded is<br />
the only domain to which the usual (unsigned) applet is allowed to<br />
communicate. This domain can be different from the domain where the<br />
surrounding HTML document is hosted.<br />
Using applet for non trivial<br />
animation illustrating<br />
biophysical topic (randomly<br />
moving ions pass through<br />
voltage gates) [3]<br />
Using Java applet for computation - intensive<br />
visualization of the Mandelbrot set [4]<br />
Java system libraries and runtimes are backwards compatible, allowing to write code that runs both on current and on<br />
future versions of the Java virtual machine.<br />
Embedding into web page<br />
The applet can be displayed on the web page by making use of the deprecated applet HTML element, [18] or the<br />
recommended object
Java applet 34<br />
element. [19] A non standard embed element can be used [20] with<br />
Mozilla family browsers. This specifies the applet's source and<br />
location. Object and embed tags can also download and install Java<br />
virtual machine (if required) or at least lead to the plugin page. Applet<br />
and object tags also support loading of the serialized applets that start<br />
in some particular (rather than initial) state. Tags also specify the<br />
message that shows up in place of the applet if the browser cannot run<br />
it due any reason.<br />
However, despite object being officially a recommended tag, as of<br />
2010, the support of the object tag was not yet consistent among<br />
browsers and Sun kept recommending the older applet tag for<br />
deploying in multibrowser environments, [20] as it remained the only<br />
tag consistently supported by the most popular browsers. To support<br />
multiple browsers, the object tag currently requires JavaScript (that<br />
recognizes the browser and adjusts the tag), usage of additional<br />
browser-specific tags or delivering adapted output from the server side.<br />
Deprecating applet tag has been criticised. [21] Oracle now provides a<br />
maintained JavaScript code [22] to launch applets with cross platform<br />
workarounds.<br />
Simple examples<br />
A basic example using the java.applet package<br />
The following example is made simple enough to illustrate the<br />
essential use of Java applets through its java.applet package. It also<br />
uses classes from the Java Abstract Window Toolkit (AWT) for<br />
producing actual output (in this case, the "Hello, world!" message).<br />
import java.applet.Applet;<br />
import java.awt.*;<br />
// Applet code for the "Hello, world!" example.<br />
// This should be saved in a file named as "HelloWorld.java".<br />
public class HelloWorld extends Applet {<br />
Sufficient running speed is also utilized in applets<br />
for playing non trivial computer games like<br />
chess [5]<br />
NASA World Wind (open source) is a second<br />
generation applet [6] that makes heavy use of<br />
OpenGL and on-demand data downloading to<br />
provide a detailed 3D map of the world.<br />
// This method is mandatory, but can be empty (i.e., have no actual<br />
Web access to the server console at the hardware<br />
code).<br />
level with the help of a Java applet<br />
public void init() { }<br />
// This method is mandatory, but can be empty.<br />
public void stop() { }<br />
// Print a message on the screen (x=20, y=10).<br />
public void paint(Graphics g) {
Java applet 35<br />
}<br />
}<br />
g.drawString("Hello, world!", 20,10);<br />
More simple applets are available at Wikiversity [23] .<br />
For compilation, this code is saved on a plain-ASCII file with the same name as the class and .java extension, i.e.<br />
HelloWorld.java. The resulting HelloWorld.class applet should be installed on the web server and is<br />
invoked within an HTML page by using an or an tag. For example:<br />
<br />
<br />
<br />
HelloWorld_example.html<br />
<br />
<br />
A Java applet example<br />
Here it is: <br />
This is where HelloWorld.class runs.<br />
<br />
<br />
Displaying the HelloWorld_example.html page from a Web server, the result should look as this:<br />
A Java applet example<br />
Here it is: Hello, world!<br />
To minimize download time, applets are usually delivered in a form of compressed zip archive (having jar<br />
extension). If all needed classes (only one in our case) are placed in compressed archive example.jar, the embedding<br />
code would look differently:<br />
Here it is: <br />
This is where HelloWorld.class runs.<br />
Applet inclusion is described in detail in Sun's official page about the APPLET tag. [24]<br />
Advantages<br />
A Java applet can have any or all of the following advantages:<br />
• It is simple to make it work on Linux, Microsoft Windows and Mac OS X i.e. to make it cross platform. Applets<br />
are supported by most web browsers.<br />
• The same applet can work on "all" installed versions of Java at the same time, rather than just the latest plug-in<br />
version only. However, if an applet requires a later version of the Java Runtime Environment (JRE) the client will<br />
be forced to wait during the large download.<br />
• Most web browsers cache applets, so will be quick to load when returning to a web page. Applets also improve<br />
with use: after a first applet is run, the JVM is already running and starts quickly (the JVM will need to restart<br />
each time the browser starts afresh).<br />
• It can move the work from the server to the client, making a web solution more scalable with the number of<br />
users/clients.
Java applet 36<br />
• If a standalone program (like Google Earth) talks to a web server, that server normally needs to support all<br />
previous versions in case a user has not kept his or her client software up to date. In contrast, a properly<br />
configured browser loads (and caches) the latest applet version, so there is no need to support legacy versions.<br />
• The applet naturally supports the changing user state, such as figure positions on the chessboard.<br />
• Developers can develop and debug an applet direct simply by creating a main routine (either in the applet's class<br />
or in a separate class) and calling init() and start() on the applet, thus allowing for development in their favorite<br />
Java SE development environment. All one has to do after that is re-test the applet in the Applet<strong>View</strong>er program<br />
or a web browser to ensure it conforms to security restrictions.<br />
• An untrusted applet has no access to the local machine and can only access the server it came from. This makes<br />
such an applet much safer to run than a standalone executable that it could replace. However, a signed applet can<br />
have full access to the machine it is running on if the user agrees.<br />
• Java applets are fast - and can even have similar performance to native installed software.<br />
Disadvantages<br />
A Java applet may have any of the following disadvantages:<br />
• It requires the Java plug-in.<br />
• Some organizations only allow software installed by the administrators. As a result, some users can only view<br />
applets that are important enough to justify contacting the administrator to request installation of the Java plug-in.<br />
• As with any client-side scripting, security restrictions may make it difficult or even impossible for an untrusted<br />
applet to achieve the desired goals.<br />
• Some applets require a specific JRE. This is discouraged. [25]<br />
• If an applet requires a newer JRE than available on the system, or a specific JRE, the user running it the first time<br />
will need to wait for the large JRE download to complete.<br />
• Java automatic installation or update may fail if a proxy server is used to access the web. This makes applets with<br />
specific requirements impossible to run unless Java is manually updated. The Java automatic updater that is part<br />
of a Java installation also may be complex to configure if it must work through a proxy.<br />
• Unlike the older applet tag, the object tag needs workarounds to write a cross-browser HTML document.<br />
Compatibility related lawsuits<br />
Sun has made a considerable effort to ensure compatibility is maintained between Java versions as they evolve,<br />
enforcing Java portability by law if required. Oracle seems to be continuing the same strategy.<br />
The 1997 Sun - Microsoft lawsuit<br />
The 1997 lawsuit [26] was filed after Microsoft modified its own Java Virtual Machine which shipped with Internet<br />
Explorer. Microsoft added about 50 methods and 50 fields [26] into the classes within the java.awt, java.lang, and<br />
java.io packages. Other modifications included removal of RMI capability and replacement of Java native interface<br />
from JNI to RNI, a different standard. RMI was removed because it only easily supports Java to Java<br />
communications and competes with Microsoft DCOM technology. Applets that relied on these changes or just<br />
inadvertently used them worked only within Microsoft's Java system. Sun sued for breach of trademark, as the point<br />
of Java was that there should be no proprietary extensions and that code should work everywhere. Microsoft agreed<br />
to pay Sun $20 million, and Sun agreed to grant Microsoft limited license to use Java without modifications only and<br />
for a limited time. [27]
Java applet 37<br />
The 2002 Sun - Microsoft lawsuit<br />
Microsoft continued to ship its own unmodified Java virtual machine. Over years it has become extremely outdated<br />
yet still default for Internet Explorer. In 2002 Sun filed an antitrust lawsuit, claiming that Microsoft's attempts at<br />
illegal monopolization have harmed the Java platform. Sun demanded Microsoft distribute Sun's current, binary<br />
implementation of Java technology as part of Windows, distribute it as a recommended update for older Microsoft<br />
desktop operating systems and stop the distribution of Microsoft's Virtual Machine (as its licensing time, agreed in<br />
the previous lawsuit, had expired). [27] Microsoft paid $700 million for pending antitrust issues, another $900 million<br />
[28] [29]<br />
for patent issues and a $350 million royalty fee to use Sun's software in the future.<br />
The 2010 Oracle - Google lawsuit<br />
Google has developed their own Android platform that uses Java features and concepts yet is not compatible with<br />
standard libraries. This has been a violation of conditions under that Sun granted OpenJDK patents to use open<br />
source Java for all [30] . 2010 Oracle sued Google [31] for using Java "in a wrong way", claiming that "Google’s<br />
Android competes with Oracle America’s Java" and that "Google has been aware of Sun’s patent portfolio .. since<br />
Google hired certain former Sun Java engineers". Oracle currently seems claiming as much as to stop the further<br />
Android development, trying to replace it by standard Java version [32] . This lawsuit is currently ongoing.<br />
Applet security<br />
There are two applet types with very different security models: signed applets and unsigned applets. [33]<br />
Unsigned applet<br />
Limitations for the unsigned applets are understood as "draconian": [34] they have no access to the local filesystem<br />
and web access limited to the applet download site; there are also many other important restrictions. For instance,<br />
they cannot access system properties, use their own class loader, call native code, execute external commands on a<br />
local system or redefine classes belonging to certain packages. While they can run in a standalone frame, such frame<br />
contains a header, indicating that this is an untrusted applet. Successful initial call of the forbidden method does not<br />
automatically create a security hole as an access controller checks the entire stack of the calling code to be sure the<br />
call is not coming from an improper location. Several specific security problems have been discovered and fixed<br />
since Java was first released, and some, like the Calendar serialization security bug [35] , even persisted as late as<br />
2008 without anybody being aware. Some studies mention applets crashing the browser or overusing CPU resources<br />
but these are classified as nuisances [36] and not as true security flaws. However, unsigned applets may be involved in<br />
combined attacks that exploit a combination of multiple severe configuration errors in other parts of the system. [37]<br />
An unsigned applet can also be more dangerous to run directly on the server where it is hosted because while code<br />
base allows it to talk with the server, running inside it can bypass the firewall. An applet may also try DOS attack on<br />
the server where it is hosted but usually people who manage the web site also manage the applet, making this<br />
unreasonable. Communities may solve this problem via source code review or running applets on a dedicated<br />
domain. [38] [39] .<br />
[36] [40]<br />
As of 1999 no real security breaches involving unsigned applets have ever been publicly reported.<br />
Signed applet<br />
A signed applet [41] contains a signature that the browser should verify through a remotely running, independent<br />
certificate authority server. Producing this signature involves specialized tools and interaction with the authority<br />
server maintainers. Once the signature is verified, and the user of the current machine also approves, a signed applet<br />
can get more rights, becoming equivalent to an ordinary standalone program. The rationale is that the author of the<br />
applet is now known and will be responsible for any deliberate damage. This approach allows applets to be used for
Java applet 38<br />
many tasks that are otherwise not possible by client-side scripting. However, this approach requires more<br />
responsibility from the user, deciding whom he or she trusts. The related concerns include a non-responsive authority<br />
server, wrong evaluation of the signer identity when issuing certificates, and known applet publishers still doing<br />
something that the user would not approve of. Hence signed applets that appeared from Java 1.1 may actually have<br />
more security concerns [42] .<br />
Java security problems are not fundamentally different from similar problems of any client-side scripting platform.<br />
In particular, all issues related to signed applets also apply to Microsoft ActiveX components.<br />
Alternatives<br />
Alternative technologies exist (for example, JavaScript, Curl, Flash, and Microsoft Silverlight) that satisfy some of<br />
the scope of what is possible with an applet. Of these, JavaScript is not always viewed as a competing replacement;<br />
JavaScript can coexist with applets in the same page, assist in launching applets (for instance, in a separate frame or<br />
providing platform workarounds) and later be called from the applet code. [43]<br />
See also<br />
• ActiveX control<br />
• Curl<br />
• Java programming language<br />
• Java Servlet<br />
• Java Web Start<br />
• JavaFX<br />
External links<br />
• Latest version of Sun Microsystems Java Virtual Machine [44] (includes browser plug-ins for running Java applets<br />
in most web browsers).<br />
• Information about writing applets from Sun Microsystems [45]<br />
• Demonstration applets from Sun Microsystems [46] (JDK 1.4 - include source code)<br />
• JavaRanch Applet FAQ [47]<br />
• Pulpcore: Open-source 2D rendering and animation framework for the Java plug-in [48]<br />
References<br />
[1] World of Fungi (http:/ / www. world-of-fungi. org/ Models/ tropisms/ java_a. htm) - page of the scientific project, serving an applet that is<br />
used as an illustration figure<br />
[2] The home site of the 3D protein viewer (Openastexviewer) under LGPL (http:/ / openastexviewer. net/ web/ )<br />
[3] The virtual hearth (http:/ / thevirtualheart. org/ CAPindex. html)<br />
[4] The home site of the Mandelbrot set applet under GPL (http:/ / www. its. caltech. edu/ ~dannyc/ fractals/ simple. html)<br />
[5] The home site of the chess applet under BSD (http:/ / english. op. org/ ~peter/ ChessApp/ )<br />
[6] Java.Sun.com (http:/ / java. sun. com/ developer/ technicalArticles/ javase/ newapplets/ )<br />
[7] Jython applet page (http:/ / www. jython. org/ archive/ 21/ applets/ index. html)<br />
[8] About Java applets in Ruby (http:/ / michal. hantl. cz/ ruby-in-browser-jruby-inside-an-applet/ )<br />
[9] At tool to produce Java applets with SmartEiffel (http:/ / eiffelzone. com/ esd/ wrapj/ index. html)<br />
[10] Paul Falstad online applet portal (http:/ / www. falstad. com/ mathphysics. html)<br />
[11] Jraft.com (http:/ / www. jcraft. com/ jcterm/ )<br />
[12] ObjectPlanet.com (http:/ / www. objectplanet. com/ newsticker/ ), an applet that works as news ticker<br />
[13] Sferyx.com (http:/ / www. sferyx. com/ ), a company that produces applets acting as WYSWYG editor.<br />
[14] Cortado applet to play ogg format<br />
[15] An example of the 2005 year performance benchmarking (http:/ / www. timestretch. com/ FractalBenchmark. html)<br />
[16] JavaWorld.com (http:/ / www. javaworld. com/ javaworld/ jw-07-2001/ jw-0706-webstart. html)<br />
[17] JavaChannel.net (http:/ / javachannel. net/ wiki/ pmwiki. php/ FAQ/ Applets)
Java applet 39<br />
[18] W3.org (http:/ / www. w3. org/ TR/ html401/ struct/ objects. html#edef-APPLET)<br />
[19] W3.org (http:/ / www. w3. org/ TR/ html401/ struct/ objects. html#edef-OBJECT)<br />
[20] Sun's position on applet and object tags (http:/ / download. java. net/ jdk7/ docs/ technotes/ guides/ plugin/ developer_guide/ using_tags.<br />
html#object)<br />
[21] Criticism (http:/ / mindprod. com/ jgloss/ applet. html#OBJECT) of APPLET tag deprecation<br />
[22] Java applet launcher from Oracle (http:/ / www. java. com/ js/ deployJava. txt)<br />
[23] Java applet section in Wikiversity (http:/ / en. wikiversity. org/ wiki/ Java_applets)<br />
[24] Java.Sun.com (http:/ / java. sun. com/ j2se/ 1. 4. 2/ docs/ guide/ misc/ applet. html) Sun's APPLET tag page<br />
[25] Oracle notes on Java versioning (http:/ / java. sun. com/ javase/ 6/ webnotes/ family-clsid. html)<br />
[26] 1997 year Sun-Microsoft lawsuit in JavaWorld (http:/ / www. javaworld. com/ jw-10-1997/ jw-10-lawsuit. html)<br />
[27] Sun's page, devoted for the lawsuits against Microsoft (http:/ / www. sun. com/ lawsuit/ summary. html)<br />
[28] Sun - Microsoft 2002 lawsuit (http:/ / my. advisor. com/ doc/ 13947)<br />
[29] Microsoft page devoted to the Sun - Microsoft 2002 lawsuit (http:/ / www. microsoft. com/ presspass/ press/ 2004/ apr04/<br />
04-02SunAgreementPR. mspx)<br />
[30] (http:/ / tirania. org/ blog/ archive/ 2010/ Aug-13. html)<br />
[31] Oracle sues Google over Android (http:/ / mobile. venturebeat. com/ 2010/ 08/ 12/ oracle-sues-google-over-android/ )<br />
[32] Discussions on Oracle plans (http:/ / mashable. com/ 2010/ 08/ 12/ oracle-google-android-lawsuit/ ) in mashable.com<br />
[33] Sun's explanation about applet security (http:/ / java. sun. com/ docs/ books/ tutorial/ deployment/ applet/ security. html)<br />
[34] Java Security FAQ Applet Security Restrictions (http:/ / www. wutka. com/ hackingjava/ ch3. htm) by Mark Wutka<br />
[35] Description of Calendar serialization security bug (http:/ / slightlyrandombrokenthoughts. blogspot. com/ 2008/ 12/ calendar-bug. html)<br />
[36] Java Security FAQ (http:/ / www. cs. princeton. edu/ sip/ faq/ java-faq. php3)<br />
[37] Avirubin.com (http:/ / avirubin. com/ block. java. pdf)<br />
[38] Strategy.Wikimedia.org (http:/ / strategy. wikimedia. org/ wiki/ Proposal:Java_applet_support), proposal with discussion about Java applets<br />
in community sites<br />
[39] Ultrastudio.org (http:/ / Ultrastudio. org), user editable educational site with full applet support<br />
[40] ~ G.McGraw, E.W. Felten. Securing Java. ISBN 047131952X (http:/ / www. securingjava. com/ chapter-four/ )<br />
[41] Informit.com (http:/ / www. informit. com/ articles/ article. aspx?p=433382& seqNum=2)<br />
[42] Sid Stamm, Markus Jakobsson, Mona Gandhi (2006). A study in socially transmitted malware (http:/ / www. indiana. edu/ ~phishing/<br />
verybigad/ )<br />
[43] Rgagnon.com (http:/ / www. rgagnon. com/ javadetails/ java-0170. html), calling a Java applet from JavaScript<br />
[44] http:/ / www. java. com/ download/<br />
[45] http:/ / java. sun. com/ docs/ books/ tutorial/ applet/ index. html<br />
[46] http:/ / java. sun. com/ applets/ jdk/ 1. 4/ index. html<br />
[47] http:/ / faq. javaranch. com/ java/ AppletsFaq<br />
[48] http:/ / www. interactivepulp. com/ pulpcore/
Associació d'Usuaris de Java de Catalunya 40<br />
Associació d'Usuaris de Java de Catalunya<br />
Aujac is the acronym of "Associació d'Usuaris de JAva de Catalunya", non-profit association that intended to<br />
group all users of the Java language created by James Gosling at Sun MicroSystems.<br />
Born<br />
Official logo of Aujac<br />
Aujac (Associació d'Usuaris de Java de Catalunya)<br />
born with the initial proposal to bring near the new<br />
information technologies to the people. An effort made<br />
through one of the most active Java Users Groups in<br />
Europe.<br />
AUJAC starts to forge as an idea during the celebration<br />
of a Java course and after the initial creation of the JUG<br />
of Sabadell by Jordi Pujol Ulied, founder and president of the Aujac, in April of year 2000.<br />
The interest was very high and soon summoned a first meeting for establishing the statutes and the first Board of<br />
Directors.<br />
The meetings occurs often and with an important collective effort that it is it could make patent in the several<br />
encounters that they were made in the current headquarters of the entity, in Sabadell.<br />
The members founding of AUJAC was:<br />
Jordi Pujol Ulied (president)<br />
Xavier Pi i Palomés (underpresident)<br />
Marc Munill i Bernandich (secretary)<br />
Josep Folch i Serra (treasurer)<br />
German Munuera Pubill (vowel)<br />
Mònica Rayo Moragon (vowel)<br />
Albert Soler i Crosas (vowel)<br />
Pere Brugue i Pujol<br />
At the end of year 2000, was constituted and recognized by the Generalitat de Catalunya, and being inscribed in the<br />
"Registre General d'Entitats Juridiques" with number of inscription: 23889 / B<br />
On the other hand the AUJAC was recognized by Sun MicroSystems as official JUG of Catalonia.<br />
And in year 2003 the AUJAC becomes the most important 16é JUG of the world: Top25 JUG Program.<br />
Targets<br />
According to the num article. 2 of its statutes:<br />
The purposes of the association:<br />
1. - To group all the users of the Java programming language in Catalonia as well as other aspects that have<br />
relation with this language.<br />
2. - The association is in itself an organic representation of the JUG (Java Users Group) in Catalonia, started<br />
by the company creative of the language, Sun MicroSystems, in the promotion of users associations ( JUGS<br />
[1] ) indicating that it declares as a non-profit association and therefore there is not commercial connection<br />
with the company and just sustains bonds of users associationism.
Associació d'Usuaris de Java de Catalunya 41<br />
3. - To foster and to promote catalan information society, in all the possible areas. The Catalan was the<br />
expression and work language of the association.<br />
President and board of directors<br />
Along its existence, the Aujac is it composed of several boards of directors.<br />
The members who compose the Board of Directors, as they marked the statutes, were chosen every two years in the<br />
General Assembly of Members, and the former members can be presented to the charge without any harm again.<br />
During the first biennium of existence of the AUJAC (2000-2002) the Board of Directors has been composed by the<br />
following persons:<br />
President: Jordi Pujol Ulied<br />
SotsPresident: Xavier Pi Palomes<br />
Treasurer: Josep Folch i Serra<br />
Secretary: Marc Munill Bernándich<br />
Vowels:<br />
German Munuera Pubill<br />
Ignasi Pérez Valls<br />
Mònica Rayo Morajón<br />
Albert Soler Crosas<br />
In the 2002 elections, the Board of Directors for the period 2002-2004 was:<br />
President: Jordi Pujol Ulied<br />
SotsPresident: Josep Ros Navarro<br />
Treasurer: Josep Folch i Serra<br />
Secretary: Mònica Rodríguez Gili<br />
Vowels:<br />
Mònica Rayo Moragón<br />
David Villegas Terrín<br />
Aleix Torres Casas<br />
In the periode 2004-2006, the board of directors comes off composed in the following way:<br />
President: Jordi Pujol Ulied<br />
SotsPresident: Aleix Torres Casas<br />
Treasurer: Jordi Marques del Aguila<br />
Secretary: Maiol Xercavins i Simó<br />
Vowels:<br />
David Villegas Terrín<br />
Josep Folch Serra<br />
Inma Camacho Arellano
Associació d'Usuaris de Java de Catalunya 42<br />
Main activities<br />
The main activities of the Aujac it is they centered in three main axes: formation, broadcast and collaboration<br />
projects.<br />
Formation<br />
In the program of formation it is intended to:<br />
Facilitate the technology access to all the persons concerned to the Java technologies. Establish a shared plan of<br />
formation in all the Catalan area, which they are governed by the same criterion of evaluation and formation, with a<br />
unitary program of courses.<br />
The plan had a remarkable success, and the Barceloba Football club, "Fundación Once" and the University<br />
Autonòma of Barcelona (UAB) was one of their customers.<br />
The plan of formation also allowed the creation of a Java Master Course at the "Fundació Indústries de la<br />
Informació", entity promoted by Mr. Antoni Farrés ca:Antoni Farrés i Sabater.<br />
Otherwise, it is also they imparted several courses in the EUIS, Escola Universitària d'Informàtica de Sabadell,<br />
ascribed to the UAB.<br />
Diffuse<br />
With respect to the diffusion of the Java technology, Aujac organized the "Sun Tech Day" in Sabadell 2004, and<br />
three editions of the "Jornades Java Catalanes", and became the first non-enterprise group to organize an event of<br />
this kind in Spain, copied afterwards by JavaHispano, which made two editions of a similar event, after having<br />
attended the first as a viewer.<br />
As explained in the definition of the "Jornades Java Catalanes" these were:<br />
The "Jornades Java Catalanes" are an event focused to diffuse the Java technology and other similar<br />
technologies to the Catalan community. It is an event open to everybody, focused to several sectors of the<br />
catalan community: university, enterprise, final users and general public.<br />
The goal of the "Jornades Java Catalanes" is to visit all Catalan universities along the several editions,<br />
located in Catalonia, Valencia, Balearic Islands and the North Catalonia, through the hand of technological<br />
companies in this area.<br />
An annual periodicity is established in the event.<br />
The language of expression and work of "Jornades Java Catalanes" is, by default, the Catalan. Excluding in<br />
those activities in which they have to be made, by non-catalan resident of the persons who develop them, in the<br />
languages of expression of the same ones.<br />
The area of performance and divulging of the "Java conference C0atalanes" they are all those regions of<br />
Catalan speech.<br />
The "Jornades Java Catalanes" base their diffusion area on three predominant areas: enterprise, university<br />
and society.<br />
Aujac was pioneer in the Spanish state, the year 2003, in being the first non-profit organization that achieved to<br />
gather in a same event about Java, the university world, the enterprise sector and the general society, acting as link of<br />
union among them.<br />
This joint position of initiative and leadership between Aujac and all the Catalan universities, makes the present<br />
model have been adopted by other similar entities all over the Spanish state when carrying out similar events<br />
certifying the success of the same ones.
Associació d'Usuaris de Java de Catalunya 43<br />
First "Jornades Java Catalanes"<br />
Cartell oficial de les 1eres Jornades Java<br />
Catalanes<br />
Second "Jornades Java Catalanes"<br />
The first "Jornades Java Catalanes" was celebrated at the ETSE, "Escola<br />
Técnica Superior d'Enginyeria" from the "Universitat Autonòma de<br />
Barcelona", on 25 February 2003.<br />
The sponsors of this event were:<br />
Bea Systems<br />
Sun MicroSystems<br />
and the collaborator companies :<br />
Steria<br />
Cast-Info<br />
Borland<br />
We can find press releases in Vilaweb: [2]<br />
Opening meeting of the III Jornades Java Catalanes. From left to right: Fernando<br />
Suarez (IBM), Josep Figols (Sun MicroSystems), Jordi Pujol Ulied<br />
(AUJAC),Monte Kluemper (BEA),Juan Antoni Pastor (UNICA), ? (IBM),Miquel<br />
Boix Planes (Steria),Alvaro Rocabayera (MSS)<br />
The second "Jornades Java Catalanes" was<br />
celebrated at the Universitat Internacional<br />
de Catalunya, the 15th and 16th of April in<br />
2004.<br />
The sponsors of this event were:<br />
Bea Systems<br />
Caixa Penedès<br />
Cast-Info<br />
Data.ti<br />
IBM<br />
Oracle Corporation<br />
MSS<br />
Sun MicroSystems
Associació d'Usuaris de Java de Catalunya 44<br />
Official logo of the II Jornades Java Catalanes<br />
Third "Jornades Java Catalanes"<br />
Quest Software<br />
They receive support from:<br />
Official Logo of III Jornades Java Catalanes<br />
CBA Computers, S.L.<br />
Filnet<br />
You can see several press notes on a different sources:<br />
The participant companies were::<br />
da.vinci<br />
And the collaborator companies were:<br />
CBA Computers, S.L.<br />
Filnet<br />
They receive support from:<br />
Escola Tècnica Superior d'Enginyeria<br />
of UAB University<br />
ATI<br />
SOFTCATALÀ<br />
PuntBarra<br />
Some press notes can be consulted to<br />
several newspapers like : [3]<br />
The second "Jornades Java Catalanes" was<br />
celebrated at the "Sala de Congressos del<br />
Parc d’Innovació La Salle", located at the<br />
University Campus of the given university,<br />
in 14th and 15th of April in 2005.<br />
The sponsors of this event were:<br />
Bea Systems<br />
Borland<br />
Caixa Penedès<br />
Data.ti<br />
Oracle Corporation<br />
Steria<br />
Sun MicroSystems<br />
The participant companies were::<br />
Ilog<br />
MSS
Associació d'Usuaris de Java de Catalunya 45<br />
- Press note at COEIC: [4]<br />
- Press note at LaFarga.cat [5]<br />
Sun Tech Day in Sabadell<br />
From left to right:Angela Caicedo(Sun Evangelist),Reginald Hutcherson(Boss of<br />
the Java Technology Evangelist Team),Jordi Pujol (President of Aujac)<br />
and a T-shirt, and raffled books and other gifts.<br />
Almost 100 persons attended the act.<br />
Belong of the collaboration among the EUIS<br />
and AUJAC, a Sun Tech Day was organized<br />
by them.<br />
Angela Caicedo, Technology Evangelist of<br />
Sun Microsystems, was the speaker of the<br />
presentation of the Java2 Standard Edition<br />
5.0 (Tiger).<br />
That explained the new features and the<br />
technical aspects of this last version of the<br />
Java platform.<br />
Also it made demonstrations of how to<br />
develop applications helping for us of the<br />
new possibilities.<br />
The session took place on the 20th of<br />
December 2004 from 17.30 to 20.00 hours.<br />
The assistants received original CDs of Sun<br />
During the act, AUJAC gives a commemorative diploma of gratitude to Mr. Reginald Hutcherson (boss of the Java<br />
Technology Evangelist).<br />
You can you find references of this event in the web page of the EUIS: [6]<br />
Collaboration projects<br />
The Aujac promotes several collaboration projects with entities from all over the territory. Basicament spread on two<br />
main axes: those activities that offered a series of services to the community, and of another the impulse of the<br />
technology in educational areas.<br />
It is necessary to highlight that in the area of the teaching, the Aujac signs with the UAB University, several<br />
agreements of collaboration among those that highlight the teaching courses as well as the direction of career<br />
projects under the direction of Jordi Pujol Ulied, president of Aujac.<br />
It is necessary to highlight that was signed two final university projects:<br />
• "LABOR": Employment Exchange, by Anna Torres Ribas, that received the qualification of: 10 over 10.<br />
• "hosting.aujac.org", by Aleix Torres Casas, that received the qualification of: 9.75 over 10, with Honour mark.
Associació d'Usuaris de Java de Catalunya 46<br />
Honour members<br />
Aujac gives every April, the Honour Member to a personality or Catalan entity.<br />
With this distinction they want to recognize those personalities or entities that with their disposition, implication,<br />
dedication and effort, have contributed to the growth and development of the technology society in our country.<br />
2001 Honour Member<br />
In 2001, Mr. [7] was elected as Honour Member of Aujac.<br />
Political icon of the democratic movement in the seventies in Sabadell, was the first democratic mayor of the quoted<br />
population, and one of the big social instigators of the post Franco's regime.<br />
Instigator on the other hand, of projects of the technology society, like the creation of the "Fundació Indústries de la<br />
Informació", with headquarters in Sabadell, or instigator of the projects of electronic administrations in Catalonia.<br />
It is necessary to highlight that the open speech of the Aujac social presentation was offered by him in the<br />
headquarters of the ancient F2I, "Fundació Indústries de la Informació", in Sabadell, that today is the Chamber of<br />
Commerce of Sabadell.<br />
2002 Honour Member<br />
Joan Daví i Ferrer, became Member of Honor Aujac the year 2002.<br />
Joan Daví i Ferrer, from Terrassa, director of projects in "Caixa Terrassa", led in the bank world an opening towards<br />
the non-proprietary systems that it led to conceiving unedited bank architectures until then it, and who broke<br />
outlines, and especially with the traditional systems established in the financial environments.<br />
Nowadays, its designs in computer architectures devoted to the bank services are a referent.<br />
For all of this reasons, Aujac considered to distinguish it with the Honour member.<br />
2003 Honour Member<br />
Dr. Jordi Roig de Zarate receiving the 2003 Honour Member<br />
Dr. Jordi Roig de Zarate was called "Honour Member" in year 2003.<br />
2004 Honour Member<br />
Dr. Jordi Roig de Zarate, professor of the IT<br />
Department of the UAB University. It was<br />
Director of the EUIS in Sabadell, during<br />
period 2000-2002.<br />
Constant fighter towards the own difficulties<br />
has always known how to win the battle of<br />
the adversities, demonstrating that many<br />
times, there are not barriers that can be<br />
through with effort, dedication and<br />
constancy.<br />
Their spirit of improvement, together with<br />
its professional profile, they act as him a<br />
person who has known how to transmit its<br />
pupils the illusion about the new<br />
technologies.<br />
Him for this qualities and many others, that
Associació d'Usuaris de Java de Catalunya 47<br />
Mr. Eduard Elias (right) receiving the 2004 Honour Member<br />
The Mr. Eduard Elias (right), dean of the<br />
"Col.legi Official d'Enginyeria en<br />
Informàtica de Catalunya", was elected<br />
"2004 Honour Member". Promoter and<br />
instigator of the Catalan Association of<br />
Engineers in Computer Science (ACEI), he<br />
was some of the craftsmen of the creation of<br />
the Official School of Engineering in<br />
Computer Science of Catalonia.<br />
This Honour Member recognizes years of<br />
dedication of the technology association and<br />
the effort to attain a regularization of the<br />
profession.<br />
His forces and dedication has allowed the<br />
creation of the "Col.legi Official<br />
d'Enginyeria en Informàtica de Catalunya ".<br />
Arrange of this, Aujac want to give him this honour member, in 16 of April 2004, in the UNICA University.<br />
2005 Honour Member<br />
Associació per a Joves TEB, receives on 15 April 2005, during the closing ceremony of "III Jornades Java<br />
Catalanes", the "2005 Honour Member".<br />
With this distinction it is wants to recognize the effort and dedication carried out, for this entity, that have<br />
demonstrated its contribution to the growth and development of information society in zones where the youngsters<br />
live in situations of exclusion, and where the new technologies could not be another barrier.<br />
It is from this project, and other important project like Xarxa-Òmnia, RavalNet and a long list of projects that they<br />
have acted how authentic dynamic social agents and of bridges of cohesion there where bags of social exclusion<br />
could be produced.<br />
Dissolution<br />
According to the agreements taken in the last General Assembly of Members, on Tuesday, 24 October 2006 at 20:00<br />
hours, was approved by over ot the two third parts of the votes, the dissolution of the association.<br />
The reasons that brought to the dissolution were mainly two, as they were explained at the meeting:<br />
• The little support on the part of the implied companies, and especially of the matrix company, Sun<br />
MicroSystems, which finally cut the capital funding of the entity.<br />
• On the other hand, the problem of the technological voluntarism, in Catalonia, a concept that has just not been<br />
understood by the society.<br />
• The people associate the technology with affairs of materialist look, where always to take out a benefit and this<br />
entails that there are few people willing to collaborate if there is not an economic incentive a lot.<br />
• And on "collaborating", we understand in an active and constant contribution way.<br />
• The technological voluntarism must be to grow and to be something more than to participate in the<br />
development of a software or to participate in the net without going out from home.<br />
This close a cycle where AUJAC was the most important non-enterprise entity that promotes the diffusion of Java.
Associació d'Usuaris de Java de Catalunya 48<br />
References<br />
[1] http:/ / community. java. net/ jugs/<br />
[2] I Jornades Java Catalanes: Press notes in Vilaweb (http:/ / www. vilaweb. cat/ www/ noticia?p_idcmp=652475)<br />
[3] II Jornades Java Catalanes: Press note at Vilaweb (http:/ / www. vilaweb. cat/ www/ noticia?p_idcmp=838725)<br />
[4] 'III Jornades Java Catalanes, press note at COEIC' (http:/ / coeic. org/ descarrega/ Butlleti_n. 6_18. 03. 05.<br />
pdf?iwithSession=89ded563b805d53b6ea96a8c3ed7778a)<br />
[5] 'III Jornades Java Catalanes, Press note at LaFarga.cat' (http:/ / www. lafarga. org/ agenda/ iii-jornades-java-catalanes)<br />
[6] Sun Tech Day a l'Escola Universitaria de Sabadell (http:/ / www. uab. es/ servlet/ Satellite/ L-escola/ Miscel-lania/<br />
Sun-Tech-Day-1183530620403. html)<br />
[7] Antoni Farrés i Sabater<br />
Automated exception handling<br />
Automated exception handling is a computing term referring to the computerized handling of errors. runtime<br />
engines such as those for the Java language or Microsoft .Net lend themselves to an automated mode of exception or<br />
error handling. In these environments software errors do not 'crash' the operating system or the runtime engine but<br />
rather generate exceptions. Recent advances in these runtime engines enables specialized runtime-engine add-on<br />
products to provide automated exception handling that is independent of the source code and provides root-cause<br />
information for every exception of interest.<br />
How it works<br />
Upon exception, the runtime engine calls an error interception tool that is attached to the runtime engine (e.g. JVM).<br />
Based on the nature of the exception such as its type and the class and method in which it occurred and based on user<br />
preferences, an exception can be either handled or ignored.<br />
If the preference is to handle the exception, then based on handling preferences such as memory search depth, the<br />
error interception utility extracts memory values from heap and stack memories. This snapshot then produces the<br />
equivalent of a debugger screen (as if there had been a debugger) at the precise moment of the exception.<br />
Advantages<br />
This mechanism enables the automated handling of software errors independent of the source code of the application<br />
and independent of its developers. It is a direct artifact of the runtime engine paradigm and it enables unique<br />
advantages to the software lifecycle that were not available before.
Bean Scripting Framework 49<br />
Bean Scripting Framework<br />
Developer(s) Apache Software Foundation<br />
Stable release 2.4.0 / October 6, 2006<br />
Preview release 3.0 Beta3 / April 5, 2009<br />
Development status Active<br />
Written in Java<br />
Operating system Cross-platform<br />
Type Script Engine<br />
License Apache License 2.0<br />
Website http:/ / jakarta. apache. org/ bsf<br />
The Bean Scripting Framework is a method of allowing the use of scripting in Java code. It provides a set of Java<br />
classes which provides support within Java applications for scripting languages, and also allows access to Java<br />
objects and methods. Some examples of languages that can be used in combination with BSF and Java include<br />
Python, Jython, Tcl, as well as JRuby, and Groovy using their own libraries.<br />
BSF was created by IBM, and then donated to the Apache Software Foundation, where work on BSF is part of the<br />
Apache Jakarta Project.<br />
A counterpart of BSF is the JSR223 ScriptEngine shipped with Java SE 6. Java SE 6 only includes a Script Engine<br />
based on Rhino JavaScript Engine for Java version 1.6R2, while JSR223 framework actually supports a number of<br />
scripting languages. JSR223 uses Script Engine to integrate scripts with Java source codes. So far, Script Engines<br />
included in the JSR223 include BeanShell, Jython, JRuby, JavaScript, Groovy and several others.<br />
Bibliography<br />
• Bosanac, Dejan (August 19, 2007), Scripting in Java: Languages, Frameworks, and Patterns [1] (1st ed.),<br />
Addison-Wesley Professional, pp. 552, ISBN 978-0321321930<br />
See also<br />
• JRuby - Java implementation of Ruby interpreter.<br />
• Jython - Java implementation of Python programming language.<br />
• BeanShell - Java interpreter for Java source codes<br />
• JSR223 - JSR223: Scripting for the JavaTM platform
Bean Scripting Framework 50<br />
External links<br />
• Apache Jakarta - Bean Scripting Framework [2]<br />
• IBM - Bean Scripting Framework [3]<br />
References<br />
[1] http:/ / www. scriptinginjava. net/<br />
[2] http:/ / jakarta. apache. org/ bsf/<br />
[3] http:/ / www. alphaworks. ibm. com/ tech/ bsf<br />
CJAN<br />
CJAN is an acronym standing for Comprehensive Java Archive Network. CJAN as a concept is an extension of<br />
CPAN, the Comprehensive Perl Archive Network. In 2004 the CJAN project has ceased development.<br />
Apache CJAN<br />
Apache CJAN was an attempt at a simple web service for serving Java Jar files. It was started some time prior to<br />
May 2001. It was abandoned in favour of the more promising Apache JJAR project.<br />
Apache JJAR<br />
Apache JJAR is an experimental distributed repository and toolset to navigate and fetch from the repository. While it<br />
met its initial goals and found a couple of niche uses, it never went mainstream due to lack of interest from fellow<br />
developers. Although the project is no longer featured on Apache.org's main pages and is essentially abandoned, this<br />
experimental project is still hosted on their servers.<br />
CJAN.org<br />
Started in November 2001 by Brian Tol [1] , CJAN.org set out to become for the Java community what CPAN<br />
represented to the Perl community - a comprehensive archive of reusable components for their respective<br />
programming languages.<br />
Two key differences between CPAN and CJAN were that Java uses modules known as Jar files and that CJAN was<br />
to use a distributed network topology (the later would ensure that CJAN would scale well with increased numbers of<br />
users and keep server hosting costs to an absolute minimum). The decision was taken to code CJAN from scratch in<br />
Java.<br />
At the beginning of 2002, Michael Davey started working with Brian on the specifications and a prototype.<br />
CJAN.org was managed as an Open Source project, a hobby they worked on in their spare time.<br />
Progress was slow, in part because some of the basic building blocks needed to implement CJAN simply didn't exist<br />
in open-source form in Java at that time so the developers were spending time creating the components and then<br />
trying to persuade the appropriate developer community to adopt the component and take over its management. The<br />
distributed architecture was a problem, too. CJAN was attempting to use the JXTA framework when it was in its<br />
infancy and only offered very fine-grained, low-level control of the framework.<br />
Sun Microsystems became interested in CJAN at the beginning of 2003. After some initial discussions with Brian<br />
and Michael and then the Apache community they sought the opinion of the wider Java community and teamed up<br />
with Collab.Net and O'Reilly publishing. On 11 June 2003 the Java.net community and website was launched [2] .
CJAN 51<br />
Ostensibly, CJAN.org failed because it was too ambitious - trying to build an open-source project on leading-edge<br />
technology. The final straw for the open-source project was the launch of the high-profile Java.Net website.<br />
Although to this day Java.Net does not offer a catalogue of reusable components, it has a huge community and the<br />
website features are good enough for most Java developers most of the time that developers rarely cite the need for<br />
such.<br />
See also<br />
• CPAN<br />
• CRAN<br />
• CTAN<br />
• JSAN<br />
• JXTA<br />
• Java.Net<br />
External links<br />
• Apache.org JJAR [3] is a functional webservice and toolset (at time of writing, JJAR is an abandoned<br />
experimental project)<br />
• Java.net CJAN wiki page [4]<br />
• SorceForge.net CJAN project documentation [5] has a number of documents and code, but activity has ceased.<br />
• Java.Net [6] the closest thing the Java community has to a CJAN repository.<br />
References<br />
[1] CJAN Project Summary on SF.Net (http:/ / sourceforge. net/ projects/ cjan)<br />
[2] Press release: SUN MICROSYSTEMS UNVEILS JAVA.NET (http:/ / www. sun. com/ smi/ Press/ sunflash/ 2003-06/ sunflash. 20030611. 4.<br />
xml)<br />
[3] http:/ / jakarta. apache. org/ commons/ sandbox/ jjar/<br />
[4] http:/ / wiki. java. net/ bin/ view/ Projects/ CJAN<br />
[5] http:/ / sourceforge. net/ docman/ ?group_id=41872<br />
[6] http:/ / java. net/
Celtix 52<br />
Celtix<br />
Celtix delivers a Java enterprise service bus (ESB) runtime and set of APIs that make it easy to add transports,<br />
message formats, and security features. The goal is to simplify the construction, integration and flexible reuse of<br />
technical and business components using a standards-based, service-oriented architecture.<br />
Related Technologies<br />
• ASP.NET 2.0 - Web Services are Basic Profile Compliant compliant [1]<br />
• GlassFish Metro, the bundle including the JAX-WS Reference Implementation (JAX-WS RI) and the Tango<br />
(WSIT) project.<br />
• IBM WebSphere Application Server Version 5.0.2 to 5.1 are BP 1.0 compliant version 6.0+ are BP 1.1 compliant<br />
[2]<br />
• Apache Axis 1.2+ is BP 1.0 compliant<br />
• Apache Axis2<br />
• WebMethods Glue<br />
• JBossWS<br />
• Codehaus XFire<br />
• Apache CXF, the merger of Codehaus XFire and Celtix<br />
• DPWS<br />
External links<br />
• Celtix Homepage [3] at the ObjectWeb<br />
References<br />
[1] http:/ / msdn2. microsoft. com/ en-us/ library/ ms230196. aspx<br />
[2] http:/ / www-128. ibm. com/ developerworks/ webservices/ newto/ ws-websvc. html<br />
[3] http:/ / celtix. objectweb. org/
Chainsaw (log file viewer) 53<br />
Chainsaw (log file viewer)<br />
Developer(s) Apache Software Foundation<br />
Stable release 2.0 / March 2, 2006<br />
Development status Active<br />
Written in Java<br />
Operating system Cross-platform<br />
Type GUI tool to view and analyze log files<br />
License Apache 2.0 Licence<br />
Website [1]<br />
Chainsaw is a java-based GUI tool to view and analyze log files - specifically logs generated by the Log4j logging<br />
system. Both Log4j and Chainsaw are Open source projects under Apache Software Foundation. The latest release is<br />
Chainsaw v2. [2] Chainsaw can read log files formatted in Log4j's XMLLayout [3] , receive events from remote<br />
locations, read events from a DB, or work with JDK 1.4 logging events.<br />
License<br />
The project is licensed under Apache License, V 2.0. Dependencies may not follow the same licensing. [4]<br />
External links<br />
• Apache Logging Services Chainsaw v2 Home [1]<br />
• JavaDoc API reference for Chainsaw v2 [5]<br />
References<br />
[1] http:/ / logging. apache. org/ chainsaw/<br />
[2] "Apache Chainsaw v2 Download'" (http:/ / logging. apache. org/ chainsaw/ ). . Retrieved 2008-01-30.<br />
[3] http:/ / logging. apache. org/ log4j/ 1. 2/ apidocs/ org/ apache/ log4j/ xml/ XMLLayout. html<br />
[4] "Apache Chainsaw Project License'" (http:/ / logging. apache. org/ chainsaw/ license. html). . Retrieved 2008-01-30.<br />
[5] http:/ / logging. apache. org/ chainsaw/ apidocs/
clone (Java method) 54<br />
clone (Java method)<br />
clone() is a method in the Java programming language for object duplication. In Java, objects are manipulated<br />
through reference variables, and there is no operator for copying an object -- the assignment operator duplicates the<br />
reference, not the object. The clone() method provides this functionality.<br />
Overview<br />
Classes that want copying functionality must implement some method to do so. To a certain extent that function is<br />
provided by "clone()".<br />
clone() acts like a constructor. Typically it calls the clone() method of its superclass to obtain the copy, etc. until it<br />
eventually reaches Object's clone() method. The special clone() method in the base class Object provides a standard<br />
mechanism for duplicating objects.<br />
The class Object's clone() method creates and returns a copy of the object, with the same class and with all the fields<br />
having the same values. However, clone() throws a CloneNotSupportedException unless the class you are trying to<br />
use it on implements the marker interface Cloneable.<br />
The default implementation of Object.clone() performs a shallow copy. When a class desires a deep copy or some<br />
other custom behavior, they must perform that in their own clone() method after they obtain the copy from the<br />
superclass.<br />
The syntax for calling clone in Java is:<br />
Object copy = obj.clone();<br />
or commonly<br />
MyClass copy = (MyClass) obj.clone();<br />
which provides the typecasting needed to assign the generic Object reference returned from clone to a reference to a<br />
MyClass object.<br />
One disadvantage with the design of the clone() method is that the return type of clone() is Object, and needs to be<br />
explicitly cast back into the appropriate type. However, overriding clone() to return the appropriate type is preferable<br />
and eliminates the need for casting in the client (using covariant return types, since J2SE 5.0).<br />
Another disadvantage is that one often cannot access the clone() method on an abstract type. Most interfaces and<br />
abstract classes in Java do not specify a public clone() method. As a result, often the only way to use the clone()<br />
method is if you know the actual class of an object; which is contrary to the abstraction principle of using the most<br />
generic type possible. For example, if one has a List reference in Java, one cannot invoke clone() on that reference<br />
because List specifies no public clone() method. Actual implementations of List like ArrayList and LinkedList all<br />
generally have clone() methods themselves, but it is inconvenient and bad abstraction to carry around the actual class<br />
type of an object.
clone (Java method) 55<br />
Alternatives<br />
There are alternatives to clone(), notably the use of a copy constructor - a constructor that accepts as a parameter<br />
another instance of the same class - or a factory method. These methods are not always adequate when the concrete<br />
type of the cloned object is not known in advance. (However, clone() is often not adequate either for the same<br />
reason, as most abstract classes do not implement a public clone() method.)<br />
Also the use of serialization and deserialization is another alternative to using clone.<br />
clone() and the Singleton pattern<br />
When writing a class using the Singleton pattern, only one instance of that class can exist at a time. As a result, the<br />
class must not be allowed to make a clone. To prevent this, override the clone() method using the following code:<br />
public Object clone() throws CloneNotSupportedException {<br />
}<br />
throw new CloneNotSupportedException();<br />
(Note: This is only necessary if a superclass implements a public clone() method, or to prevent a subclass from using<br />
this class's clone() method to obtain a copy. Since classes don't usually inherit a public clone() method (Object<br />
doesn't have a public clone() method), it is usually unnecessary to explicitly implement a non-functional clone()<br />
method.<br />
clone() and class hierarchy<br />
When working with the clone() in a hierarchy of classes, there are several things that must be handled properly.<br />
1) Every type reference that needs to call the clone function must have a clone() method in its own class or a publicly<br />
accessible clone() method in its parent classes. That means that if you want to clone a reference to an abstract base<br />
class, either the base class must have a clone() method, or one of its parents must have a publicly accessible clone()<br />
method.<br />
Example<br />
- since varY1 is of type Y, then Y must have clone(), or a parent of Y must have clone()<br />
abstract public class X implements Cloneable {<br />
}<br />
public Object clone() throws CloneNotSupportedException {<br />
}<br />
return super.clone();<br />
abstract public class Y extends X { }<br />
public class Z extends Y { }<br />
public class test1 {<br />
}<br />
public void function() throws CloneNotSupportedException {<br />
}<br />
Y varY1 = new Z();<br />
Y varY2 = (Y) varY1.clone();
clone (Java method) 56<br />
2) Every class that has any data other than primitives that has to be cloned must contain a clone() function that<br />
handles it. This includes all objects and all primitives that are allocated with the 'new' command such as variable<br />
length arrays. (This assumes that the programmer wants the objects to be cloned (deep copy) and not just have their<br />
reference copied (shallow copy).)<br />
Example<br />
- since class Z has a reference to an object of another class, there needs to be specific code to clone that object.<br />
abstract public class X implements Cloneable {<br />
}<br />
public Object clone() throws CloneNotSupportedException {<br />
}<br />
return super.clone();<br />
abstract public class Y extends X { }<br />
public class ObjectABC implements Cloneable {<br />
}<br />
public Object clone() throws CloneNotSupportedException {<br />
}<br />
public class Z extends Y {<br />
}<br />
return super.clone();<br />
private ObjectABC someABC;<br />
public Object clone() throws CloneNotSupportedException {<br />
}<br />
public class test1 {<br />
}<br />
Z newZ = (Z) super.clone();<br />
newZ.someABC = (ObjectABC) someABC.clone();<br />
return newZ;<br />
public void function() throws CloneNotSupportedException {<br />
}<br />
Easy Solution<br />
Y varY1 = new Z();<br />
Y varY2 = (Y) varY1.clone();<br />
The easiest solution to this is to make the base class "implements Cloneable" and have the base class and all<br />
sub-classes contain the clone() method. When a class has data in it that must be cloned, adding a line or two to the<br />
clone() method is straight forward.<br />
Example<br />
abstract public class X implements Cloneable {<br />
public Object clone() throws CloneNotSupportedException {<br />
return super.clone();
clone (Java method) 57<br />
}<br />
}<br />
abstract public class Y extends X {<br />
}<br />
public Object clone() throws CloneNotSupportedException {<br />
}<br />
public class Z extends Y {<br />
}<br />
return super.clone();<br />
public Object clone() throws CloneNotSupportedException {<br />
}<br />
public class test1 {<br />
}<br />
Downsides<br />
return super.clone();<br />
public void function() throws CloneNotSupportedException {<br />
}<br />
Y varY1 = new Z();<br />
Y varY2 = (Y) varY1.clone();<br />
If every class in your hierarchy has a clone() method, then when the actual class is cloned all of these functions will<br />
be called, adding some overhead. Over many calls this could be significant.<br />
With complex object graphs deep copying can become problematic, with recursive references. Once one object is<br />
cloneable, others tend to follow until the entire graph attempts to implement Cloneable. Sooner or later you run into<br />
a class that you can't make Cloneable.<br />
It is not always appropriate to have multiple copies of the same object floating around. Besides, using clone() tends<br />
to defeat the "single object, multiple references" paradigm.<br />
clone() and final fields<br />
Generally, clone() is incompatible with final fields. Because clone() is essentially a default constructor (one that has<br />
no arguments) it is impossible to assign a final field within a clone() method; a compiler error is the result. Where<br />
the value of the field is an immutable object this is okay; just let the 'constructor' copy the reference and both the<br />
original and its clone will share the same object.<br />
But where the value is a mutable object it must be deep copied. The only solution is to remove the final modifier<br />
from the field, giving up all the benefits it conferred.<br />
For this reason, many programmers prefer to make the objects in the hierarchy Serializable, and create copies by<br />
serializing the old object and then creating a new object from the resulting bitstream, which should be nearly as fast<br />
as the calls to clone(), uses only one object's worth of extra memory, and that only during the operation, and handles<br />
final data members correctly.
clone (Java method) 58<br />
References<br />
• McManus, Eamonn (April 4, 2007). "Cloning Java objects using serialization" (http:/ / weblogs. java. net/ blog/<br />
emcmanus/ archive/ 2007/ 04/ cloning_java_ob. html). Eamonn McManus's Blog. java.net. Retrieved 2009-07-31.<br />
• Bloch, Joshua (2008). Effective Java: A Programming Language Guide. The Java Series (2nd ed.).<br />
Addison-Wesley. ISBN 0321356683.<br />
• "Avoid clone" (http:/ / www. javapractices. com/ topic/ TopicAction. do?Id=71). Collected Java Practices.<br />
Hirondelle Systems. 2009. Retrieved 2009-07-31.<br />
• "Object (Java Platform SE 6)" (http:/ / java. sun. com/ javase/ 6/ docs/ api/ java/ lang/ Object. html#clone()).<br />
Java Platform Standard Ed. 6. Sun Microsystems, Inc.. 2008. Retrieved 2009-07-31.<br />
Comparison of Java and C Sharp<br />
Introduction<br />
This article compares Microsoft's C# programming language with Sun's (now Oracle's) Java programming language.<br />
While the focus of this article is mainly the programming languages and their features, such a comparison will<br />
necessarily also consider some platform features and some library features. A comparison of the platforms are<br />
beyond the scope of this article, however.<br />
Neither Java nor C# can be evaluated without taking the respective platforms and libraries into consideration. For a<br />
platform comparison please see Comparison of the Java and .NET platforms.<br />
The comparison will naturally focus on the areas where the languages differ. This may skew the fact that the two<br />
languages and their platforms are actually more alike than they are different: Both are (primarily) statically, strongly<br />
and explicitly typed, both are class-based object-oriented, both are designed with semi-interpretation or runtime<br />
compilation in mind, both use garbage-collected memory models and both are considered "curly brace" C/C++ style<br />
languages. The common ancestry is also evident in the fact that common concepts are often termed the same way<br />
and more often than not have very similar syntax.<br />
Language and features<br />
Feature comparison<br />
Data types Java C#<br />
Single-root (unified) type system No Yes<br />
Signed integers Yes; 8, 16, 32, 64 bits Yes; 8, 16, 32, 64 bits<br />
Unsigned integers No Yes; 8, 16, 32, 64 bits<br />
Character Yes Yes<br />
Date/time Yes; reference type Yes; value type<br />
IEEE 754 binary32 floating point number Yes Yes<br />
IEEE 754 binary64 floating point number Yes Yes<br />
High precision floating point number No; but see Arbitrary size decimals 128-bit (28 digits) Decimal type<br />
Boolean type Yes Yes<br />
Strings Immutable reference type, Unicode Immutable reference type, Unicode<br />
Arbitrary size integers Reference type; no operators Yes
Comparison of Java and C Sharp 59<br />
Arbitrary size decimals Reference type; no operators No<br />
Complex numbers No Yes<br />
Reference types Yes Yes<br />
Arrays Yes Yes<br />
Value types No; only primitive types Yes<br />
Enumerated types Yes; reference type Yes; scalar<br />
Lifted (nullable) types No; but wrapper types Yes<br />
Tuples No Yes<br />
Pointers No Yes<br />
Reference types Java C#<br />
Garbage collection Yes Yes<br />
Weak references Yes Yes<br />
Soft references Yes No<br />
Proxy support Yes; proxy generation Yes; object contexts<br />
Object initialization Bottom-up (fields and constructors) Top-down (fields); bottom-up (constructors)<br />
Object orientation Java C#<br />
Classes Yes Yes<br />
Interfaces Yes Yes<br />
Abstract classes Yes Yes<br />
Member accessibility levels<br />
Public, package, private, protected<br />
Public, protected, internal, protected internal,<br />
Class level inner classes Yes Yes<br />
Instance level inner classes Yes No<br />
Partial classes No Yes<br />
Deprecation/obsolescence Yes Yes<br />
Overload versioning Some Yes<br />
Properties No Yes<br />
Events No Yes<br />
Operators (operator overloading) No Yes<br />
Indexers No Yes<br />
Implicit conversions No Yes<br />
Explicit conversions No Yes<br />
Fields and initialization Java C#<br />
Fields Yes Yes<br />
Constants Yes Yes<br />
Static (class) constructors Yes Yes<br />
Instance constructors Yes Yes<br />
Finalizers/destructors Yes Yes<br />
Instance initializers Yes No<br />
Hierarchy initialization Top-bottom, lexical order Top-bottom-top, lexical order<br />
private
Comparison of Java and C Sharp 60<br />
Object initializers No Yes<br />
Collection initializers No; can be modelled Yes<br />
Array initializers Yes Yes<br />
Methods and properties Java C#<br />
Virtual Virtual by default Non-virtual by default<br />
Abstract Yes Yes<br />
Sealing Yes Yes<br />
Explicit interface implementation No Yes<br />
Value (input) parameters Yes Yes<br />
Reference (input/output) parameters No Yes<br />
Output (output) parameters No Yes<br />
Variadic methods Yes Yes<br />
Optional arguments No Yes<br />
Named arguments No Yes<br />
Generator methods No Yes<br />
Extension methods No Yes<br />
Conditional methods No Yes<br />
Partial methods No Yes<br />
Generics Java C#<br />
Reified generics No Yes<br />
Co-variance Yes Yes<br />
Contra-variance Yes Yes<br />
Reference type constraint Yes; implicit Yes<br />
Value/primitive type constraint No Yes<br />
Constructor constraint No Yes<br />
Relation constraint Yes Yes<br />
Primitive/value type support No Yes<br />
Migration compatibility Yes No<br />
Functional programming Java C#<br />
Delegates/method references No Yes<br />
Closures/lambdas No; some use cases covered by anonymous inner<br />
classes<br />
Expression trees No Yes<br />
Query expressions No Yes<br />
Runtime (dynamic) binding Java C#<br />
Late-bound (dynamic) type No Yes<br />
Runtime type information and<br />
manipulation<br />
Yes<br />
Java C#<br />
Runtime type information Yes; but with type erasure Yes<br />
Runtime generics realization No Yes
Comparison of Java and C Sharp 61<br />
Runtime type construction No; third party tools exist Yes<br />
Statements Java C#<br />
Loops Yes Yes<br />
Conditionals Yes Yes<br />
Flow control Yes Yes<br />
Assignment Yes Yes<br />
Exception control Yes Yes<br />
Variable declaration Yes Yes<br />
Variable type inference No Yes<br />
Deterministic disposal (ARM-blocks) No Yes<br />
Expressions and operators Java C#<br />
Arithmetic operators Yes Yes<br />
Logical operators Yes Yes<br />
Bitwise logic operators Yes Yes<br />
Conditional Yes Yes<br />
String concatenation Yes Yes<br />
Casts Yes Yes<br />
Boxing Yes; implicit Yes; implicit<br />
Unboxing Yes; implicit Yes; explicit<br />
Lifted operators No Yes<br />
Overflow control No Yes<br />
Strict floating point evaluation Yes; opt-in/out No<br />
Local classes Yes No<br />
Ad-hoc (anonymous) classes No Yes<br />
Verbatim (here-)strings No Yes<br />
Exceptions Java C#<br />
Checked exceptions Yes No<br />
Try-catch-finally Yes Yes<br />
Arrays and collections Java C#<br />
One-dimensional, zero-based index arrays Yes Yes<br />
Rectangular (multidimensional) arrays No Yes<br />
Jagged (arrays of arrays) arrays Yes Yes<br />
Non-zero based arrays No Some<br />
Unified arrays and collections No Yes<br />
Maps/dictionaries Yes Yes<br />
Sets Yes Yes<br />
Lists/vectors Yes Yes<br />
Maps Yes Yes<br />
Queues/stacks Yes Yes
Comparison of Java and C Sharp 62<br />
Bags/multisets Yes Yes<br />
Metadata Java C#<br />
Metadata annotations/attributes Interface based Class based<br />
Positional arguments No; unless a single argument Yes<br />
Named arguments Yes Yes<br />
Default values At definition Through initialization<br />
Nested types Yes Yes<br />
Specialization No Yes<br />
Conditional metadata No Yes<br />
Preprocessing, compilation and<br />
packaging<br />
Java C#<br />
Namespaces Packages Namespaces<br />
Packaging Package Assembly<br />
File contents Restricted Free<br />
Conditional compilation No Yes<br />
Custom errors/warnings No Yes<br />
Explicit regions No Yes<br />
Threading and synchronization Java C#<br />
Native interoperability Java C#<br />
External/native methods Yes Yes<br />
Marshalling External glue code required Yes; metadata controlled<br />
Pointers and arithmetics No Yes<br />
Native types No Yes<br />
Fixed size buffers No Yes<br />
Explicit stack allocation No Yes<br />
Address pinning (fixing) No Yes<br />
Address-of No Yes<br />
Object pinning (fix variable to address) No Yes<br />
Data types<br />
Unified type system<br />
In Java the primitive types are special in that they are not object-oriented and they could not have been defined using<br />
the language itself. The Java reference types all derive from a common root type, however. C# has a unified type<br />
system in which all types ultimately derive from a common root type. Consequently, all types implement the<br />
methods of this root type, and extension methods defined for the object type apply to all types, even primitive int<br />
literals and delegates. Note, that unlike Java, C# this way supports objects with encapsulation which are not<br />
reference types.<br />
In Java compound types are synonymous with reference types; you can not define methods for a type unless it is also<br />
a class reference type. In C# the concepts of encapsulation and methods have been decoupled from the reference<br />
requirement so that a type can support methods and encapsulation without being a reference type. Only reference<br />
types support virtual methods and specialization, however.
Comparison of Java and C Sharp 63<br />
The primitive types of Java are special and could not have been defined using the language itself. They also do not<br />
share a common ancestor with reference types.<br />
Simple/primitive types<br />
Both languages support a number built-in types which are copied and passed by value rather than by reference. Java<br />
calls these types primitive types, while they are called simple types in C#. The simple/primitive types typically have<br />
native support from the underlying processor architecture.<br />
C# has a few more primitive types than Java, due to the fact that it supports unsigned as well as signed integer types,<br />
and a decimal type for decimal floating-point calculations.<br />
Java lacks the unsigned types. In particular, Java lacks a primitive type for an unsigned byte. The Java byte type is<br />
signed, while the C# byte is unsigned and sbyte is signed.<br />
Both languages feature a native char (character) datatype as a simple type. Although the Java char type can used<br />
with bitwise operators, this is actually accomplished by promoting the char to an integer before the operation.<br />
C# has a type for high-precision (28 decimal digits) decimal arithmetic (based on the IEEE 754 Decimal128 format)<br />
for e.g. financial and monetary application. While Java lacks such a built-in type, the Java library does feature an<br />
arbitrary precision decimal type. This is not considered a language type and it does not support the usual arithmetic<br />
operators; rather it is a reference type which must be manipulated using the type methods. See more on arbitrary<br />
size/precision numbers below.<br />
The C# primitive/simple types implement a number of interfaces and consequently offer a number of methods<br />
directly on instances of the types - even on the literals. The C# type names are also merely aliases for Common<br />
Language Runtime types. The C# Long type is exactly the same type as the long type; the only difference is that the<br />
former is the canonical .NET name while the latter is in C# alias for it.<br />
Java does not offer methods directly on the primitive types. Instead methods which operate on the primitive values<br />
are offered through companion wrapper classes. A fixed set of such wrapper classes exist each of which wraps on of<br />
the fixed set of primitive types. As an example, the Java Long type is a reference type which wraps the primitive<br />
long type. They are not the same type, however.<br />
The following table summarizes the corresponding simple/primitive types of the languages:<br />
C# alias .NET CLR type Width (bits) Range (apx.) Java type Java wrapper<br />
sbyte SByte 8 -128 to 127 byte Byte<br />
byte Byte<br />
8 0 to 255 Not<br />
available<br />
Not available<br />
short Int16 16 -32768 to 32767 short Short<br />
ushort UInt16<br />
16 0 to 65535 Not<br />
available<br />
Not available<br />
int Int32 32 -2,147,483,648 to 2,147,483,647 int Integer<br />
uint UInt32<br />
long Int64<br />
ulong UInt64<br />
32 0 to 4,294,967,295 Not<br />
64 -9,223,372,036,854,775,808 to<br />
9,223,372,036,854,775,807<br />
available<br />
64 0 to 18,446,744,073,709,551,615 Not<br />
Not available<br />
long Long<br />
available<br />
Not available<br />
float Single 32 -3.402823e38 to 3.402823e38 float Float<br />
double Double 64 -1.79769313486232e308 to 1.79769313486232e308 double Double
Comparison of Java and C Sharp 64<br />
decimal Decimal<br />
128 ±1.0 × 10e−28 to ±7.9 × 10e28 Not<br />
available<br />
Not available<br />
char Char 16 \u0000 to \uFFFF char Character<br />
bool Boolean 8 true, false boolean Boolean<br />
Advanced numeric types<br />
Both languages offer library-defined arbitrary size integer types.<br />
Only Java offers a data type for arbitrary precision decimal point calculations and only C# offers a type for working<br />
with complex numbers.<br />
In both languages the number of operations which can be performed are limited compared to the built-in IEEE 754<br />
floating point types. For instance, none of the types support square root or logarithms.<br />
By leveraging the C# support for type integration through custom operator overloading and custom (implicit and<br />
explicit) type conversions, C# achieves better parity with the built-in types.<br />
Java C#<br />
ze="6.85"><br />
er bigNumber =<br />
igInteger("123456789012345678901234567890");<br />
<br />
BigInteger bigNumber =<br />
BigInteger.Parse("1234567890123456789012345<br />
er answer = bigNumber.multiply(new BigInteger("42")); var answer = bigNumber * 42;<br />
er square = bigNumber.multiply(bigNumber);<br />
var square = bigNumber * bigNumber;<br />
er sum = bigNumber.add(bigNumber);<br />
var sum = bigNumber + bigNumber;<br />
<br />
Built-in compound data types<br />
Both languages treat strings as (immutable) objects of reference type. In both languages the type contains a number<br />
of methods to manipulate strings, parse, format etc. In both languages regular expressions are considered an external<br />
feature and is implemented in separate classes.<br />
Both languages' libraries define classes for working with dates and calendars in different cultures. The Java<br />
java.util.Date is a mutable reference type where the C# System.DateTime is a struct value type. C# additionally<br />
define a TimeSpan type for working with time periods. Both languages support date/time arithmetic according to<br />
different cultures.<br />
Reference types<br />
Both languages use classes and interfaces as the primary means for defining new, object-oriented types. See below<br />
for further details.<br />
Value types<br />
C# allows the programmer to create user-defined value types, using the struct keyword. Unlike classes, and like the<br />
standard primitives, such value types are passed and assigned by value rather than by reference. They can also be<br />
part of an object (either as a field or boxed), or stored in an array, without the memory indirection that normally<br />
exists for class types.<br />
Because value types have no notion of a null value and can be used in arrays without initialization, they always come<br />
with an implicit default constructor that essentially fills the struct memory space with zeroes. The programmer can<br />
only define additional constructors with one or more arguments. Value types do not have virtual method tables, and<br />
because of that (and the fixed memory footprint), they are implicitly sealed. However, value types can (and
Comparison of Java and C Sharp 65<br />
frequently do) implement interfaces. For example, the built-in integer types implement a number of interfaces.<br />
Apart from the built-in primitive types, Java does not include the concept of value types.<br />
Enumerations<br />
Enumerations in C# are derived from a primitive integer type (8, 16, 32, or 64 bit). Any value of the underlying<br />
primitive type is a valid value of the enumeration type, though an explicit cast may be needed to assign it. C# also<br />
supports bit-mapped enumerations where an actual value may be a combination of enumerated values bitwise or'ed<br />
together.<br />
Enumerations in Java, are full objects. The only valid values are the ones listed in the enumeration. Also, as objects,<br />
each enumeration can contain its own methods and fields, like a dedicated toString() method, for instance, or<br />
comparators. They can be considerered classes with a predefined amount of instances, which are the enum constants.<br />
Special enumeration set and map collections provide fully type-safe functionality with minimal overhead.<br />
In both C# and Java programmers can use them in a switch statement without conversion to a string or primitive<br />
integer type.<br />
Delegates / method references<br />
C# implements object oriented method pointers in the form of delegates. A delegate is a special type which can<br />
capture a type-safe reference to a method. This reference can then be stored in a delegate-type variable or passed to a<br />
method through a delegate parameter for later invocation. C# delegates support covariance and contravariance, and<br />
can hold a reference to any signature-compatible static method, instance method or anonymous method or lambda<br />
expression.<br />
Delegates should not be confused with closures and inline functions. The concepts are related because a reference to<br />
a closure/inline function must be captured in a delegate reference to be useful at all. But a delegate does not always<br />
reference an inline function, it can also reference existing static or instance methods. Delegates form the basis of C#<br />
events but should not be confused with those either.<br />
Java does not have a language-level construct like the C# delegate. To mimic the functionality the developer will<br />
have to create an ad-hoc implementation of a class (typically an anonymous inner class) where one method performs<br />
the desired invocation. The following code snippets show how to mimic most of the delegate functionality in Java.<br />
Java C#
Comparison of Java and C Sharp 66<br />
size="7.15"><br />
define a delegate<br />
terface SomeDelegate {<br />
boolean Invoke(String arg);<br />
a target class<br />
ass Target {<br />
public boolean TargetMethod(String arg) {<br />
// do something<br />
return true;<br />
}<br />
usage<br />
id DoSomething() {<br />
><br />
// construct a target with the target method<br />
final Target target = new Target();<br />
// capture the delegate for later invocation<br />
SomeDelegate dlg = new SomeDelegate() {<br />
public boolean Invoke(String arg) {<br />
return target.TargetMethod(arg);<br />
}<br />
};<br />
// invoke the delegate<br />
boolean result = dlg.Invoke("argumentstring");<br />
Lifted (nullable) types<br />
<br />
// define a delegate<br />
private delegate bool SomeDelegate(string resou<br />
}<br />
<br />
// a target class<br />
class Target {<br />
public bool TargetMethod(string arg) {<br />
// do something<br />
return true;<br />
}<br />
}<br />
// usage<br />
void DoSomething() {<br />
// construct a target with the target metho<br />
var target = new Target();<br />
// capture the delegate for later invocatio<br />
SomeDelegate dlg = target.TargetMethod;<br />
// invoke the delegate<br />
bool result = dlg("argumentstring");<br />
C# allows value/primitive/simple types to be "lifted" to allow the special null value in addition to the type's native<br />
values. A type is lifted by adding a ? suffix to the type name. Conversions are implicitly defined to convert between<br />
values of the base and the lifted type. The lifted type can be compared against null or it can be tested for HasValue.<br />
Also, lifted operators are implicitly and automatically defined based on their non-lifted base, where - with the<br />
exception of some boolean operators - a null argument will propagate to the result.<br />
Java does not support type lifting as a concept, but the fixed set of built-in primitive types all have corresponding<br />
(boxed) wrapper types which do support the null value by virtue of being reference types. However, Java operators<br />
such as + are not defined for these companion wrapper types. Instead Java will fall back to the primitive operator and<br />
will attempt to unbox the operands before invocation. If one or both of the operands are null, this unboxing will<br />
cause a NullPointerException to be thrown.<br />
The following example illustrates how the lifted C# operator propagates the null value of the operand where the<br />
corresponding code in Java will throw an exception.<br />
Java C#
e="6.73"><br />
= 42;<br />
= null;<br />
Comparison of Java and C Sharp 67<br />
<br />
int? a = 42;<br />
int? b = null;<br />
ill generate a runtime NullPointerException<br />
// c will receive the null value<br />
e the * operator will attempt to unbox the null value // because * is lifted and one of the operands<br />
= a * b; <br />
int? c = a * b;<br />
<br />
Not all C# lifted operators have been defined to propagate null unconditionally if one of the operands is null.<br />
Specifically, the boolean operators have been lifted to support ternary logic thus keeping impedance with SQL.<br />
Late-bound (dynamic) type<br />
C# features a late bound dynamic type which supports no-reflection dynamic invocation, interoperability with<br />
dynamic languages as well as ad-hoc binding to (for example) document object models. The dynamic type resolves<br />
member access dynamically at runtime as opposed to statically/virtual a compile time. The member lookup<br />
mechanism is extensible with traditional reflection as a fall-back mechanism.<br />
There are several use cases for the dynamic type in C#:<br />
• Less verbose use of reflection: By casting an instance to the dynamic type, members such as properties, methods,<br />
events etc. can be directly invoked on the instance without using the reflection API directly.<br />
• Interoperability with dynamic languages: The dynamic type comes with a hub-and-spoke support for<br />
implementing dynamically typed objects and common runtime infrastructure for efficient member lookup.<br />
• Creating dynamic abstractions on the fly: For instance, a dynamic object could provide simpler access to<br />
document object models such as XML- or XHTML documents.<br />
Java does not support a late-bound type. The use cases for C# dynamic type have different corresponding constructs<br />
in Java:<br />
• For dynamic late-bound by-name invocation of preexisting types, reflection should be used.<br />
• For interoperability with dynamic languages, some form of interoperability API specific to that language will<br />
have to be used. The Java Virtual Machine platform does have multiple dynamic languages implemented on top if<br />
it, but there is no common standard for how to pass objects between languages. Usually this will involve some<br />
form of reflection or reflection-like API. As an example of how to use JavaFX objects from Java, see How to Use<br />
JavaFX in Your Swing Application [1] .<br />
• For creating and interacting with objects entirely at runtime, e.g. interaction with a document object model<br />
abstraction, a specific abstraction API will have to be used.<br />
Pointers<br />
C# allows use of pointers and corresponding pointer arithmetic. Pointers and pointer-arithmetic are potentially<br />
unsafe in a managed environment as they can be used to bypass the strict rules for object access. C# addresses that<br />
concern by requiring that code blocks or methods that use the feature be marked with the unsafe keyword, so that all<br />
clients of such code can be aware that the code may be less secure than otherwise. The compiler requires the /unsafe<br />
switch to allow compilation of a program that uses such code, and assemblies containing unsafe code may only<br />
execute if explicitly granted security permissions. Generally, unsafe code is either used to allow better<br />
interoperability with unmanaged APIs or system calls (which are inherently "unsafe"), or for performance reasons.<br />
Java does not permit pointers or pointer-arithmetic within the Java runtime environment and native interop is<br />
handled externally through JNI or other mechanisms.
Comparison of Java and C Sharp 68<br />
Object handling<br />
Both C# and Java are designed from the ground up as object oriented languages using dynamic dispatch, with syntax<br />
similar to C++ (C++ in turn derives from C). Neither language is a superset of C or C++, however. Both mainly use<br />
garbage collection as a means of reclaiming memory resources, rather than explicit deallocation of memory (though<br />
C# requires explicit deallocation for graphical, GDI+ objects, in which case it uses the IDisposable interface). Both<br />
include thread synchronization mechanisms as part of their language syntax.<br />
In both languages objects are created with a new.<br />
References<br />
In both languages references are a central concept. All instances of classes are by reference.<br />
While not directly evident in the language syntax per se, both languages support the concept of weak references. An<br />
instance which is only referenced by weak references is eligible for garbage collection just as if there were no<br />
references at all. In both languages this feature is exposed through the associated libraries, even though it is really a<br />
core runtime feature.<br />
In addition to weak references, Java has soft references. Soft references are much like weak references, but the JVM<br />
will not deallocate softly-referenced objects until the memory is actually needed.<br />
Object initialization<br />
In both C# and Java, an object's fields can be initialized either by variable initializers (expressions that can be<br />
assigned to variables where they are defined) or by constructors (special subroutines that are executed when an<br />
object is being created). In addition, Java contains instance initializers, which are anonymous blocks of code with no<br />
arguments that are run before the constructor is executed.<br />
C# initializes object fields in the following order when creating an object:<br />
1. Derived static fields<br />
2. Derived static constructor<br />
3. Derived instance fields<br />
4. Base static fields<br />
5. Base static constructor<br />
6. Base instance fields<br />
7. Base instance constructor<br />
8. Derived instance constructor<br />
Some of the above fields may not be applicable (e.g. if an object does not have static fields). Derived fields are those<br />
that are defined in the object's direct class while base fields is a term for the fields that are defined in one of the<br />
object's superclasses. Note that an object representation in memory contains all fields defined in its class or any of its<br />
superclasses, even if some fields in superclasses are defined as private.<br />
It is guaranteed that any field initializers take effect before any constructors are called, since both instance<br />
constructor of the object's class and its super classes are called after field initializers are called. There is, however, a<br />
potential trap in object initialization when a virtual method is called from a base constructor. The overridden method<br />
in a subclass may reference a field that is defined in the subclass, but this field may not been initialized because the<br />
cubclass' constructor that contains field initialization is called after the constructor of its base class.<br />
In Java, the order of initialization is as follows:<br />
1. Invocation of another constructor (either of the object's class or of object's superclass)<br />
2. Instance variable initializers and instance initializers (in the order they appear listed in source code)<br />
3. The constructor body
Comparison of Java and C Sharp 69<br />
Like in C#, a new object is created by calling a specific constructor. Within a constructor, the first statement may be<br />
invocation of another constructor. If this is omitted, the call to the super class' argument-less constructor is added<br />
implicitly by the compiler. Otherwise, either another overloaded constructor of the object's class can be called<br />
explicitly, or a superclass' constructor can be called. In the former case, the called constructor will again call another<br />
constructor (either of the object's class or its cubclass) and the chain sooner or later ends up at the call to one of the<br />
superclass' constructor.<br />
After another constructor is called (which causes direct invocation superclass' constructor, and so forth, down to the<br />
Object class), instance variables defined in the object's class are initialized. Even if there are no variable initializers<br />
explicitly defined for some variables, these variables are initialized to default values. Note that instance variables<br />
defined in superclasses are already initialized by this point, because they were initialized by superclass' constructor<br />
when it was called (either by constructor's code or by variables' initializers performed before constructor's code or<br />
implicitly to default values). In Java, variable initializers are executed according to their textual order in the source<br />
file.<br />
Finally, the constructor body is executed. This ensures proper order of initialization, i.e. the fields of a base class<br />
finish initialization before initialization of the fields of an object class begins.<br />
There are two main potential traps in Java's object initialization. First, variable initializers are expressions that can<br />
contain method calls. Since methods can reference any variable defined in the class, the method called in variable's<br />
initializer can reference a variable that is defined below the variable being initialized. Since initialization order<br />
corresponds to textual order of variable definitions, such a variable would not be initialized to the value prescribed<br />
by its initializer and would contain the default value. Another potential trap is when a method that is overridden in<br />
the derived class is called in the base class' constructor, which can lead to behavior the programmer would not expect<br />
when object of the derived class is created. According to initialization order, the body of the base class' constructor is<br />
executed before variable initializers are evaluated and before the body of the derived class' constructor is executed.<br />
The overridden method called form the base class' constructor can however reference variables defined in the<br />
derived class, but these are not yet initialized to the values specified by their initializers or set in derived class'<br />
constructor.<br />
Arrays and collections<br />
Arrays and collections concepts featured by both languages. The syntax used to declare and access arrays is<br />
identical, except that C# has added syntax for declaring and manipulating multidimensional arrays.<br />
Java C#<br />
Arrays are implicitly direct specializations of Object. They are<br />
not unified with collection types.<br />
Instead of a common iterable/enumerable interface, the for<br />
loop accepts either arrays or Iterable (a collection interface).<br />
This means that the same short syntax can be used in for-loops.<br />
Arrays and collections are completely separate with no<br />
unification. Arrays cannot be passed where sequences or<br />
collections are expected<br />
Arrays in C# are implicitly specializations the System.Array class which<br />
implement a number of collection interfaces.<br />
The foreach statement iterates through a sequence using the IEnumerable<br />
orIEnumerable interface. Because arrays always implicitly implement these<br />
interfaces, the loop will iterate through arrays as well.<br />
Arrays can be passed where sequences (IEnumerables) or collections/list interfaces<br />
are expected. However, the collection operations which alter the number of<br />
elements (insert/add/remove) will throw exceptions as these operations are not<br />
supported by arrays.<br />
In both languages arrays are covariant. This means that a String[] array is assignable to variables of Object[] because String is a specialization of<br />
(assignable to) Object. In both languages the arrays will perform a type check when inserting new values because type-safety would otherwise be<br />
compromised. This is in contrast to how generic collections have been implemented in both languages.<br />
Multidimensional arrays only in the form of arrays of arrays<br />
(also known as "jagged" arrays); Java does not have true<br />
rectangular multidimensional arrays.<br />
True multidimensional "rectangular" arrays, as well as the arrays-of-arrays (jagged<br />
arrays).
Comparison of Java and C Sharp 70<br />
Multidimensional arrays can in some cases increase performance because of increased locality (as there is a single<br />
pointer dereference, instead of one for every dimension of the array as is the case for jagged arrays). However, since<br />
all array element access in a multidimensional array require multiplication/shift between the two or more<br />
dimensions, this is an advantage only in very random access scenarios.<br />
Another potential advantage is that the entire multidimensional array can be allocated with a single application of<br />
operator new, while jagged arrays require loops and allocations for every dimension. Note, though, that Java<br />
provides a syntactic construct for allocating a multidimensional jagged array with regular lengths; the loops and<br />
multiple allocations are then performed by the virtual machine and need not be explicit at the source level.<br />
Both languages feature an extensive set of collection types which includes various ordered and unordered types of<br />
lists, maps/dictionaries, sets etc.<br />
Type members<br />
Operator overloading and implicit and explicit conversions<br />
Operator overloading and user-defined casts are separate features which both aim to allow new types to become<br />
first-class citizens in the type system. By leveraging these features, types such as Complex and decimal has been<br />
integrated so that the usual operators like addition, multiplication work with the new types.<br />
Java does not include operator overloading nor custom conversions in order to prevent abuse of the feature, and to<br />
keep the language simple. [2] .<br />
Indexers<br />
C# also includes indexers which can be considered a special case of operator overloading (like C++ operator[]), or<br />
parametrized get/set properties. An indexer is a property named this[] which uses one or more parameters (indexes);<br />
the indices can be objects of any type:<br />
myList[4] = 5;<br />
string name = xmlNode.Attributes["name"];<br />
orders = customerMap[theCustomer];<br />
Java does not include indexers. The common Java pattern involves writing explicit get_ and set_ methods where a<br />
C# programmer would use an indexer.<br />
Partial classes<br />
C# allows a class definition to be split across several source files using a feature called partial classes. Each part<br />
must be marked with the keyword partial. All the parts must be presented to the compiler as part of a single<br />
compilation. Parts can reference members from other parts. Parts can implement interfaces and one part can define a<br />
base class. The feature is useful in code generation scenarios (such as UI design) where a code generator can supply<br />
one part and the developer another part to be compiled together. The developer can thus edit their part without the<br />
risk of a code generator overwriting that code at some later time. Unlike the class extension mechanism a partial<br />
class allows "circular" dependencies amongst its parts as they are guaranteed to be resolved at compile time. Java has<br />
no corresponding concept.
Comparison of Java and C Sharp 71<br />
Inner- and local classes<br />
Both languages allow inner classes, where a class is defined lexically inside another class. However, in each<br />
language these inner classes have rather different semantics.<br />
In Java, unless the inner class is declared static, a reference to an instance of an inner class carries a reference to the<br />
outer class with it. As a result, code in the inner class has access to both the static and non-static members of the<br />
outer class. To create an instance of a non-static inner class, one has to name the instance of the embracing outer<br />
class [3] . This is done via a new new-operator introduced in JDK 1.3: outerClassInstance.new Outer.InnerClass().<br />
This can be done in any class that has a reference to an instance of the outer class.<br />
In C#, an inner class is conceptually the same as a normal class. In a sense, the outer class only acts as a namespace.<br />
Thus, code in the inner class cannot access non-static members of the outer class unless it does so through an explicit<br />
reference to an instance of the outer class. Programmers can declare the inner class private to allow only the outer<br />
class to have any access to it.<br />
Java provides another feature called local classes or anonymous classes, which can be defined within a method body.<br />
These are generally used to implement an interface with only one or two methods, which are typically event<br />
handlers. They can also be used to override virtual methods of a super-class however. The methods in those local<br />
classes have access to the outer method's local variables declared final. C# satisfies the use-cases for these by<br />
providing anonymous delegates; see event handling for more about this.<br />
C# also provides a feature called anonymous classes, but it is rather different from Java's concept with the same<br />
name. It allows the programmer to instantiate a class by providing only a set of names for the properties the class<br />
should have, and an expression to initialize each. The types of the properties are inferred from the types of those<br />
expressions. These implicitly-declared classes are derived directly from object.<br />
Explicit member implementation<br />
C# also has "Explicit Member Implementation" which allows a class to specifically implement methods of an<br />
interface, separate to its own class methods, or to provide different implementations for two methods with the same<br />
name and signature inherited from two base interfaces.<br />
Events<br />
C# multicast-delegates are called events. Events provide support for event-driven programming and is an<br />
implementation of the observer pattern. To support this there is a special syntax to define events in classes, and<br />
operators to register, unregister or combine event handlers.<br />
Java does not offer events as a language construct. Java developers instead manually implement the observer [4] .<br />
Anonymous inner classes are commonly used to implement the listener, allowing you to define the body of the class<br />
and create an instance of it in a single point in the code.<br />
Statements and expressions<br />
Boxing and unboxing<br />
Both languages allow automatic boxing and unboxing to translate primitive data to and from their object form.<br />
Effectively, this makes the primitive types a subtype of the Object type. In C# this also means that primitive types<br />
can define methods, such as an override of Object's ToString() method. In Java, separate primitive wrapper classes<br />
provide such functionality. Java does not implicitly box primitive values when dereferenced and an explicit cast is<br />
required for an instance call on a primitive value — ((Integer)42).toString() instead of a C# instance call<br />
42.ToString(). Another difference is that Java makes heavy use of boxed types in generics (see below), and as such<br />
allows an implicit unboxing conversion (in C# this requires a cast). As these implicit unboxing conversions can<br />
potentially throw null pointer exceptions, modern integrated development environments and compilers can be
Comparison of Java and C Sharp 72<br />
configured to highlight them.<br />
Generics<br />
In the field of generics the two languages show a superficial syntactical similarity, but they have deep underlying<br />
differences.<br />
Type erasure versus reified generics<br />
Generics in Java are a language-only construction; they are implemented only in the compiler. The generated<br />
classfiles include generic signatures only in the form of metadata (allowing the compiler to compile new classes<br />
against them). The runtime has no knowledge of the generic type system; generics are not part of the JVM. Instead,<br />
generics classes and methods are transformed during compilation through a process known as type erasure. During<br />
this process the compiler replaces all generic types with their raw version and inserts casts/checks appropriately in<br />
client code where the type and its methods are used. The resulting byte code will contain no references to any<br />
generic types or parameters (See also Generics in Java).<br />
C# builds on support for generics from the virtual execution system itself, i.e. it is not just a language feature. The<br />
language is merely a front-end for cross-language generics support in the CLR. During compilation generics are<br />
verified for correctness, but code generation for actually implementing the generics are deferred to class-load time.<br />
Client code (code invoking generic methods/properties) are fully compiled and can safely assume generics to be<br />
type-safe. This is called reification. Unlike with the Java generics, there is no need to inject down-casts or<br />
type-checks in clients code. At runtime, when a unique set of type parameters for a generic class/method/delegate is<br />
encountered for the first time, the class loader/verifier will synthesize a concrete class descriptor and generate<br />
method implementations. During the generation of method implementations all reference types will be considered a<br />
single type, as reference types can safely share the same implementations. Note, this is merely for the purpose of the<br />
implementing code. Different sets of reference types will still have unique type descriptors; their method tables will<br />
merely point to the same code.<br />
The Java design imposes restrictions on the developer compared to the C# design. The following list is not<br />
exhaustive (see also Java Generics FAQs - Frequently Asked Questions [5] by Angelika Langer):<br />
Java C#<br />
checks and downcasts are injected into client code (the code referencing the<br />
cs). Compared to non-generic code with manual casts, these casts will be the<br />
6] . But compared to compile-time verified code which would not need runtime<br />
nd checks, these operations represent a performance overhead.<br />
ot use primitive types as type parameters; instead the developer must use the<br />
er type corresponding to the primitive type. This incurs extra performance overhead<br />
uiring boxing and unboxing conversions as well a memory and garbage collection<br />
re because the wrappers will be heap allocated as opposed to stack allocated.<br />
ic exceptions are not allowed [7] and the can not use a type parameter in a catch<br />
[8]<br />
members are shared across all generic realizations [9] (during type erasure all<br />
tions are folded into a single class)<br />
parameters cannot be used in declarations of static fields/methods or in definitions<br />
ic inner classes<br />
t "import" a particular realization of a generic class<br />
nt size="7.49"><br />
ort java.util.List // illegal<br />
ont><br />
C#/.NET generics guarantees type-safety and is verified at compile time and no extra checks/casts are necessary<br />
runtime. Hence, generic code will run faster than non-generic code (and type-erased code) which require casts w<br />
handling non-generic or type-erased objects.<br />
Primitive and value types are allowed as type parameters in generic realizations. At runtime code will be<br />
synthesized and compiled for each unique combination of type parameters upon first use. Generics which are<br />
realized with primitive/value type do not require boxing/unboxing conversions.<br />
Can both define generic exceptions and use those in catch clauses<br />
Static members are separate for each generic realization. A generic realization is a unique class.<br />
No restrictions on use of type parameters<br />
Can "import" (using directive) a specific realization with an alias<br />
<br />
using StringList = System.Collections.Generic.List
Comparison of Java and C Sharp 73<br />
t create an array where the component type is a generic realization (concrete<br />
eterized type)<br />
nt size="7.49"><br />
ect tenPairs =<br />
new Pair[10]; // error<br />
ont><br />
t create an array where the component type is a type parameter<br />
nt size="7.49"><br />
lic class Lookup {<br />
public TValue[] GetEmptyValues(TKey key) {<br />
return new TValue[0]; // error<br />
}<br />
ont><br />
A generic realization is a 1st class citizen and can be used as any other class; also an array component<br />
<br />
object tenPairs =<br />
new Pair[10]; // ok<br />
<br />
Type parameters represent actual, discrete classes and can be used like any other type within the generic definiti<br />
<br />
is no class literal for a concrete realization of a generic type A generic realization is an actual class.<br />
public class Lookup {<br />
public TValue[] GetEmptyValues(TKey key) {<br />
return new TValue[0]; // ok<br />
}<br />
}<br />
<br />
ceof is not allowed with type parameters or concrete generic realizations The is and as operators work the same for type parameters as for any other type.<br />
ot create new instances using a type parameter as the type With a constructor constraint, generic methods or methods of generic classes can create instances of classes wh<br />
information is erased during compilation. Special extensions to reflection must be<br />
o discover the original type.<br />
tion cannot be used to construct new generic realizations. During compilation extra<br />
typecasts) are injected into the client code of generics. This precludes creating new<br />
tions later.<br />
have default constructors.<br />
Type information about C# generic types is fully preserved at runtime, and allows complete reflection support a<br />
well as instantiation of generic types.<br />
Reflection can be used to create new realizations for new combinations of type parameters.<br />
C# allows generics directly for primitive types. Java, instead, allows the use of boxed types as type parameters (e.g.,<br />
List instead of List), but this comes at a small cost since all such values need to be heap-allocated<br />
(however, a generic type can be specialized with an array type of a primitive type in Java, for example List is<br />
allowed). [10]<br />
Migration compatibility<br />
Java's type erasure design was motivated by a design requirement to achieve migration compatibility - not to be<br />
confused with backward compatibility. In particular the original requirements was "... there should be a clean,<br />
demonstrable migration path for the Collections APIs that were introduced in the Java 2 platform" [11] . This was<br />
interpreted [12] by the designers as meaning that any new generic collections should be passable to methods which<br />
expected one of the preexisting collection classes.<br />
Migration compatibility solves a hypothetical, temporal situation where you have two software products (A,B) used<br />
by you to build software product C. Both A and B are beyond your control, e.g. supplied by external vendors.<br />
Product B builds upon product A - i.e. they have a direct relationship which you are unable to intercept through<br />
configuration or otherwise. Vendor-A moves product A to take advantage of generics and stops supporting the<br />
non-generic version of A. The vendor of B does not move his product to take advantage of generics coordinated with<br />
A, creating a situation where the non-generic code of B must be able to call/use generic code of A. Migration<br />
compatibility allows the non-generic code of B to call and even manipulate objects originating in A.<br />
C# generics were introduced into the language while preserving full backwards compatibility: Old code (pre C# 2.0)<br />
runs unchanged on the new generics-aware runtime without recompilation. As for migration compatibility, new<br />
generic collection classes and interfaces were developed which supplemented the non-generic .NET 1.x collections<br />
rather than replacing them. In addition to generic collection interfaces, the new generic collection classes implement<br />
the non-generic collection interfaces where possible. This allows new generic collections to be passed to preexisting<br />
(non-generic aware) methods, as long as those methods are coded to use the collection interfaces and not the specific
Comparison of Java and C Sharp 74<br />
classes. This is not full migration compatibility, however.<br />
Covariance and contravariance<br />
Covariance and contravariance is supported by both languages. Java has use-site variance which allows a single<br />
generic class to declare members using both co- and contravariance. C# has define-site variance for generic<br />
interfaces and delegates. Variance is not supported directly on classes but is supported through their implementation<br />
of variant interfaces. C# also has use-site covariance support for methods and delegates.<br />
Notation and special features<br />
Special feature keywords<br />
keyword feature, example usage<br />
checked,<br />
unchecked<br />
In C#, checked statement blocks or expressions can enable run-time checking for arithmetic overflow.<br />
get, set C# implements properties as part of the language syntax with their optional corresponding get and set accessors, as an alternative for<br />
the accessor methods used in Java, which is not a language feature but a coding-pattern based on method name conventions.<br />
goto C# supports the goto keyword. This can occasionally be useful, for example for implementing finite state machines or for generated<br />
code, but the use of a more structured method of control flow is usually recommended (see criticism of the goto statement). Java<br />
allows labeled breaks and continues, which make up for many of the uses of goto.<br />
switch(color)<br />
{<br />
case Color.Blue:<br />
Console.WriteLine("Color is blue"); break;<br />
case Color.DarkBlue:<br />
Console.WriteLine("Color is dark");<br />
goto case Color.Blue;<br />
// ...<br />
}<br />
out, ref C# has support for output and reference parameters. These allow returning multiple output values from a method, or passing values by<br />
reference.<br />
strictfp Java uses strictfp to guarantee the results of floating point operations remain the same across platforms.<br />
switch In C#, the switch statement also operates on strings and longs but only allows fallthrough for empty statements. Java's switch<br />
statement does not operate on strings nor long primitive type but falls through for all statements (excluding those with 'break').<br />
throws Java requires every method to declare the checked exceptions or superclasses of the checked exceptions that it can throw. Any method<br />
can also optionally declare the unchecked exception that it throws. C# has no such syntax.<br />
public int readItem() throws java.io.IOException<br />
{<br />
// ...<br />
}<br />
using C#'s using causes the Dispose method (implemented via the IDisposable interface) of the object declared to be executed after the code<br />
block has run or when an exception is thrown within the code block.<br />
// Create a small file "test.txt", write a string,<br />
// ... and close it (even if an exception occurs)<br />
using (StreamWriter file = new StreamWriter("test.txt"))<br />
{<br />
file.Write("test");<br />
}
Comparison of Java and C Sharp 75<br />
Numeric applications<br />
To adequately support applications in the field of mathematic and financial computation, several language features<br />
exist. [13] In this category, Java provides the strictfp keyword, which enables strict floating-point calculations for a<br />
region of code. This will ensure that calculations return the exact same result on all platforms. C# provides no<br />
equivalent, but does provide the built-in decimal type, for accurate decimal floating-point calculations. This forgoes<br />
the problems that exist with binary floating-point representations (float, double). Such binary representations are not<br />
suited to accurately represent decimal numbers and hence introduce rounding errors. For financial applications, an<br />
accurate decimal type is essential.<br />
The BigDecimal class also provides such characteristics for Java. BigDecimal and BigInteger are types provided<br />
with Java that allow arbitrary-precision representation of numbers. As of 2010 the current stable release of the .NET<br />
framework (4.0) includes classes for manipulating arbitrary-precision integers and complex numbers (with operators<br />
overloaded for easy use so that BigInteger objects can be used just like any other primitive data type) but still .NET<br />
Framework lacks classes to deal with arbitrary-precision floating point numbers (see Arbitrary-precision arithmetic).<br />
In Java there is no way to provide the same level of integration for library-defined types such as BigDecimal or<br />
complex numbers as there is for the primitive types. For this purpose, C# provides the following:<br />
• Operator overloading and indexers providing convenient syntax (see below).<br />
• Implicit and explicit conversions; allow conversions such as exist for the built-in int type that can implicitly<br />
convert to long.<br />
• Valuetypes and generics based on valuetypes; in Java every custom type must be allocated on the heap, which is<br />
detrimental for performance of both custom types and collections.<br />
In addition to this, C# can help mathematic applications with the checked and unchecked operators that allow to<br />
enable or disable run-time checking for arithmetic overflow for a region of code. It also offers rectangular arrays,<br />
that have advantages over regular nested arrays for certain applications. [13]<br />
Methods<br />
Methods in C# are non-virtual by default, and have to be declared virtual explicitly if desired. In Java, all non-static<br />
non-private methods are virtual. Virtuality guarantees that the most recent override for the method will always be<br />
called, but incurs a certain runtime cost on invocation as these invocations cannot be normally inlined, and require an<br />
indirect call via the virtual method table. However, some JVM implementations, including the Sun reference<br />
implementation, implement inlining of the most commonly called virtual methods.<br />
Java methods are virtual by default (although they can be "sealed" by using the final modifier to disallow<br />
overriding). There is no way to let derived classes define a new, unrelated method with the same name.<br />
This means that by default in C#, and only when explicitly asked in Java, you can define new methods in a derived<br />
class with the same name and signature than the one in its base class. Which implies that when you call that method<br />
on such an object, depending on the current knowledge of the caller (if it knows its exact subclass or not), the result<br />
will be different.<br />
In Java (by default), the subclass's method will be called, but you will be able to call the base class' own method if<br />
needed. In C# (by default), the base class' method will be called, and you won't be able to intercept the call.<br />
In very specific cases, when a base class is designed by a different person, and a new version introduces a method<br />
with the same name and signature as some method already present in the derived class, problems can happen.<br />
In Java, this will mean that the method in the derived class will implicitly override the method in the base class, even<br />
though that may not be the intent of the designers of either class.<br />
To prevent this versioning problem, C# requires that if a method should be overridden, the override keyword must be<br />
specified. Otherwise, the method will "hide" the inherited method. A compiler warning to this effect is issued, which<br />
can be silenced by specifying the new keyword. This avoids the problem which can arise from a base class being
Comparison of Java and C Sharp 76<br />
extended with a protected/public method whose signature is already in use by a derived class.<br />
Generator methods<br />
Any C# method declared as returning IEnumerable, IEnumerator and/or the generic versions of these interfaces can<br />
be implemented using yield syntax. This is a form of limited, compiler-generated continuations and can drastically<br />
reduce the code required to traverse or generate sequences, although that code is just generated by the compiler<br />
instead. The feature can also be used to implement infinite sequences, e.g. the sequence of Fibonacci numbers.<br />
Below is an example of a C# generator method that takes an enumerable input (possibly an array of ints) and yields<br />
the even numbers. The method will not iterate through all items on the invocation; rather it will return an iterator<br />
which will pull items from numbers only on demand.<br />
public static IEnumerable GetEven(IEnumerable numbers) {<br />
}<br />
foreach(int i in numbers) if (i % 2 == 0) yield return i;<br />
In Java, generators can be defined only using (possibly anonymous) classes, requiring more boilerplate code.<br />
Explicit interface implementation<br />
In either language if a method (or property in C#) is specified with the same name and signature in multiple<br />
interfaces, the members will clash when a class is designed which implements those interfaces. An implementation<br />
will by default implement a common method for all of the interfaces. If separate implementations are required<br />
(because the methods really do serve separate purposes, or because return values differ between the interfaces) C#'s<br />
explicit interface implementation will solve the problem, though allowing different results for the same method,<br />
depending on the current cast of the object. In Java there is no way to solve this problem other than cleaning the code<br />
and refactoring one or more of the interfaces to avoid name clashes.<br />
Closures<br />
A closure is an inline function which captures variables from its lexical scope.<br />
[14] [15]<br />
C# supports closures as anonymous methods or lambda expressions with full-featured closure semantics.<br />
In Java, anonymous inner classes remains the preferred way to emulate closures. Aside from being a more verbose<br />
construction, this approach also has some drawbacks compared to real closures, such as limited access to variables<br />
from the enclosing scopes (only final members can be referenced).<br />
When a reference to a method can be passed around for later execution, a problem arises about what to do when the<br />
method has references to variables/parameters in its lexical scope. C# closures can fully capture any<br />
variable/parameter from its lexical scope. In Java's anonymous inner classes only references to final members of the<br />
lexical scope are allowed, thus requiring the developer to artificially introduce extra levels of indirections and boxing<br />
primitive types if he wants to reference and update those from the inner class.<br />
While Java does not currently feature closures, it has been announced that some form of closures will be included in<br />
JDK 7. [16]
Comparison of Java and C Sharp 77<br />
Language integrated query<br />
C#s Language INtegrated Query (LINQ) is not really a single feature; rather it is a number of features designed to<br />
work together to allow for in-language querying capabilities. LINQ has emerged as one of the most distinguishing<br />
features between Java and C#.<br />
LINQ consists of the following features:<br />
• Extension methods allow existing interfaces/classes to be extended with new methods. Implementations can be<br />
shared or an interface can have a dedicated implementation.<br />
• Lambdas allow for expression of criteria in a functional fashion.<br />
• Expression trees allow a specific implementation to capture a lambda as a concrete syntax tree rather than an<br />
executable block. This can be leveraged by implementations to represent criteria in a different language, e.g. in<br />
the form of a SQL where clause as is the case with e.g. Linq#LINQ_to_SQL<br />
• Anonymous types and type inference supports capturing and working with the result type of a query. A query<br />
may both join and project over query sources which may lead to a result type which cannot be named.<br />
• Query expressions to support a syntax familiar to SQL.<br />
• Nullable (lifted) types to allow for better match with query providers which support nullable types, like e.g. SQL.<br />
Lambdas and expression trees<br />
C# features a special type of in-line closures called lambdas. These are anonymous methods: they have a signature<br />
and a body, but no name. They are not methods in that they cannot form part of a class interface. They are mainly<br />
used to specify local function-valued arguments in calls to other methods, a technique mainly associated with<br />
functional programming. On top of that, lambda functions can double as a way to define special data structures<br />
called expression trees. Whether they are seen as an executable function or a data structure depends on compiler type<br />
inference and what type of variable or parameter they are assigned/cast to. Lambdas and expression trees play key<br />
roles in LINQ. Java does not feature lambdas or expression trees; its primary mechanism for inline scope capture and<br />
method definition is the anonymous inner class syntax.<br />
Partial methods<br />
Related to partial classes C# allows partial methods to be specified within partial classes. A partial method is an<br />
intentional declaration of a method with a number of restrictions on the signature. These restrictions ensure that if a<br />
definition is not actually provided by any class part, then the method and every call to it can be safely erased. This<br />
feature allows code to provide a large number of interception points (like the template method GoF design pattern)<br />
without paying any runtime overhead if these extension points are not being used by another class part at compile<br />
time. Java has no corresponding concept.<br />
Extension methods<br />
Using a special this designator on the first parameter of a method, C# allows the method to act as if it were a member<br />
method of the type of the first parameter. This extension of the foreign class is purely syntactical. The extension<br />
method needs to be static and defined within a purely static class. It must obey any restriction on such external static<br />
methods and thus cannot break object encapsulation. The "extension" is only active within scopes where the<br />
namespace of the static host class has been imported. Java has no corresponding concept.
Comparison of Java and C Sharp 78<br />
Conditional compilation<br />
Unlike Java, C# implements conditional compilation using preprocessor directives. It also provides a Conditional<br />
attribute to define methods that are only called when a given compilation constant is defined. This way, assertions<br />
can be provided as a framework feature with the method Debug.Assert(), which is only evaluated when the DEBUG<br />
constant is defined. Since version 1.4, Java provides a language feature for assertions, which are turned off at<br />
runtime by default but can be enabled using the "-enableassertions" or "-ea" switch when invoking the JVM.<br />
Namespaces and source files<br />
C#'s namespaces are similar to those in C++. Unlike package names in Java, a namespace is not in any way tied to<br />
location of the source file. While it's not strictly necessary for a Java source file location to mirror its package<br />
directory structure, it is the conventional organization.<br />
Both languages allow importing of classes (e.g., import java.util.* in Java), allowing a class to be referenced using<br />
only its name. Sometimes classes with the same name exist in multiple namespaces or packages. Such classes can be<br />
referenced by using fully qualified names, or by importing only selected classes with different names. To do this,<br />
Java allows importing a single class (e.g., import java.util.List). C# allows importing classes under a new local name<br />
using the following syntax: using Console = System.Console. It also allows importing specializations of classes in<br />
the form of using IntList = System.Collections.Generic.List.<br />
Java has a static import syntax that allows using the short name of some or all of the static methods/fields in a class<br />
(e.g., allowing foo(bar) where foo() can be statically imported from another class). C# has a static class syntax (not<br />
to be confused with static inner classes in Java), which restricts a class to only contain static methods. C# 3.0<br />
introduces extension methods to allow users to statically add a method to a type (e.g., allowing foo.bar() where bar()<br />
can be an imported extension method working on the type of foo).<br />
The Sun Microsystems Java compiler requires that a source file name must match the only public class inside it,<br />
while C# allows multiple public classes in the same file, and puts no restrictions on the file name. C# 2.0 and later<br />
allows splitting a class definition into several files by using the partial keyword in the source code. In Java, a public<br />
class will always be in its own source file. In C#, source code files and logical units separation are not tightly related.<br />
Exception handling<br />
Java supports checked exceptions (in addition to unchecked exceptions). C# only supports unchecked exceptions.<br />
Checked exceptions force the programmer to either declare the exception thrown in a method, or to catch the thrown<br />
exception using a try-catch clause.<br />
Checked exceptions can encourage good programming practice, ensuring that all errors are dealt with. However<br />
Anders Hejlsberg, chief C# language architect, argues that they were to some extent an experiment in Java and that<br />
[17] [18]<br />
they haven't been shown to be worthwhile except in small example programs.<br />
One criticism is that checked exceptions encourage programmers to use an empty catch block (catch (Exception e)<br />
{}), which silently eats exceptions, rather than letting the exceptions propagate to a higher-level exception-handling<br />
routine. Another criticism of checked exceptions is that a new implementation of a method may cause unanticipated<br />
checked exceptions to be thrown, which is a contract-breaking change. This can happen in methods implementing an<br />
interface that only declares limited exceptions, or when the underlying implementation of a method changes. To<br />
allow for such unanticipated exceptions to be thrown, some programmers simply declare the method can throw any<br />
type of exception ("throws Exception"), which defeats the purpose of checked exceptions. In some cases however,<br />
exception chaining can be applied instead; re-throwing the exception in a wrapper exception. For example, if an<br />
object is changed to access a database instead of a file, an SQLException could be caught and re-thrown as an<br />
IOException, since the caller may not need to know the inner workings of the object.
Comparison of Java and C Sharp 79<br />
There are also differences between the two languages in treating the try-finally statement. The finally is always<br />
executed, even if the try block contains control-passing statements like throw or return. In Java, this may result in<br />
unexpected behavior if the try block is left by a return statement with some value, and then the finally block that is<br />
executed afterwards is also left by a return statement with a different value. C# resolves this problem by prohibiting<br />
any control-passing statements like return or break in the finally block.<br />
A common reason for using try-finally blocks is to guard resource managing code, thus guaranteeing the release of<br />
precious resources in the finally block. C# features the using statement as a syntactic shorthand for this common<br />
scenario, in which the Dispose() method of the object of the using is always called.<br />
Finally blocks<br />
Java allows flow of control to leave the finally block of a try statement, regardless of the way it was entered. This<br />
can cause another control flow statement (such as return) to be terminated mid-execution. For example:<br />
int foo() {<br />
}<br />
try {<br />
return 0;<br />
} finally {<br />
}<br />
return 1;<br />
In the above code, the return statement within try block causes control to leave it, and therefore finally block is<br />
executed before the actual return happens. However, finally block itself performs a return as well; thus, the original<br />
return that caused it to be entered is not actually executed, and the above method returns 1 rather than 0.<br />
C# does not allow any statements which allow control flow to leave the finally block prematurely, except for throw.<br />
In particular, return is not allowed at all, goto is not allowed if the target label is outside the finally block, and<br />
continue and break are not allowed if the nearest enclosing loop is outside the finally block.<br />
Lower level code<br />
The Java Native Interface (JNI) feature allows Java programs to call non-Java code. However, JNI does require the<br />
code being called to follow several conventions and impose restrictions on types and names used. This means that an<br />
extra adaption layer between legacy code and Java is often needed. This adaption code must be coded in a non-Java<br />
language, often C or C++. Java Native Access (JNA) allows easier calling of native code that only requires writing<br />
Java code, but comes at a performance cost.<br />
In addition, third party libraries provide for Java-COM bridging, e.g. JACOB [19] (free), and J-Integra for COM [20]<br />
(proprietary).<br />
.NET Platform Invoke (P/Invoke) offers the same capability by allowing calls from C# to what Microsoft refers to as<br />
unmanaged code. Through metadata attributes the programmer can control exactly how the parameters and results<br />
are marshalled, thus avoiding the need for extra adaption code. P/Invoke allows almost complete access to<br />
procedural APIs (such as Win32 or POSIX), but limited access to C++ class libraries.<br />
In addition, .NET Framework also provides a .NET-COM bridge, allowing access to COM components as if they<br />
were native .NET objects.<br />
C# also allows the programmer to disable the normal type-checking and other safety features of the CLR, which then<br />
enables the use of pointer variables. When using this feature, the programmer must mark the code using the unsafe<br />
keyword. JNI, P/Invoke, and "unsafe" code are equally risky features, exposing possible security holes and<br />
application instability. An advantage of unsafe, managed code over P/Invoke or JNI is that it allows the programmer<br />
to continue to work in the familiar C# environment to accomplish some tasks that otherwise would require calling
Comparison of Java and C Sharp 80<br />
out to unmanaged code. An assembly (program or library) using unsafe code must be compiled with a special switch<br />
and will be marked as such. This enables runtime environments to take special precautions before executing<br />
potentially harmful code.<br />
Runtime environments<br />
Java (the programming language) is designed to execute on the Java platform via the Java Runtime Environment<br />
(JRE). The Java platform includes the Java Virtual Machine (JVM) as well as a common set of libraries. The JRE<br />
was originally designed to support interpreted execution with final compilation as an option. Most JRE environments<br />
execute fully or at least partially compiled, possibly with adaptive optimization. The Java compiler produces Java<br />
bytecode. Upon execution the bytecode is loaded by the Java runtime and either interpreted directly or compiled to<br />
machine instructions and then executed.<br />
C# is designed to execute on the Common Language Runtime (CLR). The CLR is designed to execute fully<br />
compiled code. The C# compiler produces Common Intermediate Language instructions. Upon execution the<br />
runtime loads this code and compiles to machine instructions on the target architecture.<br />
Language history and evolution<br />
Java<br />
Java is older than C# and has built up a large and highly active user base, becoming the lingua franca in many<br />
modern branches of computer science, particularly areas which involve networking. Java dominates programming<br />
courses at high school and college level in the United States, and there are currently more Java than C# books. [21]<br />
Java's maturity and popularity have ensured more third party Java API and libraries (many of them open source) than<br />
C#.<br />
An occasionally voiced criticism [22] of the Java language is that it evolves slowly, lacking some features which<br />
make fashionable programming patterns and methodologies easier. Some critics suggest that the designers of C#<br />
may pander too quickly to current trends in programming, thus lacking focus and simplicity. Java's designers seem to<br />
have taken a more conservative stand on adding major new features to their language syntax than other current<br />
languages, perhaps not wanting to tie the language too tightly with trends which may prove to be dead ends.<br />
These trends have been broken with the Java 5.0 release, which introduced several new major language features: a<br />
foreach construct, autoboxing, methods with variable number of parameters (varargs), enumerated types, generic<br />
types, and annotations. With the exception of Generics, C# included all these features from its beginning, some<br />
under different names. [23] Proposals and specifications for the new features had been worked on in the Java<br />
community for considerable time before they were introduced. Indeed, some had been in gestation since before C#'s<br />
initial release (e.g., work on Generics formally began in May 1999 [24] ) such was the Java community's conservatism<br />
at that time.<br />
Problem-specific language additions to Java have been considered and, for now at least, rejected. This approach,<br />
along with a number of other new languages and technologies that address themselves specifically towards current<br />
programming trends, has sparked a renewed debate within the Java camp about the future direction of the Java<br />
language and whether its 'conservative evolution' is right.<br />
As of 2008 debate continued over the inclusion of closures [25] and properties [26] into the language syntax for Java 7.
Comparison of Java and C Sharp 81<br />
C#<br />
By contrast, C# is a relatively new language. Microsoft has studied existing languages such as Java and Object<br />
Pascal, and has changed some aspects of the language and runtime environment in response to perceived failures and<br />
difficulties with its predecessors. C# accommodates constructs more commonly found in languages such as C++,<br />
Delphi (the design of which was Anders Hejlsberg's principal job when he was at Borland), and, in recent C#<br />
versions, borrows from dynamic scripting languages such as Ruby and Python.<br />
C# 3.0 adds SQL-like language integrated queries suited for querying data from collections, databases or XML<br />
documents, building upon general-purpose language features, including lambda expressions and extension methods,<br />
to allow queries to be expressed and optimized for user types.<br />
Before creating C#, Microsoft implemented a modified Java environment, called J++, adding new features in a<br />
manner which was in direct contravention to the standards and conventions ensuring the platform neutrality which<br />
lies at the heart of Java. This violated the license agreement Microsoft had signed, requiring that standards and<br />
specifications be strictly adhered to in return for using the Java name and brand logos. Sun Microsystems sued, and<br />
in settling the suit, Microsoft agreed to discontinue J++. (The settlement allowed other existing Java-using Microsoft<br />
products to continue such use for seven years. [27] ) With the release of the .NET framework (and C#), the project was<br />
revived in the form of J#.<br />
See also<br />
• Comparison of C# and VB.NET<br />
• Comparison of Java and C++<br />
• Java programming language<br />
• Comparison of the Java and .Net platforms<br />
External links<br />
• C# and Java: Comparing Programming Languages [28] at MSDN<br />
• A Comparison of C# and Java [29]<br />
• Java vs. C# - Code for Code Comparison [30]<br />
• Nine Language Performance Round-up [31]<br />
• Java and C-Sharp Compared [32]<br />
• MSDN: The C# Programming Language for Java Developers [33]<br />
• 31 Differences between C# and Java [34]<br />
• Standard ECMA-334 C# Language specification [35]<br />
• Java Language Specification (Sun) [36]<br />
References<br />
[1] http:/ / blogs. sun. com/ javafx/ entry/ how_to_use_javafx_in<br />
[2] August 1998 Java News (http:/ / www. cafeaulait. org/ 1998august. html)<br />
[3] Java Language Specification Third Edition: section 15.9 Class Instance Creation Expressions (http:/ / java. sun. com/ docs/ books/ jls/<br />
third_edition/ html/ expressions. html#41147)<br />
[4] Goetz, Brian (26 July 2005). "Java theory and practice: Be a good (event) listener" (http:/ / www. ibm. com/ developerworks/ java/ library/<br />
j-jtp07265/ index. html). IBM Developer Works. . Retrieved 2008-12-23.<br />
[5] http:/ / www. angelikalanger. com/ GenericsFAQ/ JavaGenericsFAQ. html<br />
[6] http:/ / www. angelikalanger. com/ GenericsFAQ/ FAQSections/ TechnicalDetails. html#FAQ110<br />
[7] http:/ / www. angelikalanger. com/ GenericsFAQ/ FAQSections/ TechnicalDetails. html#FAQ302<br />
[8] http:/ / www. angelikalanger. com/ GenericsFAQ/ FAQSections/ TechnicalDetails. html#FAQ304<br />
[9] there one instances of a static field per instantiation of a parameterized type? (http:/ / www. angelikalanger. com/ GenericsFAQ/<br />
FAQSections/ TypeParameters. html#Is)<br />
[10] Generics in C#, Java, and C++ (http:/ / www. artima. com/ intv/ genericsP. html)
Comparison of Java and C Sharp 82<br />
[11] JSR 14: http:/ / www. jcp. org/ en/ jsr/ detail?id=14<br />
[12] http:/ / gafter. blogspot. com/ 2004/ 09/ puzzling-through-erasure-answer. html<br />
[13] Java for Scientific Computation: Prospects and Problems (http:/ / www. pds. ewi. tudelft. nl/ pubs/ papers/ scicomp01. pdf)<br />
[14] Richter, Jeffrey (April 2001). "An Introduction to Delegates" (http:/ / msdn. microsoft. com/ en-ca/ magazine/ cc301810. aspx). MSDN<br />
Magazine. . Retrieved 2008-12-23.<br />
[15] Campbell, Dustin (9 February 2007). "What's In A Closure?" (http:/ / diditwith. net/<br />
PermaLink,guid,235646ae-3476-4893-899d-105e4d48c25b. aspx). Did it with .NET. . Retrieved 2008-12-23.<br />
[16] Closures Coming in Java 7 (http:/ / java. dzone. com/ news/ closures-coming-java-7)<br />
[17] The Trouble with Checked Exceptions (http:/ / www. artima. com/ intv/ handcuffs. html)<br />
[18] Why doesn't C# have exception specifications? (http:/ / msdn2. microsoft. com/ en-us/ vcsharp/ aa336812. aspx)<br />
[19] http:/ / jacob-project. sourceforge. net/<br />
[20] http:/ / j-integra. intrinsyc. com/ products/ com/<br />
[21] O'Reilly, Tim (2006-08-02). "Programming Language Trends" (http:/ / radar. oreilly. com/ archives/ 2006/ 08/<br />
programming_language_trends_1. html). Radar. O'Reilly. .<br />
[22] i-Technology <strong>View</strong>point: Java's Not Evolving Fast Enough (http:/ / au. sys-con. com/ node/ 163294)<br />
[23] Java 5 catches up with C# (http:/ / www. barrycornelius. com/ papers/ java5/ )<br />
[24] JSR 14: Add Generic Types To The JavaTM Programming Language (http:/ / jcp. org/ en/ jsr/ detail?id=014)<br />
[25] Debate over closures for Java (http:/ / gafter. blogspot. com/ 2006/ 09/ debate-over-closures-for-java. html)<br />
[26] Property Support in Java, the Java Way (http:/ / www. javalobby. org/ java/ forums/ t88090. html)<br />
[27] CNET. "Sun, Microsoft settle Java suit" (http:/ / news. cnet. com/ 2100-1001-251401. html). .<br />
[28] http:/ / msdn. microsoft. com/ en-us/ library/ ms836794. aspx<br />
[29] http:/ / www. 25hoursaday. com/ CsharpVsJava. html<br />
[30] http:/ / www. javacamp. org/ javavscsharp/<br />
[31] http:/ / www. osnews. com/ story. php?news_id=5602<br />
[32] http:/ / www. csharphelp. com/ archives/ archive96. html<br />
[33] http:/ / msdn. microsoft. com/ en-us/ library/ ms228602. aspx<br />
[34] http:/ / www. geeks. ltd. uk/ Knowledgebase/ Compare-c-sharp-java. html<br />
[35] http:/ / www. ecma-international. org/ publications/ standards/ Ecma-334. htm<br />
[36] http:/ / java. sun. com/ docs/ books/ jls/<br />
Comparison of Java and C++<br />
This is a comparison of the Java programming language with the C++ programming language.<br />
Design aims<br />
The differences between the C++ and Java programming languages can be traced to their heritage, as they have<br />
different design goals.<br />
• C++ was designed mainly for systems programming, extending the C programming language. To this procedural<br />
programming language designed for efficient execution, C++ has added support for statically-typed<br />
object-oriented programming, exception handling, scoped resource management, and generic programming, in<br />
particular. It also added a standard library which includes generic containers and algorithms.<br />
• Java was created initially to support network computing. It relies on a virtual machine to be secure and highly<br />
portable. It is bundled with an extensive library designed to provide a complete abstraction of the underlying<br />
platform. Java is a statically typed object-oriented language that uses a syntax similar to C, but is not compatible<br />
with it. It was designed from scratch, with the goal of being easy to use and accessible to a wider audience.<br />
The different goals in the development of C++ and Java resulted in different principles and design trade-offs between<br />
the languages. The differences are as follows :
Comparison of Java and C++ 83<br />
C++ Java<br />
Compatible with C source code, except for a few corner cases. No backward compatibility with any previous language. The syntax is<br />
however strongly influenced by C/C++.<br />
Write once compile anywhere (WOCA) Write once run anywhere / everywhere (WORA / WORE)<br />
Allows both procedural programming and object-oriented<br />
programming.<br />
Encourages an object oriented programming paradigm.<br />
Allows direct calls to native system libraries. Call through the Java Native Interface and recently Java Native Access<br />
Exposes low-level system facilities. Runs in a protected virtual machine.<br />
Only provides object types and type names. Is reflective, allowing metaprogramming and dynamic code generation at<br />
Has multiple binary compatibility standards (commonly Microsoft<br />
and Itanium/GNU)<br />
Optional automated bounds checking. (e.g. the at() method in<br />
vector and string containers)<br />
runtime.<br />
Has a binary compatibility standard, allowing runtime check of correctness<br />
of libraries.<br />
Normally performs bounds checking. HotSpot can remove bounds checking.<br />
Supports native unsigned arithmetic. No native support for unsigned arithmetic.<br />
Standardized minimum limits for all numerical types, but the actual<br />
sizes are implementation-defined. Standardized types are available<br />
as typedefs (uint8_t, ..., uintptr_t).<br />
Pointers, References, and pass by value are supported<br />
Explicit memory management, though third party frameworks exist<br />
to provide garbage collection. Supports destructors.<br />
Supports class, struct, and union and can allocate them on heap or<br />
stack<br />
Standardized limits and sizes of all primitive types on all platforms.<br />
Primitive data types always passed by value. Objects are passed by nullable<br />
reference (comparable to using pointers for all class or struct parameters in<br />
C++). [1]<br />
Automatic garbage collection (can be triggered manually). Doesn't have the<br />
concept of Destructor and usage of finalize() is not recommended.<br />
Supports only class and allocates them on the heap. Java SE 6 optimizes with<br />
escape analysis to allocate some objects on the stack.<br />
Allows explicitly overriding types. Rigid type safety except for widening conversions. Autoboxing/Unboxing<br />
The C++ Standard Library has a much more limited scope and<br />
functionality than the Java standard library but includes: Language<br />
support, Diagnostics, General Utilities, Strings, Locales, Containers,<br />
Algorithms, Iterators, Numerics, Input/Output and Standard C<br />
Library. The Boost library offers much more functionality including<br />
threads and network I/O. Users must choose from a plethora of<br />
(mostly mutually incompatible) third-party libraries for GUI and<br />
other functionality.<br />
added in Java 1.5.<br />
The standard library has grown with each release. By version 1.6 the library<br />
included support for locales, logging, containers and iterators, algorithms,<br />
GUI programming (but not using the system GUI), graphics, multi-threading,<br />
networking, platform security, introspection, dynamic class loading, blocking<br />
and non-blocking I/O, and provided interfaces or support classes for XML,<br />
XSLT, MIDI, database connectivity, naming services (e.g. LDAP),<br />
cryptography, security services (e.g. Kerberos), print services, and web<br />
services. SWT offers an abstraction for platform specific GUIs.<br />
Operator overloading for most operators Meaning of operators is immutable.<br />
Full multiple inheritance, including virtual inheritance. Single inheritance only from classes, multiple from interfaces.<br />
Compile time Templates Run time Generics<br />
Function pointers, function objects, lambdas (in C++0x) and<br />
interfaces<br />
No standard inline documentation mechanism. 3rd party software<br />
(e.g. Doxygen) exists.<br />
const keyword for defining immutable variables and member<br />
functions that do not change the object.<br />
No function pointer mechanism. Instead idioms such as Interfaces, Adapters<br />
and Listeners are extensively used.<br />
Javadoc standard documentation<br />
final provides a limited version of const, equivalent to type* const pointers<br />
for objects and plain const of primitive types only. No const member<br />
functions, nor any equivalent to const type* pointers.<br />
Supports the goto statement. Supports labels with loops and statement blocks.
Comparison of Java and C++ 84<br />
Source code can be written to be platform independent (can be<br />
compiled for Windows, BSD, Linux, Mac OS X, Solaris etc. without<br />
needing modification) and written to take advantage of platform<br />
specific features. Is typically compiled into native machine code.<br />
Is compiled into byte code for the JVM. Is dependent on the Java platform<br />
but the source code is typically written not to be dependent on operating<br />
system specific features.<br />
C++ is a powerful language designed for system programming. The Java language was designed to be simple and<br />
easy to learn with a powerful cross-platform library. The Java standard library is considerably large for a standard<br />
library. However, Java does not always provide full access to the features and performance of the platform that the<br />
software runs on. The C++ standard libraries are simple and robust providing containers and associative arrays. [2]<br />
Language features<br />
Syntax<br />
• Java syntax has a context-free grammar which can be parsed by a simple LALR parser. Parsing C++ is somewhat<br />
more complicated; for example, Foo(3); is a sequence of comparisons if Foo is a variable, but it creates an<br />
object if Foo is the name of a class template.<br />
• C++ allows namespace level constants, variables, and functions. All such Java declarations must be inside a class<br />
or interface.<br />
• In C++ declarations, a class name declares an object of that class as a value (a.k.a. value semantics). There is no<br />
way to do this in Java. Objects are not values in Java. In Java declarations, a class name declares a reference to an<br />
object of that class (a.k.a. reference semantics). The equivalent way to do this in C++ is to use "*" to declare a<br />
pointer.<br />
• In C++, the operator "." takes an object as the left operand and accesses a member of the object. Since objects<br />
cannot be values in Java, and all objects are accessed through references, this cannot be done in Java. In Java, the<br />
"." operator takes a reference to an object as the left operand and access a member of that object. The equivalent<br />
operator in C++ is "->".<br />
e="7.71"><br />
{ // Declares class Foo<br />
; // Member variable<br />
: x(0) { // Constructor for Foo,<br />
// initializes x<br />
ar(int i) { // Member function bar()<br />
eturn 3*i + x;<br />
e="7.71"><br />
C++ Java<br />
es a to be a Foo object value,<br />
lized using the default constructor<br />
wanted to use another constructor,<br />
uld declare it as "Foo a(args);" <br />
<br />
class Foo { // Defines class Foo<br />
public int x = 0; // Member variable,<br />
// with initializer<br />
public Foo() { // Constructor for Foo<br />
}<br />
public int bar(int i) {// Member method bar()<br />
return 3*i + x;<br />
}<br />
}<br />
<br />
Foo a;<br />
// declares a to be a reference to a Foo object<br />
a = new Foo();<br />
// initializes using the default constructor<br />
// If you wanted to use another constructor,<br />
// you would declare it as "Foo a = new Foo(args);
Comparison of Java and C++ 85<br />
e="7.71"><br />
;<br />
the contents of a to a new Foo object b;<br />
ative syntax is "Foo b(a)"<br />
<br />
Foo b = a.clone();<br />
// copies the values of all members<br />
// of this instance if, and only if,<br />
// Foo implements a public method called<br />
// clone() which returns a new copy of the object<br />
<br />
e="7.71">a.x = 5; // modifies the object a a.x = 5; // modifies the object<br />
e="7.71"><br />
.x <br />
es c to be a pointer to a<br />
ject (initially<br />
ned; could point anywhere)<br />
e="7.71"><br />
oo();<br />
c to reference a new Foo object<br />
e="7.71"><br />
c;<br />
d to reference the same object as c<br />
e="7.71"><br />
es the object referenced by c<br />
e="7.71"><br />
// invokes Foo::bar() for a<br />
; // invokes Foo::bar() for *c<br />
e="7.71"><br />
->x
Comparison of Java and C++ 86<br />
C++ Java<br />
const Foo *a; // you cannot modify the object<br />
//pointed to by a through a<br />
private final Foo a;//Use getA() instead of a<br />
public Foo getA(){<br />
return a.clone()<br />
}<br />
a = new Foo(); a=new Foo();//Only in constructor<br />
a->x = 5;<br />
// ILLEGAL<br />
Foo *const b = new Foo();<br />
// you can declare a "const" pointer<br />
b = new Foo();<br />
//ILLEGAL, you can't re-bind it<br />
b->x = 5;<br />
// LEGAL, you can still modify the object<br />
getA().x=5;<br />
//Only modifies a clone of a's x, not a.x<br />
final Foo b = new Foo();<br />
// you can declare a "final" reference<br />
b = new Foo();<br />
// ILLEGAL, you can't re-bind it<br />
b.x = 5;<br />
// LEGAL, you can still modify the object<br />
• C++ supports goto statements; Java enforces structured control flow, and relies on labelled break and labelled<br />
continue statements to provide some goto-like functionality. Some commenters point out that these labelled flow<br />
control statements break the single point-of-exit property of structured programming. [3]<br />
• C++ provides low-level features which Java lacks. In C++, pointers can be used to manipulate specific memory<br />
locations, a task necessary for writing low-level operating system components. Similarly, many C++ compilers<br />
support inline assembler. In Java, such code has to reside in external libraries, and can only be accessed through<br />
the Java Native Interface with a significant overhead for each call.<br />
Semantics<br />
• C++ allows default values for arguments of a function/method, Java does not. However, method overloading can<br />
be used to obtain similar results in Java.<br />
• The minimal compilation unit in C++ is a function; the compilation unit in Java is a class. In C++, functions can<br />
be compiled separately. In Java, to compile and maintain methods separately requires moving them into super and<br />
extended classes or using some other code refactoring technique.<br />
• C++ allows a range of implicit conversions between native types, and also allows the programmer to define<br />
implicit conversions involving user-defined types. In Java, only widening conversions between native types are<br />
implicit; other conversions require explicit cast syntax.<br />
• A consequence of this is that although loop conditions (if, while and the exit condition in for) in Java and C++<br />
both expect a boolean expression, code such as if(a = 5) will cause a compile error in Java because there is no<br />
implicit narrowing conversion from int to boolean. This is handy if the code was a typo for if(a == 5). Yet<br />
current C++ compilers usually generate a warning when such an assignment is performed within a conditional<br />
expression.<br />
• For passing parameters to functions, C++ supports both pass-by-reference and pass-by-value. In Java, parameters<br />
are always passed by value. [4] However, in Java all non-primitive values are references to objects (in C++ terms,<br />
they are (smart)-pointers). Objects are not values in Java and only their references can be manipulated; C++<br />
developers who are used to having objects as values may confuse this with pass-by-reference.<br />
• Java built-in types are of a specified size and range defined by the virtual machine; In C++, a minimal range of<br />
values is defined for built-in types, but the exact representation (number of bits) can be mapped to whatever<br />
native types are supported on a given platform.<br />
• For instance, Java characters are 16-bit Unicode characters, and strings are composed of a sequence of such<br />
characters. C++ offers both narrow and wide characters, but the actual size of each is platform dependent, as is
Comparison of Java and C++ 87<br />
the character set used. Strings can be formed from either type.<br />
• The rounding and precision of floating point values and operations in C++ is platform dependent. Java provides<br />
an optional strict floating-point model that guarantees consistent results across platforms, though possibly at the<br />
cost of slower run-time performance.<br />
• In C++, pointers can be manipulated directly as memory address values. Java does not have pointers — it only<br />
has object references and array references, neither of which allow direct access to memory addresses. In C++ one<br />
can construct pointers to pointers, while Java references only access objects.<br />
• In C++ pointers can point to functions or methods (function pointers or functors). The equivalent mechanism in<br />
Java uses object or interface references.<br />
• Through the use of stack-allocated objects, C++ supports scoped resource management, a technique used to<br />
automatically manage memory and other system resources that supports deterministic object destruction. Yet,<br />
scoped resource management in C++ cannot be guaranteed; it is only a design pattern, and hence relies on<br />
programmers' adherence. Java supports automatic memory management using garbage collection, but other<br />
system resources (windows, communication ports, threads) often have to be explicitly released if the garbage<br />
collector can not determine they are no longer used.<br />
• C++ features programmer-defined operator overloading which is not supported in Java. The only overloaded<br />
operators in Java are the "+" and "+=" operators, which concatenate strings as well as performing addition.<br />
• Java features standard API support for reflection and dynamic loading of arbitrary new code.<br />
• C++ supports static and dynamic linking of binary to manage the space required for binary and performance.<br />
• Java has generics, whose main purpose is to provide type-safe containers. C++ has templates, which provide more<br />
extensive support for generic programming.<br />
• Both Java and C++ distinguish between native types (these are also known as "fundamental" or "built-in" types)<br />
and user-defined types (these are also known as "compound" types). In Java, native types have value semantics<br />
only, and compound types have reference semantics only. In C++ all types have value semantics, but a reference<br />
can be created to any type, which will allow the object to be manipulated via reference semantics.<br />
• C++ supports multiple inheritance of arbitrary classes. In Java a class can derive from only one class, but a class<br />
can implement multiple interfaces (in other words, it supports multiple inheritance of types, but only single<br />
inheritance of implementation).<br />
• Java explicitly distinguishes between interfaces and classes. In C++ multiple inheritance and pure virtual<br />
functions make it possible to define classes that function almost like Java interfaces do, with a few small<br />
differences.<br />
• Java has both language and standard library support for multi-threading. The synchronized keyword in Java<br />
provides simple and secure mutex locks to support multi-threaded applications, though synchronized sections<br />
have to be left in LIFO order. Java also provides robust and complex libraries for more advanced multi-threading<br />
synchronization. In C++ there is currently no defined memory model for multi-threading; however, third party<br />
libraries provide support roughly equivalent to that of Java; obvious difference being the non-uniformity of these<br />
C++ libraries.<br />
• C++ methods can be declared as virtual functions, which means the method to be called is determined by the<br />
run-time type of the object. By default, methods in C++ are not virtual. In Java, methods are virtual by default,<br />
but can be made non-virtual by using the final keyword.<br />
• C++ enumerations are primitive types and support conversion to and comparison with other integer types. Java<br />
enumerations are actually instances of a class (they extend java.lang.Enum) and may therefore define<br />
constructors, fields, and methods as any other class.
Comparison of Java and C++ 88<br />
Resource management<br />
• Java offers automatic garbage collection. Memory management in C++ is usually done through constructors,<br />
destructors, and smart pointers. The C++ standard permits garbage collection, but does not require it; garbage<br />
collection is rarely used in practice. The enforced use of automatic garbage collection means that writing<br />
real-time software can be difficult in Java. [3]<br />
• C++ can allocate arbitrary blocks of memory. Java only allocates memory through object instantiation. (Note that<br />
in Java, the programmer can simulate allocation of arbitrary memory blocks by creating an array of bytes. Still,<br />
Java arrays are objects.)<br />
• Java and C++ use different idioms for resource management. Java relies mainly on garbage collection, which can<br />
only reclaim memory and may be a last shot at other resources, while C++ relies mainly on the RAII (Resource<br />
Acquisition Is Initialization) idiom. This is reflected in several differences between the two languages:<br />
• In C++ it is common to allocate objects of compound types as local stack-bound variables which are destroyed<br />
when they go out of scope. In Java compound types are always allocated on the heap and collected by the<br />
garbage collector (except in virtual machines that use escape analysis to convert heap allocations to stack<br />
allocations).<br />
• C++ has destructors, while Java has finalizers. Both are invoked prior to an object's deallocation, but they<br />
differ significantly. A C++ object's destructor must be implicitly (in the case of stack-bound variables) or<br />
explicitly invoked to deallocate the object. The destructor executes synchronously just prior to the point in the<br />
program at which the object is deallocated. Synchronous, coordinated uninitialization and deallocation in C++<br />
thus satisfy the RAII idiom. In Java, object deallocation is implicitly handled by the garbage collector. A Java<br />
object's finalizer is invoked asynchronously some time after it has been accessed for the last time and before it<br />
is actually deallocated, which may never happen. Very few objects require finalizers; a finalizer is only<br />
required by objects that must guarantee some clean up of the object state prior to deallocation — typically<br />
releasing resources external to the JVM. In Java safe synchronous deallocation of resources has to be<br />
performed explicitly using the try/finally construct.<br />
• In C++ it is possible to have a dangling pointer – a stale reference to an object that has already been<br />
deallocated; attempting to use a dangling pointer typically results in program failure. In Java, the garbage<br />
collector won't destroy a referenced object.<br />
• In C++ it is possible to have uninitialized primitive objects, Java enforces default initialization.<br />
• In C++ it is possible to have an object that is allocated, but has no reachable reference to it. Such an<br />
unreachable object cannot be destroyed (deallocated), and results in a memory leak. In contrast, in Java an<br />
object will not be deallocated by the garbage collector until it becomes unreachable (by the user program).<br />
(Note: weak references are supported, which work with the Java garbage collector to allow for different<br />
strengths of reachability.) Garbage collection in Java prevents many memory leaks, but leaks are still possible<br />
under some circumstances. [5]<br />
• Java is more prone to leaking non-memory resources, while idiomatic C++ makes that much harder.<br />
Libraries<br />
• C++ provides cross-platform access to many features typically available in platform-specific libraries. Direct<br />
access from Java to native operating system and hardware functions requires the use of the Java Native Interface.<br />
Runtime<br />
• C++ is normally compiled directly to machine code which is then executed directly by the operating system. Java<br />
is normally compiled to byte-code which the Java virtual machine (JVM) then either interprets or JIT compiles to<br />
machine code and then executes.
Comparison of Java and C++ 89<br />
• Due to its unconstrained expressiveness, low level C++ language features (e.g. unchecked array access, raw<br />
pointers, type punning) cannot be reliably checked at compile-time or without overhead at run-time. Related<br />
programming errors can lead to low-level buffer overflows and segmentation faults. The Standard Template<br />
Library provides higher-level abstractions (like vector, list and map) to help avoid such errors. In Java, low level<br />
errors either cannot occur or are detected by the JVM and reported to the application in the form of an exception.<br />
• The Java language requires specific behavior in the case of an out-of-bounds array access, which generally<br />
requires bounds checking of array accesses. This eliminates a possible source of instability but usually at the cost<br />
of slowing down execution. In some cases, compiler analysis can prove a bounds check unnecessary and<br />
eliminate it. C++ has no required behavior for out-of-bounds access of native arrays, thus requiring no bounds<br />
checking for native arrays. C++ standard library collections like std::vector, however, offer optional bounds<br />
checking. In summary, Java arrays are "always safe; severely constrained; always have overhead" while C++<br />
native arrays "have optional overhead; are completely unconstrained; are potentially unsafe."<br />
Templates vs. Generics<br />
Both C++ and Java provide facilities for generic programming, templates and generics, respectively. Although they<br />
were created to solve similar kinds of problems, and have similar syntax, they are actually quite different.<br />
C++ Templates Java Generics<br />
Classes and functions can be templated. Classes and methods can be genericized.<br />
Parameters can be any type or integral value. Parameters can only be reference types (not primitive types).<br />
Separate copies of the class or function are likely to be generated for each type<br />
parameter when compiled.<br />
One version of the class or function is compiled, works for all<br />
type parameters.<br />
Objects of a class with different type parameters are different types at run time. Type parameters are erased when compiled; objects of a class<br />
Implementation source code of the templated class or function must be included<br />
in order to use it (declaration insufficient).<br />
Templates can be specialized -- a separate implementation could be provided for<br />
a particular template parameter.<br />
Template parameters can have default arguments (only for template classes, not<br />
functions).<br />
Does not support wildcards. Instead, return types are often available as nested<br />
typedefs.<br />
Does not directly support bounding of type parameters, but metaprogramming<br />
provides this [6]<br />
with different type parameters are the same type at run time.<br />
Signature of the class or function from a compiled class file is<br />
sufficient to use it.<br />
Generics cannot be specialized.<br />
Generic type parameters cannot have default arguments.<br />
Supports wildcard as type parameter if it is only used once.<br />
Supports bounding of type parameters with "extends" and<br />
"super" for upper and lower bounds, respectively; allows<br />
enforcement of relationships between type parameters.<br />
Allows instantiation of class of type parameter type. Does not allow instantiation of class of type parameter type<br />
(except through reflection).<br />
Type parameter of templated class can be used for static methods and variables. Type parameter of templated class cannot be used for static<br />
methods and variables.<br />
Static variables are not shared between classes of different type parameters. Static variables are shared between instances of a classes of<br />
Templated classes and functions do not enforce type relations for type parameters<br />
in their declaration. Use of a wrong type parameter results in the template code<br />
"not working", usually generating an error message at a place in the template<br />
code where an operation is not allowed for that type and not in the user's code.<br />
Proper use of templated classes and functions is dependent on proper<br />
documentation. Metaprogramming provides these features at the cost of<br />
additional effort.<br />
different type parameters.<br />
Generic classes and functions can enforce type relationships for<br />
type parameters in their declaration. Use of a wrong type<br />
parameter results in a type error at the code that uses it.<br />
Operations on parametrized types in generic code are only<br />
allowed in ways that can be guaranteed to be safe by the<br />
declaration. This results in greater type safety at the cost of<br />
flexibility.
Comparison of Java and C++ 90<br />
Templates are Turing-complete (see template metaprogramming). Generics are not Turing-complete.<br />
Miscellaneous<br />
• Java and C++ use different techniques for splitting up code in multiple source files. Java uses a package system<br />
that dictates the file name and path for all program definitions. In Java, the compiler imports the executable class<br />
files. C++ uses a header file source code inclusion system for sharing declarations between source files. (See<br />
Comparison of imports and includes.)<br />
• Compiled Java code files are generally smaller than code files in C++ as Java bytecode is usually more compact<br />
than native machine code and Java programs are never statically linked.<br />
• C++ compilation features an additional textual preprocessing phase, while Java does not. Thus some users add a<br />
preprocessing phase to their build process for better support of conditional compilation.<br />
• In both languages, arrays have a fixed size. In Java, arrays are first-class objects, while in C++ they are merely a<br />
continuous run of their base objects, often referred to using a pointer to their first element and an optional length.<br />
In Java, arrays are bounds-checked and know their length, while in C++ you can treat any subsequence as an<br />
array in its own right. Both C++ and Java provide container classes (std::vector and java.util.ArrayList<br />
respectively) which are resizable and store their size.<br />
• Java's division and modulus operators are well defined to truncate to zero. C++ does not specify whether or not<br />
these operators truncate to zero or "truncate to -infinity". -3/2 will always be -1 in Java, but a C++ compiler may<br />
return either -1 or -2, depending on the platform. C99 defines division in the same fashion as Java. Both<br />
languages guarantee (where a and b are integer types) that (a/b)*b + (a%b) == a for all a and b (b != 0). The C++<br />
version will sometimes be faster, as it is allowed to pick whichever truncation mode is native to the processor.<br />
• The sizes of integer types is defined in Java (int is 32-bit, long is 64-bit), while in C++ the size of integers and<br />
pointers is compiler and ABI dependent within given constraints. Thus, carefully-written C++ code can take<br />
advantage of the 64-bit processor's capabilities while still functioning properly on 32-bit processors. However,<br />
care must be taken to write the C++ program in a portable manner. In contrast, Java's fixed integer sizes mean that<br />
programmer error in this regard shouldn't be possible. This may incur a performance penalty since Java code<br />
cannot run using an arbitrary processor's word size.<br />
Performance<br />
In addition to running a compiled Java program, computers running Java applications must also run the Java Virtual<br />
Machine JVM, while compiled C++ programs can be run without external applications. Early versions of Java were<br />
significantly outperformed by statically compiled languages such as C++. This is because the program statements of<br />
these two closely related languages may compile to a few machine instructions with C++, while compiling into<br />
several byte codes involving several machine instructions each when interpreted by a JVM. For example:<br />
Java/C++ statement C++ generated code (x86) Java generated byte<br />
vector[i]++; mov edx,[ebp+4h]<br />
mov eax,[ebp+1Ch]<br />
inc dword ptr [edx+eax*4]<br />
aload_1<br />
iload_2<br />
dup2<br />
iaload<br />
iconst_1<br />
While this may still be the case for embedded systems because of the requirement for a small footprint, it is<br />
frequently argued that advances in just in time (JIT) compiler technology for long-running server and desktop Java<br />
processes will close the performance gap.<br />
iadd<br />
iastore<br />
code
Comparison of Java and C++ 91<br />
Several studies of mostly numerical benchmarks argue that Java could potentially be faster than C++ in some<br />
circumstances, [7] [8] [9] . However, it was shown that numerical (micro-)benchmarks are not appropriate for<br />
evaluation of languages as compiler is able to optimize both cases equally, or eliminate benchmarked code entirely.<br />
[10] [11] [12] If referring to a real world program, Java would suffer because of number of reasons: [13] [14] [15]<br />
• All objects are allocated on the heap. For functions using small objects this can result in huge performance<br />
degradation as stack allocation costs essentially zero.<br />
• Methods are by-default virtual. This increases memory usage as much as several times for small objects because<br />
of virtual function tables. Also, it induces performance penalty, because JIT compiler has to do additional<br />
optimization passes even for de-virtualization of small functions.<br />
• A lot of casting required even using standard containers induces performance penalty as it is needed to walk<br />
through entire inheritance hierarchy.<br />
• Virtual Java Machine Increases memory usage even further, thus reducing memory locality and increasing<br />
chances of cache misses and therefore slowdown of the program.<br />
• Lack of access to low level details does not allow developer to better optimize the program where the compiler is<br />
unable to do so. [16]<br />
It is argued, however, that compared to Java, C++ also has a number of downsides:<br />
• Pointers make optimization difficult since they may point to arbitrary data. However this is obsoleted as new<br />
compilers introduced strict-aliasing rule [17] and because of support of the C99 keyword restrict. [18]<br />
• Java garbage collection may have better cache coherence than usual usage of malloc/new for memory allocation<br />
as its allocations are generally made sequentially. Nevertheless, arguments exist that both allocators equally<br />
fragment the heap and no one exhibits better cache locality.<br />
• Run-time compilation can potentially use additional information available at run-time to optimise code more<br />
effectively, such as knowing what processor the code will be executed on. However this claim is effectively made<br />
obsolete as most state-of-the-art C++ compilers generate multiple code paths to employ full computational<br />
abilities of the given system [19] .<br />
Proprietary Control<br />
C++ is not a trademark of any company or organization and is not owned by any individual. [20] Java is a trademark<br />
of Sun Microsystems, which is now owned by Oracle. [21]<br />
The C++ language is defined by ISO/IEC 14882, an ISO standard, which is published by the ISO/IEC<br />
JTC1/SC22/WG21 committee. The Java language is defined by the Java Language Specification[36], a book which<br />
is published by Sun (now Oracle).<br />
External references<br />
• Java and C++ Memory Management [22] — an exhaustive publication about object-oriented memory management<br />
that compares Java and C++ in terms of Memory Modeling.<br />
• How Java Differs from C [23] — excerpt from Java in a Nutshell by David Flanagan<br />
• Java vs. C++ resource management comparison [24] - Comprehensive paper with examples<br />
• Java vs C performance... again... [25] - In-depth discussion of differences between Java and C / C++ with regard to<br />
performance
Comparison of Java and C++ 92<br />
References<br />
[1] Java is Pass-By-Value (http:/ / javadude. com/ articles/ passbyvalue. htm)<br />
[2] Java and C++ Library (http:/ / en. wikibooks. org/ wiki/ C+ + _Programming/ Programming_Languages/ Comparisons/ Java#Libraries)<br />
[3] Robert C. Martin (January 1997). "Java vs. C++: A Critical Comparison" (http:/ / www. objectmentor. com/ resources/ articles/ javacpp. pdf)<br />
(PDF). .<br />
[4] James Gosling, Bill Joy, Guy Steele, and Gilad Bracha, The Java language specification, third edition. Addison-Wesley, 2005. ISBN<br />
0-321-24678-0 (see also online edition of the specification (http:/ / java. sun. com/ docs/ books/ jls/ third_edition/ html/ j3TOC. html)).<br />
[5] "Java memory leaks -- Catch me if you can" (http:/ / www-128. ibm. com/ developerworks/ rational/ library/ 05/ 0816_GuptaPalanki/ ) by<br />
Satish Chandra Gupta, Rajeev Palanki, IBM DeveloperWorks, 16 Aug 2005<br />
[6] Boost type traits library (http:/ / www. boost. org/ libs/ type_traits/ doc/ html/ boost_typetraits/ reference. html)<br />
[7] "Microbenchmarking C++, C# and Java" (http:/ / www. ddj. com/ 184401976) by Thomas Bruckschlegel, Dr. Dobbs, June 17, 2005<br />
[8] "Performance of Java versus C++" (http:/ / scribblethink. org/ Computer/ javaCbenchmark. html) by J.P. Lewis and Ulrich Neuman, USC,<br />
Jan. 2003 (updated 2004)<br />
[9] "Java will be faster than C++" (http:/ / trs-new. jpl. nasa. gov/ dspace/ bitstream/ 2014/ 18351/ 1/ 99-1827. pdf) by Kirk Reinholtz, JPL, Apr<br />
2001<br />
[10] http:/ / www. ibm. com/ developerworks/ java/ library/ j-jtp02225. html#2. 0<br />
[11] http:/ / www. irrlicht3d. org/ pivot/ entry. php?id=446<br />
[12] "Java (not really faster) than C++ benchmark (http:/ / bruscy. republika. pl/ pages/ przemek/ java_not_really_faster_than_cpp. html)<br />
illustrates<br />
[13] http:/ / www. jelovic. com/ articles/ why_java_is_slow. htm<br />
[14] http:/ / warp. povusers. org/ grrr/ java. html<br />
[15] . p. 18. page.mi.fu-berlin.de/prechelt/Biblio//jccpprtTR.pdf.<br />
[16] Clark, Nathan; Amir Hormati, Sami Yehia, Scott Mahlke (2007). "Liquid SIMD: Abstracting SIMD hardware using lightweight dynamic<br />
mapping". HPCA’07: 216–227.<br />
[17] http:/ / cellperformance. beyond3d. com/ articles/ 2006/ 06/ understanding-strict-aliasing. html<br />
[18] Demystifying the Restrict Keyword (http:/ / www. cellperformance. com/ mike_acton/ 2006/ 05/ demystifying_the_restrict_keyw. html)<br />
[19] www.slac.stanford.edu/comp/unix/.../icc/.../optaps_dsp_qax.htm Targeting IA-32 Architecture Processors for Run-time Performance<br />
Checking<br />
[20] Bjarne Stroustrup's FAQ: Do you own C++? (http:/ / www. research. att. com/ ~bs/ bs_faq. html#revenues)<br />
[21] ZDNet: Oracle buys Sun; Now owns Java (http:/ / blogs. zdnet. com/ BTL/ ?p=16598).<br />
[22] http:/ / task3. cc/ 289/ object-oriented-memory-management<br />
[23] http:/ / www. ora. com/ catalog/ javanut/ excerpt/ index. html#except<br />
[24] http:/ / www. fatalmind. com/ papers/ java_vs_cplusplus/ resource. html<br />
[25] http:/ / www. azulsystems. com/ blog/ cliff-click/ 2009-09-06-java-vs-c-performanceagain
Comparison of the Java and .NET platforms 93<br />
Comparison of the Java and .NET platforms<br />
Legal issues<br />
Standardization<br />
The two platforms, their programming libraries, their binary formats, and their runtime environments have largely<br />
been governed by very different means.<br />
International standards organizations Ecma International and ISO/IEC define the standard for the .NET executable<br />
environment (known as the Common Language Infrastructure, or CLI), and .NET executable format (known as<br />
Common Intermediate Language, or CIL), but excluding most of the foundation classes (the Base Class Library, or<br />
BCL). This formal committee-based standardization process is in keeping with the way very popular languages like<br />
COBOL, Fortran and C have been standardized in the past. The standards do not include many new libraries that<br />
Microsoft has implemented on top of the standard framework, such as those for accessing databases, or building GUI<br />
and Web applications, such as Windows Forms, ASP.NET and ADO.NET.<br />
To date, no part of Java has been standardized by Ecma International, ISO/IEC, ANSI, or any other third-party<br />
standards organization. While Sun Microsystems has unlimited and exclusive legal rights to modify and license its<br />
Java trademarks, Sun voluntarily participates in a process called the Java Community Process (JCP) that allows<br />
interested parties to propose changes to any of Sun's Java technologies (from language and tools to API) via forums,<br />
consultation exercises and expert groups. The JCP requires a membership fee for commercial contributors, while<br />
non-commercial contributors and individuals can join for free.<br />
Within the rules of the JCP anyone can bring forward a proposal for a new Platform Edition Specifications or<br />
suggest changes to the Java language. All proposals are reviewed and voted on by interested JCP members at various<br />
stages throughout their lifecycle, however when it comes to including changes into the standard reference<br />
implementations (Java SE, Java EE and Java ME) modifications may be subject to rejection by Sun, who retain<br />
ultimate power of veto.<br />
Java standards are maintained by a suite of test applications which examine every aspect of a given Java<br />
implementation against a rigorous specification. Only if an implementation passes the tens of thousands of individual<br />
tests can it use the trademarked name "Java", and associated logos and brands.<br />
License<br />
Java<br />
While "Java" is a Sun trademark, and only Sun can license the name "Java", numerous free software projects exist<br />
that are compatible with Sun Java. Most notably, GNU Classpath and GCJ provide a free software class library and a<br />
compiler that are partially compatible with the current version of Sun Java. [1] Sun announced in November 13, 2006<br />
that all Java source code, excluding closed-source code for which they do not retain rights, will be released under a<br />
modified version of the GPL, [2] and released two fundamental parts of the JRE and JDK: HotSpot and the javac<br />
[3] [4]<br />
compiler under the GPL.<br />
Following their promise, Sun released the complete source code of the Class library under GPL on May 8, 2007,<br />
except some limited parts that were licensed by Sun from 3rd parties who did not want their code to be released<br />
under an open-source license [5] (see also Free Java implementations). Sun's goal is to replace the parts that remain<br />
closed with alternative implementations and make the class library completely open.<br />
In June 2008, Red Hat announced [6] that the IcedTea project has passed the rigorous Java TCK, indicating a fully<br />
functional open-source implementation of the Java platform.
Comparison of the Java and .NET platforms 94<br />
.NET<br />
Microsoft's .NET CLI executable environment, and some of the corresponding class library, have been<br />
standardized and can be freely implemented without a license. A few standards-compliant free software<br />
environments have been implemented, such as the Mono Project and DotGNU. The Mono Project has also<br />
implemented many of Microsoft's non-standard libraries by examining Microsoft materials, similar to GNU<br />
Classpath and Java.<br />
Microsoft is currently distributing a shared source version of its .NET runtime environment for academic use,<br />
however it is only supported on Windows XP SP2 and has not been updated after .NET 2.0. [7]<br />
The Mono project aims to avoid infringing on any patents or copyrights, and to the extent that they are successful,<br />
the project can be safely distributed and used under the GPL. On November 2, 2006, Microsoft and Novell<br />
announced a joint agreement whereby Microsoft promised not to sue Novell or its customers for patent<br />
infringement. [8] According to a statement on the blog of Mono project leader Miguel de Icaza, this agreement only<br />
extends to Mono for Novell developers and users. [9] Because of the possible threat of Microsoft patents, the FSF<br />
[10] [11]<br />
recommends that people avoid creating software that depends on Mono or C#.<br />
The Microsoft/Novell agreement was criticized by some in the open source community because it violates the<br />
principles of giving equal rights to all users of a particular program (see Agreement with Microsoft and Mono and<br />
Microsoft's patents).<br />
In response to the Microsoft/Novell agreement the Free Software Foundation revised its GNU General Public<br />
License to close the loophole used by Microsoft and Novell to bypass the GPL's very restrictive provisions on patent<br />
deals. [12] The FSF also stated that by selling coupons for Novell's Linux software, the mechanism by which<br />
Microsoft circumvented the GNU license, it considers Microsoft to be a Linux vendor, and thereby subject to the full<br />
terms and conditions laid out in the GPL. [12] (Microsoft issued the coupons because on the patent deal worked out<br />
between the two companies Novell's network patents were considered far more profitable to Microsoft than<br />
Microsoft's .NET patents were to Novell.)<br />
Community<br />
In its proprietorship of Java, Sun works with an open culture, allowing multiple parties, from organizations to<br />
individuals, to steer the decision making process. Sun retains exclusive and unlimited legal rights to its Java<br />
intellectual properties, and the Java community is subject to those rights.<br />
Sun's acceptance of third-party contributions goes to solve the problem of vendor lock-in at the cost of sometimes<br />
creating a baffling array of options for beginners wishing to choose a Java-based solution. Java has grown in<br />
popularity to become one of the most popular languages of the early 21st century, and the pluralist nature of its<br />
development has resulted in many different groups tackling the same (or similar) problems. This issue is particularly<br />
acute in the Enterprise space (web/Ajax/Web2.0 applications), where one must not only be familiar with Java, but<br />
also the various competing frameworks.<br />
While Microsoft has developed C# and .NET without a formal community contribution system, the language and<br />
some parts of the executable format and runtime have been standardized and freely distributed through Ecma and<br />
ISO in an open and vendor-neutral process, rather than a process that retains veto and copy rights for Microsoft.<br />
However, the standards do not include many new libraries that Microsoft has implemented on top of the standard<br />
framework (see Standardization). Numerous C# and CLI community software projects, help and documentation<br />
sites, and discussion forums are under active development and maintenance, including those focusing on Windows<br />
development with Microsoft .NET or the Mono project, Free software Operating system development under the<br />
Mono project, and mobile development using Microsoft's .NET compact framework..<br />
Microsoft is distributing a shared source release (version 1.0) of the .NET virtual machine that can be compiled and<br />
used on Windows, FreeBSD, Mac OS X, and other platforms. [13] An updated version (2.0) is currently available, but
Comparison of the Java and .NET platforms 95<br />
the only officially supported platform is Windows. [14] A community port to Linux of the 1.0 shared source .NET<br />
virtual machine is also available. [15] In March 2003, O'Reilly Media published a book about Microsoft's shared<br />
source .NET runtime. [16]<br />
Traditional computer applications<br />
Desktop applications<br />
Although Java's AWT (Abstract Windowing Toolkit) and Swing libraries are not shy of features, Java has struggled<br />
to establish a foothold in the desktop market. Sun Microsystems has also been slow, in the eyes of some, to promote<br />
Java to developers and end users alike in a way which makes it an appealing choice for desktop software. Even<br />
technologies such as Java Web Start, which have few parallels within rival languages and platforms, have barely<br />
been promoted.<br />
The release of Java version 6.0 in December 11, 2006, saw a renewed focus on the desktop market with an extensive<br />
set of new tools for closer integration with the desktop. At the 2007 JavaOne conference Sun made further desktop<br />
related announcements, including a new language aimed at taking on Adobe Flash (JavaFX), a new lightweight way<br />
of downloading the JRE which sees the initial footprint reduced to under 2Mb, and a renewed focus on multimedia<br />
libraries.<br />
An alternative to AWT and Swing is the Standard Widget Toolkit (SWT), which was originally developed by IBM<br />
and now maintained by the Eclipse Foundation. It attempts to achieve improved performance and visualization of<br />
Java desktop applications by relying on underlying native libraries where possible.<br />
.NET is becoming more common in open source and free software systems due to its inclusion [17] by the GNOME<br />
desktop environment using the Mono framework.<br />
Server applications<br />
This is probably the arena in which the two platforms are closest to being considered rivals. Java, through its Java<br />
EE (a.k.a. Java Platform Enterprise Edition) platform, and .NET through ASP.NET, compete to create web-based<br />
dynamic content and applications.<br />
Both platforms are well used and supported in this market, with a bevy of tools and supporting products available for<br />
Java EE and .NET. And both have high profile backers. For example, for Java: Oracle included direct support for<br />
Java into its database, while Google has used Java to power tools like Gmail. [18]<br />
Some of Sun's current Java-related license agreements for Java EE define aspects of the Java platform as a trade<br />
secret, [19] and prohibit the end user from contributing to a third-party Java environment. Specifically, at least one<br />
current license for a Sun Java EE development package contains the following terms: "You may make a single<br />
archival copy of Software, but otherwise may not copy, modify, or distribute Software." — "Unless enforcement is<br />
prohibited by applicable law, you may not decompile, or reverse engineer Software." — "You may not publish or<br />
provide the results of any benchmark or comparison tests run on Software to any third party without the prior<br />
written consent of Sun." — "Software is confidential and copyrighted." [19] However, while Sun's software is subject<br />
to the above license terms, Sun's Java EE API reference has been implemented under an open source license by the<br />
JBoss and JOnAS projects.<br />
Microsoft's implementation of ASP.NET is not part of the standardized CLI, and while Microsoft's runtime<br />
environment and development tools are not subject to comparable secrecy agreements to Java EE, the official<br />
Microsoft tools are not open source or free software, and require Windows servers. However, a cross-platform free<br />
software ASP.NET 2.0 implementation is part of the Mono project (minus webparts and Web Services<br />
Enhancements). [20]
Comparison of the Java and .NET platforms 96<br />
Embedded applications<br />
Mobile applications<br />
Java ME has a very large base within the mobile phone and PDA markets, with only the cheapest devices now<br />
devoid of a KVM (a cut down Java Virtual Machine for use on devices with limited processing power). Java<br />
software, including many games, is commonplace.<br />
While almost every mobile phone includes a JVM, these features are not always heavily used by users (particularly<br />
in North America). Initially Java applications on most phones typically consisted of menuing systems, small games,<br />
or systems to download ringtones etc. However, more powerful phones are increasingly being sold with simple<br />
applications pre-loaded, such as translation dictionaries, world clock displays (darkness/light, timezones, etc.) and<br />
calculators. Some of these are written in Java, although how often phone owners actually use them is probably<br />
unknown.<br />
In January 2007 Steve Jobs suggested that Apple's iPhone would not support Java. [21] [22] Significantly, at that time<br />
Java's mobile platform was perceived as nearly ubiquitous across the cell phone market, commonly being used by<br />
software companies to write device-neutral mobile applications. Noted commentators argued against Jobs' stand, [23]<br />
but when the iPhone finally appeared it did indeed lack both Java and Adobe's rival Flash technology, favoring<br />
instead simple web applications using the phone's Safari browser.<br />
In May 2007 Sun used the JavaOne conference to announce JavaFX Mobile, as a direct response to Adobe's attempt<br />
to introduce Flash onto mobile devices.<br />
In October 2007 Apple bowed to pressure and announced that by early 2008 the iPhone would be opened up to allow<br />
development of software other than via the Safari browser. Neither Java nor Flash is supported under this plan, and<br />
Apple does not allow interpreters for any language to run on the phone.<br />
Home entertainment technologies<br />
Java has found a market in digital television, where it can be used to provide software which sits alongside<br />
programming, or extends the capabilities of a given Set Top Box. TiVo, for example, has a facility called "Home<br />
Media Engine", which allows JavaTV software to be transmitted to an appropriate TiVo device to complement<br />
programming or provide extra functionality (for example, personalized stock tickers on a business news program.)<br />
A variant of Java has been accepted as the official software tool for use on the next generation optical disc<br />
technology Blu-ray, via the BD-J interactive platform. This will mean that interactive content, such as menus, games,<br />
downloadables, etc. on all Blu-ray optical discs will be created under a variant of the Java platform. Blu-ray<br />
equipment first went on sale to the consumer in 2006, and is currently not widely owned. However, the release of the<br />
Sony PlayStation 3 in late 2006 and early 2007 may give the platform a boost.<br />
Rather than using Java, HD DVD (the defunct high definition successor to DVD) uses a technology jointly<br />
developed by Microsoft and Disney called HDi that is based on XML, CSS, JavaScript, and other technologies that<br />
are comparable to those used by standard web browsers.<br />
The BD-J platform API is more extensive than its iHD rival, with an alleged 8,000 methods and interfaces, as<br />
opposed to iHD's 400. [24] And while Microsoft is pushing iHD's XML presentation layer by including it with<br />
Windows Vista, iHD is still a newcomer in a market sector where Java technologies are already commonplace. [25]<br />
However, the fact that the HD DVD format has been abandoned in favor of Blu-ray means that HDi is no longer<br />
supported on any Optical disc format, making the BD-J format a clear winner. [26]
Comparison of the Java and .NET platforms 97<br />
Runtime inclusion in operating systems<br />
.NET/Mono<br />
On Windows, Microsoft is promoting .NET as its flagship development platform, [27] by including the .NET runtime<br />
in Windows XP Service Pack 2 and 3, Windows Server 2003, Windows Vista, Windows Server 2008 and Windows<br />
7. Microsoft also distributes the Visual C# Express development environment at no cost. [28]<br />
.NET Framework 3.5 runtime is not pre-installed on versions of Windows prior to Vista SP1, and must be<br />
[29] [30]<br />
downloaded by the user, which has been criticized because of its large size (65 MB download for .NET 3.5).<br />
While neither .NET nor Mono are installed with Mac OS X out-of-the-box, the Mono project can be downloaded and<br />
installed separately, for free, for any Mac user who wants to build and/or run C# and .NET software. As of 13 May<br />
2008, Mono's System.Windows.Forms 2.0 is API complete (contains 100% of classes, methods etc. in Microsoft's<br />
System.Windows.Forms 2.0); also System.Windows.Forms 2.0 works natively on Mac OS X.<br />
C# and the CLI are included and used in a number of Linux and BSD based operating systems by way of including<br />
[31] [32] [33]<br />
the free software Mono Project.<br />
As a result of inclusion of .NET or Mono runtimes in the distributions of Windows and Linux, non-GUI applications<br />
that utilize the programming interfaces that are common to both .NET and Mono can be developed in C# or any<br />
other .NET language and then deployed across many operating systems and processor architectures using a runtime<br />
environment that is available as a part of the operating system's installation. [34] [35] [36] Both Microsoft .NET and the<br />
Mono project have complete support for the Ecma- and ISO-standardized C# language and .NET runtime, and many<br />
of Microsoft's non-standardized .NET programming interfaces have been implemented or are under development in<br />
Mono, [37] but each environment includes many components that have not been implemented in the other.<br />
Java<br />
Starting with XP SP1a, Windows does not ship with a Java runtime environment. However according to a September<br />
2003 press release some OEMs agreed to pre-install the JRE on their desktop and laptop models. Mentioned were<br />
Acer, Dell, Gateway, Hewlett-Packard, and Toshiba. [38] These companies combined make up a simple majority of<br />
consumer PC's sold in the United States of America. [39]<br />
Java comes pre-installed on all new Apple computers since Mac OS X 10.0. Because Apple maintains the Java<br />
runtime for Mac OS X, updates are usually one or two versions behind the versions available from Sun for the other<br />
operating systems, and versions of Java are usually tied to the specific operating system version, so newer Java<br />
versions are usually unavailable for older versions of OS X.<br />
Java comes pre-installed with many commercial Unix flavors, including those from Sun, IBM and Hewlett Packard.<br />
As of June 2009, the Fedora 9, [40] Ubuntu 8.04, [41] Debian, [42] Slackware extra, [43] Mandriva [44] and OpenSUSE [45]<br />
distributions are available with OpenJDK, based completely on free and open source code. [46] Since June 2008,<br />
OpenJDK passed all of the compatibility tests in the Java SE 6 JCK and can claim to be a fully compatible Java 6<br />
implementation. [47] [48] OpenJDK can run complex applications such as Netbeans, Eclipse, GlassFish, or JBoss.<br />
The Operating System Distributor License for Java (DLJ) [49] is a Sun initiative to ease distribution issues with<br />
operating systems based on OpenSolaris or Linux.<br />
If Java is not installed on a computer by default, it may be downloaded by the user as a web plugin. The web plugin<br />
process has been criticized because of the size of the Java plugin. Unlike other plugins the Java download is a full<br />
runtime environment, capable of running not just applets, but full applications and dynamic WebStart apps. Because<br />
of this the perceived download footprint is larger than some web plugins. However, compared to Java, other popular<br />
browser plugins have larger sizes: Java 6 JRE is 13 MB, but Acrobat Reader is 33 MB, QuickTime 19 MB,<br />
Windows Media Player 25 MB, the .NET Framework 3.0 runtime is 54 MB, and the .NET Framework 3.5 runtime is<br />
197 MB (it's a united package for x86, x64 and IA-64, each part has approximately 60 MB).
Comparison of the Java and .NET platforms 98<br />
At the JavaOne event in May 2007 Sun announced that the deployment issues with Java would be solved in two<br />
major updates during the lifespan of Java 6 (the changes will not be held over to Java 7.) These include:<br />
• the introduction of a new consumer JRE edition, with an initial 2Mb footprint and the ability to download the<br />
remaining 9Mb in sections using an on-demand methodology.<br />
• the development of drop-in cross platform JavaScript code, which can be used from a web page to install the<br />
necessary JRE for a given applet or Rich Internet Application to run, if necessary.<br />
• an improvement in support for automatically downloading updates to the JRE.<br />
• support for pre-loading of the JRE, so applets and applications written in Java start up almost instantaneously.<br />
See also<br />
• Comparison of Java and C# languages<br />
• Java programming language<br />
• C#<br />
External links<br />
• ECMA-335 Common Language Infrastructure (CLI), 4th edition (June 2006) [50] Free download of Ecma CLI<br />
standard<br />
• ISO/IEC 23271:2006 Common Language Infrastructure (CLI) Partitions I to VI [51] The official ISO/IEC CLI<br />
standard<br />
References<br />
[1] Results of comparison between jdk15 and classpath (http:/ / www. kaffe. org/ ~stuart/ japi/ htmlout/ h-jdk15-classpath)<br />
[2] Free and Open Source Java - Project Overview (http:/ / www. sun. com/ software/ opensource/ java/ project_overview. jsp)<br />
[3] Sun openjdk: Home (http:/ / openjdk. java. net/ )<br />
[4] Sun Java 2 Runtime License Agreement (http:/ / java. sun. com/ j2se/ 1. 4. 2/ j2re-1_4_2_13-license. txt)<br />
[5] "Open JDK is here!" (http:/ / mail. openjdk. java. net/ pipermail/ announce/ 2007-May. txt). Sun Microsystems. 2007-05-08. . Retrieved<br />
2007-05-09.<br />
[6] Java Finally Free and Open (http:/ / truthhappens. redhatmagazine. com/ 2008/ 06/ 19/ java-finally-free-and-open/ )<br />
[7] Rotor: Shared Source CLI Provides Source Code for a FreeBSD Implementation of .NET (http:/ / msdn. microsoft. com/ msdnmag/ issues/<br />
02/ 07/ SharedSourceCLI/ )<br />
[8] Microsoft and Novell Announce Broad Collaboration on Windows and Linux Interoperability and Support (http:/ / www. novell. com/ news/<br />
press/ item. jsp?id=1196)<br />
[9] "Statement on the blog of Mono project leader Miguel de Icaza regarding patent protection for Mono" (http:/ / tirania. org/ blog/ archive/<br />
2006/ Nov-04. html). 2006-11-04. . Retrieved 2006-11-06.<br />
[10] Stallman, Richard (2009-06-26). "Why free software shouldn't depend on Mono or C#" (http:/ / www. fsf. org/ news/<br />
dont-depend-on-mono). Free Software Foundation. . Retrieved 2009-07-02. "We should systematically arrange to depend on the free C#<br />
implementations as little as possible. In other words, we should discourage people from writing programs in C#. Therefore, we should not<br />
include C# implementations in the default installation of GNU/Linux distributions, and we should distribute and recommend non-C#<br />
applications rather than comparable C# applications whenever possible."<br />
[11] "Microsoft's Empty Promise" (http:/ / www. fsf. org/ news/ 2009-07-mscp-mono). Free Software Foundation. 2009-07-16. . Retrieved<br />
2009-078-03. "Until that happens, free software developers still should not write software that depends on Mono. C# implementations can still<br />
be attacked by Microsoft's patents: the Community Promise is designed to give the company several outs if it wants them. We don't want to see<br />
developers' hard work lost to the community if we lose the ability to use Mono, and until we eliminate software patents altogether, using<br />
another language is the best way to prevent that from happening."<br />
[12] Microsoft takes on the free world. (http:/ / money. cnn. com/ magazines/ fortune/ fortune_archive/ 2007/ 05/ 28/ 100033867/ index. htm)<br />
[13] Shared Source Common Language Infrastructure 1.0 Release (http:/ / www. microsoft. com/ downloads/ details.<br />
aspx?FamilyId=3A1C93FA-7462-47D0-8E56-8DD34C6292F0& displaylang=en)<br />
[14] Shared Source Common Language Infrastructure 2.0 Release (http:/ / www. microsoft. com/ downloads/ details.<br />
aspx?familyid=8c09fd61-3f26-4555-ae17-3121b4f51d4d& displaylang=en)<br />
[15] Rotor Comes to Linux (http:/ / www. ondotnet. com/ pub/ a/ dotnet/ 2002/ 07/ 01/ rotorlinux. html)<br />
[16] oreilly.com -- Online Catalog: Shared Source CLI Essentials (http:/ / www. oreilly. com/ catalog/ sscliess/ )<br />
[17] Mono-Applications-Aplenty!, OSNews (http:/ / www. osnews. com/ story. php/ 9780/ Mono-Applications-Aplenty!)
Comparison of the Java and .NET platforms 99<br />
[18] Google Web Toolkit (http:/ / code. google. com/ webtoolkit/ )<br />
[19] Java EE SDK 5 Update 2 No JDK download page (reference to license agreement) (http:/ / javashoplm. sun. com/ ECom/ docs/ Welcome.<br />
jsp?StoreId=22& PartDetailId=java_ee_sdk-5_02-nojdk-oth-JPR& SiteId=JSC& TransactionId=noreg)<br />
[20] Mono: ASP.NET (http:/ / www. mono-project. com/ ASP. NET)<br />
[21] Jobs: No Java for you (http:/ / blogs. zdnet. com/ Burnette/ ?p=238)<br />
[22] Steve Jobs on iPhone: No Java For You (http:/ / www. javalobby. org/ java/ forums/ t88464. html)<br />
[23] Steve Jobs alert: Killer Java app for iPhone (http:/ / scobleizer. com/ 2007/ 03/ 20/ steve-jobs-alert-killer-java-app-for-iphone/ )<br />
[24] HD-DVD vs. Blu-Ray, round 2 (http:/ / blogs. zdnet. com/ carroll/ index. php?p=1583)<br />
[25] Format Wars - Blu-ray vs HD DVD (http:/ / www. pcauthority. com. au/ print. aspx?CIID=60242& SIID=)<br />
[26] Zaharov-Reutt, Alex (2008-02-21). "Microsoft's HDi interactivity layer loses from HD DVD's death - but does it matter?" (http:/ / www.<br />
itwire. com/ content/ view/ 16780/ 1154/ 1/ 0/ ). itwire.com. . Retrieved 2008-08-27. "While many claimed that creating interactivity with HDi<br />
was much simpler than using BD-J, the fact that HD DVD will see few future releases beyond 2008 means that, whatever the enthusiasts<br />
position on the relative merits of HDi vs BD-J, the BD-J interactivity format is now the winner"<br />
[27] Microsoft article that refers to C# as its "flagship" language. (http:/ / www. microsoft. com/ learning/ books/ developer/ feature/ 050301.<br />
mspx)<br />
[28] microsoft.com: Visual C# (http:/ / msdn. microsoft. com/ vstudio/ express/ visualcsharp/ )<br />
[29] "Dear Microsoft" (http:/ / channel9. msdn. com/ ShowPost. aspx?PageIndex=1& PostID=370737#370737). 2008-01-09. . Retrieved<br />
2008-02-03.<br />
[30] ".Net framework 3.5 size 166MB!" (http:/ / www. codeprof. com/ dev-archive/ 179/ 12-1020-1798773. shtm). 2007-11-10. . Retrieved<br />
2008-02-03.<br />
[31] Fedora embraces Mono - ZDNet UK (http:/ / news. zdnet. co. uk/ software/ 0,1000000121,39246774,00. htm)<br />
[32] Debian Mono Packages (http:/ / packages. debian. org/ mono)<br />
[33] Wikipedia Uses Mono; Mono Integrated into Ubuntu/Debian - OSNews.com (http:/ / www. osnews. com/ story. php?news_id=10714)<br />
[34] Fedora Catches Mono (http:/ / www. desktoplinux. com/ news/ NS2809897659. html)<br />
[35] SUSE 10.1 released (http:/ / www. mono-project. com/ news/ archive/ 2006/ May-11-1. html)<br />
[36] Wikipedia Uses Mono; Mono Integrated into Ubuntu/Debian (http:/ / www. osnews. com/ story. php/ 10714/<br />
Wikipedia-Uses-Mono-Mono-Integrated-into-UbuntuDebian)<br />
[37] "Mono – Plans" (http:/ / www. mono-project. com/ Plans). . Retrieved 2008-12-23.<br />
[38] Sun signs up five more OEMs for Java (http:/ / www. infoworld. com/ article/ 03/ 09/ 23/ HNsunoems_1. html)<br />
[39] "Digitimes.com" (http:/ / www. digitimes. com/ systems/ a20070420PR208. html). . Available only for paid subscribers.<br />
[40] Wade, Karsten (2008-03-13). "OpenJDK in Fedora 9!" (http:/ / developer. redhatmagazine. com/ 2008/ 03/ 12/<br />
openjdk-to-replace-icedtea-in-fedora-9/ ). redhatmagazine.com. . Retrieved 2008-04-05. "Thomas Fitzsimmons updated the Fedora 9 release<br />
notes source pages to reflect that Fedora 9 would ship with OpenJDK 6 instead of the IcedTea implementation of OpenJDK 7. Fedora 9<br />
(Sulphur) is due to release in May 2008."<br />
[41] "openjdk-6 in Ubuntu" (https:/ / launchpad. net/ ubuntu/ + source/ openjdk-6). . Retrieved 2008-04-19.<br />
[42] "Package: openjdk-6-jdk" (http:/ / packages. debian. org/ stable/ openjdk-6-jdk). debian.org. 2009-02-14. . Retrieved 2009-02-16.<br />
[43] Slackware Java package (http:/ / packages. slackware. it/ package. php?q=current/ jdk-6-i586-1)<br />
[44] Mandriva Java package (http:/ / qa. mandriva. com/ twiki/ bin/ view/ Main/ JavaPackaging#Compati)<br />
[45] "Package: OpenJDK" (http:/ / en. opensuse. org/ OpenJDK). opensuse.org. . Retrieved 2009-06-01.<br />
[46] Reinhold, Mark (2008-04-24). "There's not a moment to lose!" (http:/ / blogs. sun. com/ mr/ entry/ in_hardy_heron). . Retrieved 2008-04-19.<br />
[47] Sharples, Rich (2008-06-19). "Java is finally Free and Open" (http:/ / blog. softwhere. org/ archives/ 196). .<br />
[48] Angel, Lillian (2008-03-13). "OpenJDK to replace IcedTea in Fedora 9" (http:/ / langel. wordpress. com/ 2008/ 03/ 13/ openjdk-in-fedora-9/<br />
). . Retrieved 2008-04-05.<br />
[49] Operating System Distributor License for Java (DLJ) (https:/ / jdk-distros. dev. java. net/ )<br />
[50] http:/ / www. ecma-international. org/ publications/ standards/ ecma-335. htm<br />
[51] http:/ / www. iso. org/ iso/ iso_catalogue/ catalogue_tc/ catalogue_detail. htm?csnumber=42927
Constant interface 100<br />
Constant interface<br />
In the Java programming language, the constant interface pattern describes the use of an interface solely to define<br />
constants, and having classes implement that interface in order to achieve convenient syntactic access to those<br />
constants. However, since the usage of constants is an implementation detail, it is considered inappropriate to define<br />
an interface for this purpose. [1] [2] In general, collecting system constants into classes independent of behaviour,<br />
might create a poor object-oriented design, because it is often a sign of low cohesion. It is for these reasons that<br />
implementing constants interfaces is considered to be an anti-pattern.<br />
Use of this anti-pattern has a few other downsides:<br />
1. It pollutes the class namespace with read-only variables that may not be of use.<br />
2. Contrary to the compile-time tactical utility of implementing a constants interface, the incidental run-time<br />
artifacts have little practical purpose (cf. marker interfaces which also have no methods but are useful at<br />
run-time).<br />
3. If binary code compatibility is required in future releases, the constants interface must remain forever an interface<br />
(it cannot be converted into a class), even though it has not been used as an interface in the conventional sense.<br />
4. Without an IDE that resolves where the constant are coming from, tracking it back to its containing class or<br />
interface can be time consuming.<br />
5. A variable (representing an instance) of the interface is syntactically no more useful than the interface name itself<br />
(since it has no methods).<br />
Example<br />
public interface Constants {<br />
}<br />
public static final double PI = 3.14159;<br />
public static final double PLANCK_CONSTANT = 6.62606896e-34;<br />
public class Calculations implements Constants {<br />
}<br />
public double getReducedPlanckConstant() {<br />
}<br />
Alternatives<br />
return PLANCK_CONSTANT / (2 * PI);<br />
Many of the pitfalls of the anti-pattern can be avoided by converting the constants interface to a proper class with no<br />
instances:<br />
public final class Constants {<br />
private Constants() {<br />
}<br />
// restrict instantiation<br />
public static final double PI = 3.14159;
Constant interface 101<br />
}<br />
public static final double PLANCK_CONSTANT = 6.62606896e-34;<br />
This still leaves the original intent of the pattern mostly un-addressed (i.e. there is no syntax for accessing the<br />
constants unqualified). However, since Java 5, consider using static import [2] to achieve the same goal:<br />
import static Constants.PLANCK_CONSTANT;<br />
import static Constants.PI;<br />
public class Calculations {<br />
}<br />
public double getReducedPlanckConstant() {<br />
}<br />
return PLANCK_CONSTANT / (2 * PI);<br />
To varying degrees, the issues listed above have now been addressed:<br />
1. Because static members can be imported specifically, the class namespace need not be polluted with all members<br />
of the constants interface.<br />
2. Run-time and compile-time semantics are more closely aligned when using static imports instead of constants<br />
interfaces.<br />
3. The compiled code has one less binary compatibility constraint (that "class Calculations implements Constants").<br />
4. Because static imports apply only to the current file (and not the whole class hierarchy) it is easier to discover<br />
where each static member is declared.<br />
5. There is less need to declare variables of the constants interface type, and it is potentially clearer that no concrete<br />
instances actually exist.<br />
Note however, the changes do nothing to improve the cohesion of the Constants class, so static imports should not be<br />
considered to be a panacea.<br />
References<br />
[1] Bloch, Joshua, Effective Java, 2nd Edition, p. 98<br />
[2] Sun Microsystems, Inc. (2004). "Static Import" (http:/ / java. sun. com/ j2se/ 1. 5. 0/ docs/ guide/ language/ static-import. html).
Java 4K Game Programming Contest 102<br />
Java 4K Game Programming Contest<br />
The Java 4K Game Programming Contest (aka 'Java 4K' and 'J4K') is an informal contest that was started by the<br />
Java Game Programming community to challenge their software development abilities. The goal of the contest is to<br />
develop the best game possible within four kilobytes (4096 bytes) of data. While the rules originally allowed for<br />
nearly any distribution method, recent years have required that the games be packaged as either an executable JAR<br />
file, a Java Webstart application, or a Java Applet.<br />
History<br />
The Java 4K Game Programming Contest came into being on August 28, 2002 when a user by the handle of<br />
codymanix posted the suggestion to the Sun Microsystems Java forums. After a bit of argument over how feasible a<br />
game would be in 4K, a user by the handle of mlk officially organized the contest on August 29, 2002.<br />
Slowly but surely, entries began to trickle in for the contest. The majority of these entries were Applets, as it was<br />
believed that separating the images from the class files would help reduce the size of the file. Future contests would<br />
see a reversal of this as game creators utilized compressed JAR files to reduce the size of their code.<br />
One of the most interesting points about the first contest was that non-game applications were allowed. One<br />
contestant produced a telnet server in 4K of Java! However, this artifact of the first competition did not survive, and<br />
was most likely allowed because of the loose handling of the first contest. While no winner was officially declared<br />
the first year, the 4K Racing game submitted by Robin Chaddock (aka Abuse/AbU5e) was generally agreed upon to<br />
have "won".<br />
Successive competitions became more and more organized, with many of the contestants pitching in to handle<br />
administration and promotion of the contest. All contests received official judging, with the method of judging being<br />
refined each year. By the third year, the contest was officially transitioned over to the JavaGaming.org forums. The<br />
fourth year saw the introduction of the JavaUnlimited website as the official repository for the contest. The site had<br />
been used the previous year to track entries that had been posted to the official threads on JavaGaming.org and<br />
forum.java.sun.com.<br />
Tradeoffs<br />
Because the Java class file format incurs quite a bit of overhead, creating a complete game in 4K can be quite a<br />
challenge. As a result, contestants must choose how much of their byte budget they wish to spend on graphics,<br />
sound, and gameplay. Finding the best mix of these factors can be extremely difficult. Many new entrants believe<br />
that impressive graphics alone are enough to carry a game. However, entries with more modest graphics and focus<br />
on gameplay have regularly scored higher than such technology demonstrations.<br />
Prizes<br />
When first conceived, the "prize" for winning the contest was a bundle of "Duke Dollars", a virtual currency used on<br />
Sun Microsystems' Java forums. This currency could theoretically be redeemed for physical prizes such as watches<br />
and pens. Unfortunately, the artificial currency was being downplayed by the introduction of the 4K contest, thus<br />
leaving no real prize at all.<br />
While there has been some discussion of providing prizes for the contest, it has continued to thrive without them.<br />
Most entrants seem to feel content to compete with their peers in a challenge of skill and ability. The reward has<br />
been nothing more than praise from those who play the games.
Java 4K Game Programming Contest 103<br />
Reasons for success<br />
While there has been a great deal of debate on why the Java 4K contest is so successful, the consensus from the<br />
contestants seems to be that it provides a very appealing challenge. Not only do the entrants get the chance to show<br />
off how much they know about Java programming, but the 4K size helps "even the odds" compared to other<br />
competitions where the use of artists and musicians can easily place an entry far ahead of the others.<br />
This may explain why spinoff contests targeting 8K, 16K, or a specific API like LWJGL have never taken off. In<br />
fact, the contestants seem to believe that 4K is the "sweet spot" that balances what an individual can do. Because of<br />
the tricks developed for the 4K contest, it's believed that adding even a single kilobyte would open the doors to far<br />
more complex games that are beyond the ability of a single developer.<br />
Year 2 (2004)<br />
Heavy use of pre-rendered sprites, transparency, and sound effects defined this year's entries. The strongest<br />
contenders were Defender 4000, Abuse's Shooty-Transparenty Game, and Space Invaders. However, Space Invaders'<br />
lack of sound caused it to fall behind the other two entries which were competing hard to pack in the most<br />
technology and gameplay.<br />
Of particular interest were the different tactics used by the two entries. For graphics, Abuse used precious few high<br />
color images which he then applied transparency and rotation to at runtime. Jbanes, on the other hand, developed an<br />
imaging packing technique that allowed him to store twenty-one single-color images. Rather than applying rotation<br />
and transparency, he chose to use his larger number of images to produce pre-rendered animations. For sound, Abuse<br />
used clear chimes and other instruments from the MIDI soundbank. Jbanes chose to use runtime-generated PCM<br />
sound that sounded more like video games of the late 1970s and early 1980s.<br />
Both approaches had their merit, so it's difficult to say what finally swayed the judge's opinion. What is known is<br />
that Year 2 was the last year that sound would be a deciding factor in the games. In future years, the bytes allocated<br />
to sound were reallocated to other functions such as 3D graphics, levels, and bosses.<br />
Year 2 was the first year that official judging took place. Unlike subsequent years, the only judge was the contest<br />
organizer, mlk. After careful consideration, the judge decided to award Prong with the Best Technical Achievement<br />
Award, and declared Defender 4000 as the overall winner. Interestingly, he scored each game but did not use this<br />
score in determining the winner. Abuse's Shooty-Transparenty Game actually scored one point higher than Defender<br />
4000.<br />
Official List of Year 2 Entries [1]<br />
Year 3 (2005)<br />
Year 3 was defined by a major influx of professional Java developers, 3D graphics in the games, and a gradual<br />
transition to the JavaGaming.org forums. JavaUnlimited also began mirroring the competitors in a permanent<br />
archive. While the mirror started as a manually edited HTML page, it eventually grew into a complete contest<br />
management site with a database back-end.<br />
Judging this year was handled by a panel of three volunteer, professional developers who were not participating in<br />
the contest. One of the volunteer judges was Chris Melissinos, Sun's Chief Gaming Officer. The scoring method<br />
used was based on the method that mlk had applied the previous year, but was updated to allow the judges to give<br />
awards for exceptional gameplay or technological achievements.<br />
While most of the entries were of exceptional quality, T4XI by Kevin Glass (aka kevglass) was chosen as the winner.<br />
Besides having extremely original gameplay, it provided exceptional graphics through a pseudo-3D effect that gave<br />
perspective to the buildings.
Java 4K Game Programming Contest 104<br />
A minor amount of controversy erupted due to entries that judges had failed to score. Entries like JM4K and<br />
IsOlation Net where either too complex for the judges to launch, or contained networking components that they<br />
couldn't test. After this year's competition, the rules were changed to require that games be self-executable. In<br />
addition, contestants were warned in advance about the difficulties in judging networked games.<br />
List of Games [2]<br />
List of Scores: (DHTML [3] ) (XLS [4] )<br />
Year 4 (2006)<br />
Year 4 marked a period of transition toward making gameplay a priority over graphics and technical<br />
accomplishment. Many of the games were fairly simple in design, but aimed to make up for it with engrossing or<br />
addictive gameplay.<br />
For the first time in the contest's history, a special forum was setup on JavaGaming.org to host the contest. In<br />
addition, the JavaUnlimited.net site became the official site for entries and judging. While judging was originally<br />
going to be handled through JavaUnlimited by the Javagaming.org community, pushback from several members<br />
resulted in falling back on a more traditional judging system.<br />
After the results came back, Miners4K by Markus_Persson was declared the winner. Second place was given to<br />
Kevin Glass's Roll4K, and third place was given to Goomba4K by Woogley.<br />
The results of Year 4's judging were significantly better than those of Year 3, in part due to the rule changes which<br />
forced the entries to conform to easily executable formats. However, this did not completely eliminate judging<br />
issues. Some controversy erupted when two entries (Xero and JSquares) were given lower scores due to technical<br />
glitches. Several recommendations were posed to prevent this from happening in future contests, including trimmed<br />
mean scoring and verification of judge's scoring before acceptance.<br />
List of Games & Results [5]<br />
Year 5 (2007)<br />
Year 5 launched in December 2006 and lasted until March 1, 2007. It saw some great games, with much less focus<br />
on 3D and pseudo-3D graphics. Most games were 2D, with Pipe Extreme and Trailblazer being the only notable<br />
exceptions (one could argue that a few others are 3D as well, but distinctly less so).<br />
Just like year 4, a forum was hosted on JavaGaming.org to host the contest. JavaUnlimited's system was used for<br />
hosting the games again, being considered the official site for the entries. A site update was planned for<br />
JavaUnlimited, but did not occur. Originally, the plan was to have a public vote and a judging panel. One month<br />
after the contest closing date the organizer without further explanation dropped the judging panel, which caused<br />
some unrest in the forums, accusations of censorship, locked threads and two participants withdrawing their entries<br />
from the contest (bringing the total down from 65 to 58) [6] . Voting was limited to javagaming.org forum<br />
participants, and within the alloted time, 25 people voted. About two months after the contest closing date, the<br />
official results were announced.<br />
The winner was Metro4k by Blaine Hodge, followed by Jojoh's Roadfourk and Ulf Ochsenfahrt's aichess4k. Metro4k<br />
is a Sim City-like city simulation game, Roadfourk a racing game, and aichess4k a chess game featuring an AI<br />
opponent.<br />
Unlike previous years, year 5 saw no game take the "last place", because the approval voting system used only gave<br />
votes to around half the games.<br />
• List of Games [7]<br />
• Results [8]
Java 4K Game Programming Contest 105<br />
Year 6 (2008)<br />
Year 6 launched in December 2007 and lasted until March 1, 2008. Notably less games were submitted than in 2006<br />
and 2007 - only 21 in total. Most of the games were 2d, with a total of 3 games using 3D or pseudo-3D graphics.<br />
The competition was hosted on a new website, Java4k.com [9] . Games from previous years can also be found on the<br />
new website. Before the launch of the contest, woogley had announced his withdrawal from arranging contest. The<br />
task of administrating the contest and hosting the site was therefore taken over by Arni Arent (appel) and Joakim<br />
Johnsson (jojoh). Just like previous years, there was also a dedicated forum [10] at JavaGaming.org [11] .<br />
The games were then thoroughly reviewed by five judges; Arni Arent, Joakim Johnsson, Kevin Glass, Matt Hicks<br />
and Chris Melissinos. They reviewed each game in three categories; Overall, Technical and Presentation. The results<br />
were announced on March 28, 2008.<br />
The top three games in each category are listed below.<br />
Overall Score<br />
1. Spiderball4k by Måns Olson<br />
2. Pinball 4K by Tom-Robert Bryntesen<br />
3. t4nks by Markus Persson<br />
Technical Score<br />
1. Z4rch by Simon<br />
2. Mini Golf by Tim Foden<br />
3. 'Pinball 4K by Tom-Robert Bryntesen<br />
Presentation Score<br />
1. t4nks by Markus Persson<br />
2. Spiderball4k by Måns Olson<br />
3. war4k by Michael Bliem<br />
• The results of the competition [12]<br />
• The judges' reviews of the games [13]<br />
• List of games [14]<br />
External links<br />
• Web Archive of the Original Thread [15] - Actual thread was deleted by Sun during a regular system purge<br />
• Incomplete list of first year entries [16] - Saved by Archive.org<br />
• Year 2 Thread [17] - On Sun's Java Forums<br />
• Java Unlimited [18] - The repository for submitted games since 2005.<br />
• 4K Game Design Tricks [19] - A Wiki article to assist new entrants.<br />
• 4K Tips and Sources [20] - A set of tips, tutorials and game source codes for 4K Java participants<br />
• JavaGaming.org Contest Forums [21] - Each year (starting with year 3) has its own sub-forum.<br />
• Why are 4K Games so much fun to write and Play? [22]<br />
• Should there be Java game competitions without size limits? [23]
Java 4K Game Programming Contest 106<br />
References<br />
[1] http:/ / forum. java. sun. com/ thread. jspa?threadID=471050& start=279& tstart=0<br />
[2] http:/ / www. javaunlimited. net/ games/ java4k_2005. php<br />
[3] http:/ / games. datadino. com/ 4K_2005/ scores. html<br />
[4] http:/ / games. datadino. com/ 4K_2005/ 4K%20Scores. xls<br />
[5] http:/ / javaunlimited. net/ results/<br />
[6] "JavaGaming Forum" (http:/ / www. javagaming. org/ forums/ index. php?topic=16357. msg129239#msg129239). . Retrieved 2007-04-30.<br />
[7] http:/ / javaunlimited. net/ games/ java4k_2007. php<br />
[8] http:/ / javaunlimited. net/ vote/<br />
[9] http:/ / www. java4k. com/ index. php?action=home<br />
[10] http:/ / www. javagaming. org/ forums/ index. php?board=56. 0<br />
[11] http:/ / www. javagaming. org<br />
[12] http:/ / java4k. com/ overall. html<br />
[13] http:/ / java4k. com/ reviews. html<br />
[14] http:/ / java4k. com/ index. php?action=games& cid=4<br />
[15] http:/ / web. archive. org/ web/ 20021029192411/ http:/ / forum. java. sun. com/ thread. jsp?forum=406& thread=293877<br />
[16] http:/ / web. archive. org/ web/ 20030804050840/ http:/ / www. saber-x. com/ midgarddesign/ 4k. html<br />
[17] http:/ / forum. java. sun. com/ thread. jspa?threadID=471050& start=15& tstart=0<br />
[18] http:/ / javaunlimited. net/<br />
[19] http:/ / wiki. java. net/ bin/ view/ Games/ 4KGamesDesign<br />
[20] http:/ / www. ahristov. com/ tutorial/ java4k-tips. html<br />
[21] http:/ / www. javagaming. org/ forums/ index. php?board=46. 0<br />
[22] http:/ / www. javagaming. org/ forums/ index. php?topic=11611. 0<br />
[23] http:/ / www. javagaming. org/ forums/ index. php?topic=11509. 0<br />
CookXml<br />
CookXml is a unique XML data binding engine in Java. It is capable mapping XML documents of desired format<br />
directly onto the corresponding object-oriented classes, essentially treating XML as a programming language rather<br />
than merely a data storage format. Therefore, it is ideal to use CookXml to write any programs that interprets XML.<br />
The tag library of CookXml is constructed dynamically at run time, and thus allows dynamic XML schema. The<br />
current implementation has unmarshaling part done.<br />
CookXml is free software, distributed under a permissive, X11 style licence.<br />
Unmarshaling<br />
CookXml offers the ability to directly mapping XML documents onto existing classes by breaking down the process<br />
into three general steps. Then use a set of delegates, together forming a tag library, to handle actions performed at<br />
these steps.<br />
1. Object creation. Each element tag corresponds to an object instance. The action to create the object instance<br />
corresponds to a creator in CookXml.<br />
2. Property setting. Each attribute of the XML element corresponds to setting a property of the object instance. This<br />
property can be handled by a setter in CookXml. For languages that offer reflection, such as Java and C#, such<br />
property setting can be automatically detected using reflection. In these cases, to match the string attribute value<br />
to the target property class type, a converter is necessary.<br />
3. Add action. When CookXml obtains an object corresponding to an element tag, it is "added" to the parent object<br />
corresponding to the parent element tag. The specific add action is handled by an adder in CookXml.<br />
Save for CDATA nodes, the three above types of actions can handle all elements in an XML document. CDATA in<br />
general can be handled either in the creator function or the adder function.
CookXml 107<br />
Creators, setters, adders, and converters together form a tag library which is used by the CookXml engine to perform<br />
the XML data binding.<br />
Dynamic Tag Library Construction<br />
Because CookXml tag library uses delegates, its tag library needs to be dynamically constructed. This feature is both<br />
good and bad. It is bad because there will be a slight initiation cost when the tag library is constructed, and its<br />
integrity may not be verified until runtime. It is also good because it allows developers to easily extend an existing<br />
tag library at run time.<br />
Preorder and Postorder Addition<br />
Like any trees that can be traversed in preorder and postorder, the object corresponding to an XML element can be<br />
added to the parent object in preorder or postorder. In the preorder addition, the object is added to the parent before<br />
descendant XML elements get processed. In the postorder addition, the object is added to the parent after descendant<br />
XML elements get processed.<br />
XML Tag Inheritance<br />
One discovery made while writing CookXml was that class inheritance of Object-oriented languages can be mirrored<br />
into XML element tag inheritance. Semantically, tag inheritance means that the derived tag will inherit the setters<br />
and adders of the inherited tags.<br />
For example, javax.swing.JMenu is a child class of javax.swing.JMenuItem. Assuming that javax.swing.JMenu is<br />
mapped to tag and javax.swing.JMenuItem is mapped to tag, then we can declare in CookXml<br />
that tag inherits tag. tag then inherts the setters for attributes such as "text" and "icon"<br />
of the tag.<br />
Polymorphisms of OOP can be mirrored in XML tag inheritance as well. Class casting is similar to dynamically<br />
renaming the current namespace and the tag of the element being processed.<br />
XML tag inheritance is a methodology not present in any other XML data binding tools. This feature is immensely<br />
useful in mapping XML documents to classes with deep inheritance hierarchy, typically found in GUI API. Thus<br />
CookXml is useful in writing XUL motors. CookSwing and CookSwt are two such examples for mapping XML<br />
documents to Swing and SWT classes.<br />
Namespace Handling<br />
Since version 3.0, CookXml is capable of dealing XML documents with multiple namespaces. For backward<br />
compatibility, CookXml also parse XML documents without namespaces or partially utilizing namespaces.<br />
Other Implementation Details<br />
As of version 3.0, CookXml operates on top of XML DOM tree to map an XML document to objects. This feature<br />
allows developers to utilize XML schema if such exist to verify the incoming XML documents. On the other hand,<br />
the memory consumption for a large XML document can be problematic.
CookXml 108<br />
Schema and Documentation Generation<br />
Since a tag library for CookXml contains all the mappings between an XML element and its corresponding object<br />
classes, it is entirely possible to use this map to generate documentations from this feature. The documentation<br />
output can be HTML documents, or XML Schemas.<br />
CookXmlDoc, a doclet API for CookXml can extract Javadoc tags and comments from the tag library source code.<br />
The resulting information can in turn be used by an HTML doclet can then generate the appropriate tag<br />
documentations. See CookSwing Tag Documentation [1] for an example.<br />
Future Work<br />
Streaming is a key feature that is under consideration. Such capability would reduce the memory consumption due to<br />
the construction DOM tree as well as improving the overall performance.<br />
See also<br />
• CookSwing<br />
External links<br />
• CookXml Home Page [2]<br />
• CookSwing: XML to Swing GUI [3]<br />
• CookSwt: XML to SWT GUI [4]<br />
References<br />
[1] http:/ / cookxml. yuanheng. org/ cookswing/ tagdoc/<br />
[2] http:/ / cookxml. yuanheng. org/<br />
[3] http:/ / cookxml. yuanheng. org/ cookswing/<br />
[4] http:/ / cookxml. yuanheng. org/ cookswt/
Cougaar 109<br />
Cougaar<br />
Cougaar is a Java-based architecture for the construction of large-scale distributed multi-agent systems. Cougaar is<br />
the product of multi-year DARPA research projects ALP [1] and Ultra*Log. [2]<br />
Cougaar is open source and includes not only the core runtime framework, but also a variety of demonstration,<br />
visualization, and management components to simplify the development of complex, distributed applications.<br />
Cougaar is an abbreviation, of sorts, for "Cognitive Agent Architecture".<br />
External links<br />
• Cougaar Project Webpage [3]<br />
References<br />
[1] Adalı, S. and Pigaty, L. 2003. The DARPA Advanced Logistics Project. Annals of Mathematics and Artificial Intelligence 37, 4 (Apr. 2003)<br />
(http:/ / www. springerlink. com/ content/ r4007674t7127781)<br />
[2] Todd Carrico and Mark Greaves "Agent Applications in Defense Logistics" Chapter in "Defence Industry Applications of Autonomous<br />
Agents and Multi-Agent Systems", Springer 2008 (http:/ / www. springerlink. com/ content/ k6x53g3527606726)<br />
[3] http:/ / www. cougaar. org
Deterministic Parallel Java 110<br />
Deterministic Parallel Java<br />
OS Cross-platform<br />
Website http:/ / dpj. cs. uiuc. edu<br />
Deterministic Parallel Java (DPJ) is an extension of the Java programming language which adds parallel constructs<br />
that provide a deterministic programming model for object-oriented languages. The language extensions define a<br />
type system that a programmer (or interactive porting tool) can use to annotate Java code with type information, and<br />
a compiler can use to type-check that a DPJ program has deterministic semantics, i.e., produces the same visible<br />
output for a given input, in all executions. Parallel algorithms that cannot be expressed entirely in the statically<br />
checked type system require run-time mechanisms to enforce determinism: two key research goals are to make the<br />
type system more expressive and to minimize the need to fall back to run-time techniques. With minor<br />
modifications, language extensions should be applicable to other base OO languages, such as C++ and C#.<br />
This work is funded by NSF grants CSA 07-02724 and CNS 07-20772, and by Intel and Microsoft through the<br />
UPCRC Illinois.<br />
External links<br />
• The Deterministic Parallel Java Website [1]<br />
References<br />
[1] http:/ / dpj. cs. uiuc. edu<br />
Devoxx<br />
Devoxx (formerly named JavaPolis) is an annual European Java<br />
conference organized by the Belgian Java User Group (BeJUG).<br />
The conference takes place every year around December. [1] With<br />
over 2,800 attendees in 2006, JavaPolis became the biggest<br />
vendor-independent Java conference in the world. [1] In 2008, the<br />
conference was renamed Devoxx.<br />
Location<br />
Devoxx takes place in the second-biggest European cinema<br />
complex, the MetroPolis, located in Antwerp, Belgium. As a<br />
JavaPolis 2006<br />
result, the speakers' video and slides are projected on the huge cinema screens using the available THX audio setup.
Devoxx 111<br />
Related links<br />
• Devoxx home page [2]<br />
• The JavaPolis home page [3]<br />
• the Belgian Java User Group home page [4]<br />
• Parleys.com hosts the JavaPolis (video) presentations [5]<br />
References<br />
Cinema screens<br />
[1] Case Study: JavaPolis at atlassian.com (http:/ / www. atlassian. com/ software/ confluence/ casestudies/ javapolis. jsp)<br />
[2] http:/ / www. devoxx. com<br />
[3] http:/ / www. javapolis. com<br />
[4] http:/ / www. bejug. org<br />
[5] http:/ / www. parleys. com<br />
Doclets<br />
Doclet programs work with the Javadoc tool to generate documentation from code written in Java.<br />
Doclets are written in the Java programming language and use the doclet API to:<br />
• Select which content to include in the documentation.<br />
• Format the presentation of the content.<br />
• Create the file that contains the documentation.<br />
The standard doclet included with Javadoc generates API documentation as frame-based HTML files. Many<br />
non-standard doclets are available on the web, often for free. These can be used to:<br />
• Create other non-API types of documentation.<br />
• Output the documentation to other non-HTML file types such as PDF.<br />
• Output the documentation as HTML with additional features such as a search.<br />
External links<br />
• http:/ / java. sun. com/ j2se/ 1. 4. 2/ docs/ tooldocs/ javadoc/ overview. html
Elastic Path 112<br />
Elastic Path<br />
Industry Software<br />
Founded 2000<br />
Headquarters Vancouver, British Columbia, Canada<br />
Area served Global<br />
Products Enterprise Ecommerce Solutions<br />
Website http:/ / www. elasticpath. com<br />
Elastic Path Software is a privately-held company that provides enterprise ecommerce solutions. Founded in 2000 by<br />
Harry Chemko [1] , Mark Williams and Jason Billinglsey [2] , the company provides a Java-based ecommerce<br />
platform, web hosting, outsourcing, and consulting services. [3] Elastic Path is headquartered in Vancouver, Canada<br />
with offices in Reading, UK.<br />
Background<br />
Elastic Path evolved from a web services business to developing an ecommerce platform. Elastic Path has a client<br />
base of more than 200 customers worldwide and more than 100 employees at offices in Reading, UK and<br />
Vancouver, Canada. Elastic Path grew without any outside capital [4] and earned a spot on the PROFIT 100 ranking<br />
of "Canada's Fastest-growing Companies" two years in a row. [5]<br />
Clients<br />
Elastic Path has more than 200 clients worldwide including Vancouver 2010 Winter Olympics [6] and Paralympic<br />
Games [7] , Virgin Media, Sony Ericsson, and Time Inc.<br />
Ecommerce blog<br />
Elastic Path hosts the Get Elastic Blog, providing ecommerce trends and best practice advice. Get Elastic was ranked<br />
as the #1 ecommerce blog in the world by AdAge Power 150. [8]<br />
External links<br />
• Elastic Path Official Website [9]<br />
• Get Elastic eCommerce blog [10]<br />
• Elastic Path's GREP Developer Community [11]<br />
• The Globe and Mail features Elastic Path's Founder: Harry Chemko. March 17, 2010. Retrieved March 31, 2010<br />
[12]<br />
• Branham Group Inc announces Elastic Path as One of the Top 10 Growth Companies of 2009. April 1, 2010.<br />
Retrieved April 8, 2010 [13]<br />
• The Vancouver Courier features Elastic Path as the Vancouver 2010 Olympic Online Store Operator. February<br />
24, 2010. Retrieved April 8, 2010 [14]<br />
• The Globe and Mail notes Elastic Path as a Creative and Effective Workplace. February 22, 2010. Retrieved April<br />
8, 2010 [15]<br />
• E-Commerce Times interviews Elastic Path's Director of Ecommerce Research, Linda Bustos, on Tips for<br />
E-Commerce-Challenged Telcos. December 7, 2009. Retrieved April 8, 2010 [16]
Elastic Path 113<br />
References<br />
[1] http:/ / list. canadianbusiness. com/ rankings/ profit100/ 2009/ communication/ article. aspx?id=20090601_30009_30009 Profit. June 1, 2009.<br />
retrieved March 31, 2010<br />
[2] http:/ / www. bdc. ca/ en/ about/ mediaroom/ news_releases/ 2008/ 2008102111. htm?cookie_test=1 BDC. October 21, 2008. retrieved April<br />
13, 2010<br />
[3] http:/ / www. financialpost. com/ small-business/ succession/ story. html?id=1626778 Financial Post. May 25, 2009. Retrieved March 31,<br />
2010<br />
[4] http:/ / www. techvibes. com/ blog/ elastic-path-growing-and-hiring-despite-recession. Techvibes. May 7, 2009. Retrieved March 31, 2010<br />
[5] http:/ / www. canadianbusiness. com/ profit_magazine/ press_room/ article. jsp?content=20090603_122513_6692 Profit. July 3, 2090.<br />
Retrieved March 31, 2010<br />
[6] http:/ / www. theglobeandmail. com/ report-on-business/ article977315. ece Globe and Mail. March 23, 2009. Retrieved March 31, 2010<br />
[7] http:/ / www. bivinteractive. com/ index. php?option=com_content& task=view& id=2272& Itemid=30 Business in Vancouver. March 3,<br />
2010. Retrieved March 31, 2010<br />
[8] http:/ / adage. com/ power150/ AdAge Power 150. Retrieved April 8, 2010<br />
[9] http:/ / www. elasticpath. com/<br />
[10] http:/ / www. getelastic. com/<br />
[11] http:/ / grep. elasticpath. com/ index. jspa<br />
[12] http:/ / www. theglobeandmail. com/ report-on-business/ your-business/ grow/ harry-chemko/ article1502194/<br />
[13] http:/ / www. branham300. com/ index. php?year=2010& listing=14<br />
[14] http:/ / www2. canada. com/ vancouvercourier/ news/ story. html?id=403693d8-4ecd-419f-9013-2dc5a9bacc42<br />
[15] http:/ / m. theglobeandmail. com/ report-on-business/ managing/ weekend-workout/ workplace-creativity-shrivels-on-the-vine/<br />
article1474956/ ?service=mobile<br />
[16] http:/ / www. ecommercetimes. com/ story/ Tips-for-E-Commerce-Challenged-Telcos-68822. html?wlc=1270764587<br />
Electronic Disturbance Theater<br />
The Electronic Disturbance Theater (EDT) formed in 1997, by performance artist and published writer Ricardo<br />
Dominguez, is a small company of cyber activists and performance artists who engage in the development in both<br />
the theory and practice of non-violent acts of defiance. Instead of showing their views in person on the streets, the<br />
EDT would create a program to allow Electronic Civil Disobedience (ECD) called FloodNet a form of hacktivism<br />
which would help create the simulation of a sit-in protest over the internet simply known as a virtual sit-in<br />
demonstration to disrupt their oppressors, but overloading their computer networks and servers. The Electronic<br />
Disturbance Theater group have the belief that that the Internet should not be used purely as a means for<br />
communication and data exchange. Instead it should be a forum for direct action as well.<br />
Richard Dominguez, Brett Stabaum, Stefan Wray, and Carmin Krarasic would be collectively known as The<br />
Electronic Disturbance Theatre or EDT for short. Taking the idea of the American Civil Rights Movement of the<br />
1960s, the EDT’s members would avoid using the real names and created aliases to cover their identities. As a<br />
collective group they organise and program computer software to show their views against anti-propagandist and<br />
military actions, and begin mobilizing micro-networks to act in solidarity by staging virtual sit-ins on-line and<br />
allowing the emergence of a collective presence in direct digital actions.<br />
FloodNet<br />
Their objective was with the use of digital media and internet based technology, to cause online civil disobedience in<br />
support of the Zapatista rebels residing in the state of Chiapas in Mexico. EDT uses both electronic mail aka e-mail<br />
and the internet to promote their work around the world, encouraging fellow supporters to download and run a<br />
HTML (Hyper Text Makeup Language) and Java applet, (a internet program used to help support interactive web<br />
based features or programs that a HTML cannot provide alone), based tool called FloodNet a computer based<br />
program, created by members of the Electronic Disturbance theater company Carmin Krarasic and Brett Stabaum.<br />
The FloodNet program would simply reload a Uniform Resource Locator or URL for short several times; effectively<br />
slowing the website and network server down, if a high number of protesters were to join in the sit-in at one time.
Electronic Disturbance Theater 114<br />
The EDT would first execute the FloodNet software in what would be for them a dress rehearsal before attacking<br />
their main targets on April 10 and a month later 1998, on both Mexican and American government websites,<br />
representing both the Mexican President Ernesto Zedillo and American President Bill Clinton.<br />
The Flood Net would work on this basic idea taken from street theatre practices and political rallies and protest but<br />
instead present it on a much larger and international stage, with the facilitation of macro-networks and non-digital<br />
forms of action.<br />
The EDT’s mission was to allow the voices of the Zapatista to be heard, after the attack of the small remote village of<br />
Acteal in Chiapas, Mexico. The Paramilitary a government funded military squad would surround a catholic church<br />
during a Tsotsil Mayan, (a spoken Mexican language from around the Chiapas area of Mexico), for the next several<br />
hours the Paramilitary would shot everyone to death. those inside the church and any which tried to escape resulting<br />
in the death of fifteen children, nine men, and twenty one women, four of which were pregnant at the time on<br />
December 22, 1997. This event would become known as the Acteal Massacre. Those who were convicted of this<br />
crime were later released in the Supreme Court to the outrage of many, after ignoring eye witness reports and<br />
allowing those that confessed to this crime on humanity. Instead the Supreme Court forcing on the mismanagement<br />
of the investigation and the fabrication of evidence.<br />
The Electronic Disturbance Theater took notice of these actions, when others did not and arranged their first act of<br />
Electronic Civil Disobedience against the Mexican Government. Those that had downloaded the FloodNet program<br />
in support of the Zapatista’s were asked the input the names repetitively of those that had lost their life’s at the hands<br />
of the Mexican Army in military attacks. This would then target the servers to return an error message each time<br />
these URL’s would be requested. This data request would then be stored on a server’s error log and in the eyes of the<br />
Zapatista and the Electronic Disturbance Theater group, a symbolical list of those forty five Acteal civilians that had<br />
died straight to their murderers. If enough people were to use the FloodNet applet, this would cause the computer<br />
server running the website to overload, so that when a regular visitor or somebody working within the site was to try<br />
and access the website or send company based emails and files, the pages would ether load extremely slowly or not<br />
at all. Working off the same basis of a real sit-in demonstration, where the protestors block the entrance to a public<br />
building of their oppressors and preventing access to the building.<br />
With around twenty five percent of the world’s population, in one way or another connected to the World Wide Web,<br />
with the use of dial-up internet connection, wired or wireless internet broadband connection and even mobile internet<br />
technology, everyone of these means of communication can allow the internet to be used as a means of non-violent<br />
action within our Human Rights, and is viewable around the world, and can be translated into different languages but<br />
most importantly not controlled by the government. The EDT networked performances have already opened access<br />
and communication between three unlikely micro-networks: net.art, net.activism, and net.hackers, with technology<br />
always evolving their no telling how these areas will grow.<br />
However June 10, 1998, the EDT would strike the Mexican Secretaria de Gobernacion, (Secretary of Government),<br />
which is involved in immigration policies as well as Mexico’s federal public security forces working in conjunction<br />
with the military against Zapatista communities in Chiapas unsuccessfully. The Mexican government would have a<br />
programmed countermeasure in place. This is what the EDT believe took place. A countermeasure was built into the<br />
operating Java script was placed in the Secretaria de Gobernacion’s website that was designed to activate whenever<br />
FloodNet was directed toward its servers. Upon activation, the website would open window after window on the<br />
FloodNet user’s internet browser. If the FloodNet user remained connected long enough, their browser whether it is<br />
Netscape, Firefox or Internet Explorer, could crash the activist's computer, forcing the activist to reboot their system<br />
stopping the FloodNet program at the source. The EDT has now since dealt with both the Mexican Government both<br />
online and offline, and the United States Department of Defence, who has now inserted a counter attack system into<br />
their Internet Browser based coding to prevent anymore FloodNet based attacks to the system and server.<br />
The FloodNet system would be used again against the World Trade Organization in 1999, where the group would<br />
release their online civil disobedience software to the public under the name ‘’Zapatista Disturbance Development’s
Electronic Disturbance Theater 115<br />
Kit.’’<br />
Cyber Terrorism?<br />
The Electronic Disturbance Theater has and will remain a heated topic of debate, within its area of political up rise,<br />
civil disobedience, hacktivism, and to a much larger scale extremes acts of cyber terrorism. Many people do have the<br />
right and believe in free speech. The FloodNet programs does allow this in a safer way to the protestors, (as their real<br />
identities can be hidden under their user names.), allowed people around the world to express their views on the<br />
subject without travelling to the protest rallies and provide a non-violent way to be heard in the form of these sit-in<br />
demonstrations, however this causes incorrect actions that block bandwidth, and the internet should be open for<br />
everybody no matter what their political views. The Virtual Republic representatives view this blocking of<br />
communications and data as an act of cyber terrorism. They believe the system should be open for all internet users,<br />
and be accessible with a simple point then click and to those individuals or groups should be banned. Protestors are<br />
asked to protest outside of their oppressors location, with signs and don’t interact with the business inside which with<br />
the blocking of communication and data the EDT are doing. Against such self-evident truths, the digital agit-prop<br />
actions of EDT call for the right to block data in the struggle for the development of democracy and human rights.<br />
External links<br />
• ECD [1]<br />
• EDTECD [2]<br />
• On Electronic Civil Disobedience [3]<br />
• Digital Zapatismo [4]<br />
• The Acteal Massacre - Chiapas Mexico - December 22, 1997 [5]<br />
• Electronic Disturbance Theater [6]<br />
• Electronic Disturbance Theater [7]<br />
• The Zapatista Tactical FloodNet [8]<br />
• FloodNet Foyer [9]<br />
References<br />
[1] http:/ / www. thing. net/ ~rdom/ ecd/ ecd. html<br />
[2] http:/ / www. thing. net/ ~rdom/ ecd/ EDTECD. html<br />
[3] http:/ / www. thing. net/ ~rdom/ ecd/ oecd. html<br />
[4] http:/ / www. thing. net/ ~rdom/ ecd/ DigZap. html<br />
[5] http:/ / www. libertadlatina. org/ Crisis_Mexico_Chiapas_Acteal_Massacre. htm<br />
[6] http:/ / wiki. brown. edu/ confluence/ display/ MarkTribe/ Electronic+ Disturbance+ Theater<br />
[7] http:/ / digitalarts. lcc. gatech. edu/ unesco/ internet/ artists/ int_a_edtheater. html<br />
[8] http:/ / www. thing. net/ ~rdom/ ecd/ ZapTact. html<br />
[9] http:/ / www. thing. net/ ~rdom/ zapsTactical/ foyer3. htm
Event dispatching thread 116<br />
Event dispatching thread<br />
The event dispatching thread (EDT) is a background thread used in Java to process events from the Abstract<br />
Window Toolkit (AWT) graphical user interface event queue. These events are primarily update events that cause<br />
user interface components to redraw themselves, or input events from input devices such as the mouse or keyboard.<br />
The AWT uses a single-threaded painting model in which all screen updates must be performed from a single thread.<br />
The event dispatching thread is the only valid thread to update the visual state of visible user interface components.<br />
Updating visible components from other threads is the source of many common bugs in Java programs that use<br />
Swing [1] .<br />
Swing and thread safety<br />
Most AWT and Swing object methods are not thread safe: invoking them from multiple threads risks thread<br />
interference or memory consistency errors [2] [3] . To avoid these problems, Swing standards states that all user<br />
interface components should be created and accessed only from the AWT event dispatch thread. A popular<br />
third-party Look and Feel named Substance [4] goes as far as to refuse to instantiate any Swing component off of the<br />
Event Dispatch Thread [5] , to prevent coders from making such a mistake.<br />
Executing code in the EDT<br />
Other application threads can execute code in the event dispatching thread by defining the code in a Runnable object<br />
and pass it to the SwingUtilities helper class or to the EventQueue. Two methods of these classes allow:<br />
• synchronous code execution (SwingUtilities.invokeAndWait(Runnable) or<br />
EventQueue.invokeAndWait(Runnable))<br />
• and asynchronous code execution (SwingUtilities.invokeLater(Runnable) or EventQueue.invokeLater(Runnable))<br />
from the EDT.<br />
The method invokeAndWait() should never be called from the event dispatching thread—it will throw an exception.<br />
The method SwingUtilities.isEventDispatchThread() or EventQueue.isDispatchThread() can be called to determine<br />
if the current thread is the event dispatching thread.<br />
Another solution for executing code in the EDT is using the worker design pattern. The SwingWorker class,<br />
developed by Sun Microsystems, is an implementation of the worker design pattern, and as of Java 6 is part of<br />
standard Swing distribution. The open source project Foxtrot [6] provides another synchronous execution solution<br />
similar to SwingWorker.<br />
See also<br />
• Abstract Window Toolkit (AWT)<br />
• Swing (Java)<br />
• SwingWorker<br />
• BackgroundWorker, an equivalent .NET Framework class for SwingWorker<br />
External links<br />
• javax.swing (Swing API Javadoc documentation)<br />
• java.awt (AWT API Javadoc documentation)<br />
• Swing API documentation [7]<br />
• AWT API documentation [8]<br />
• The Event-Dispatching Thread [9]
Event dispatching thread 117<br />
• SwingWorker [10] description from the Swing tutorial<br />
• AWT/Swing event handling [11] article about event pumping, dispatch and processing, and the EDT<br />
• Foxtrot project home page [6]<br />
• Spin project home page [12]<br />
References<br />
[1] This problem is not specific to Java Swing. There is the same issue in most Widget toolkits, as for example Windows Forms, where the<br />
BackgroundWorker class performs the same purpose as SwingWorker in Java.<br />
[2] "The Event Dispatch Thread" (http:/ / java. sun. com/ docs/ books/ tutorial/ uiswing/ concurrency/ dispatch. html). Sun Microsystems. .<br />
Retrieved 2010-03-19.<br />
[3] http:/ / weblogs. java. net/ blog/ alexfromsun/ archive/ 2005/ 11/ debugging_swing_1. html<br />
[4] https:/ / substance. dev. java. net/<br />
[5] http:/ / www. pushing-pixels. org/ ?p=368<br />
[6] http:/ / foxtrot. sourceforge. net/<br />
[7] http:/ / java. sun. com/ javase/ 6/ docs/ technotes/ guides/ swing<br />
[8] http:/ / java. sun. com/ javase/ 6/ docs/ technotes/ guides/ awt<br />
[9] http:/ / java. sun. com/ docs/ books/ tutorial/ uiswing/ misc/ threads. html#EDT<br />
[10] http:/ / java. sun. com/ docs/ books/ tutorial/ uiswing/ misc/ threads. html#SwingWorker<br />
[11] http:/ / tech. stolsvik. com/ 2009/ 03/ awt-swing-event-pumping-and-targeting. html<br />
[12] http:/ / spin. sourceforge. net/
Facelets 118<br />
Facelets<br />
Stable release 1.1.15 / November 24, 2009<br />
Preview release 1.2-dev / November 10, 2006<br />
Written in Java<br />
Operating<br />
system<br />
Cross-platform<br />
Size 5.07 MB (archived)<br />
Type Web Framework<br />
License Apache License 2.0<br />
Website http:/ / facelets. dev. java. net/<br />
Facelets is an open source web framework under the Apache license and the default view handler technology (aka<br />
view declaration language) for JavaServer Faces (JSF). The framework requires valid input XML documents to<br />
work. Facelets supports all of the JSF UI components and focuses completely on building the JSF component tree,<br />
reflecting the view for a JSF application.<br />
Although both JSP and JSF technologies have been improved to work better together, Facelets eliminates the issues<br />
noted in Hans Bergsten's article "Improving JSF by Dumping JSP" [1]<br />
Facelets is similar enough to Apache Tapestry to draw comparison. In fact, Tapestry was well ahead of its time when<br />
it first came out , and Facelets does draw on some of its ideas. The project is conceptually similar to Tapestry's,<br />
which uses the jwcid attribute, while Facelets uses the jsfc attribute combined with proper namespaces to convert<br />
HTML elements into the corresponding JSF components. Also, there are some similarities to the Tiles framework<br />
regarding support templating as well as composition.<br />
Initially, Facelets was available as a separate, alternative view declaration language for JSF 1.1 and JSF 1.2 which<br />
both used JSP as the default view declaration language. Starting from JSF 2.0, Facelets has been promoted as the<br />
default, and JSP has been deprecated as a legacy fall back [2] .<br />
Example<br />
The following example shows an XHTML template for taking the use of Facelets component-aliasing. The jsfc<br />
attribute is used here, shows which tags to replace when compiling the page with the corresponding JavaServer<br />
Faces components.<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
Facelets 119<br />
The above code can be viewed in a browser, and edited with conventional WYSIWYG design tools. This is not<br />
possible with regular JSF 1.2 pages (shown below the same functionality).<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
See also<br />
• JavaServer Faces<br />
Bibliography<br />
• Wadia, Zubin; Marinschek, Martin; Saleh, Hazem; Byrne, Dennis (September 22, 2008), The Definitive Guide to<br />
Apache MyFaces and Facelets [3] (1st ed.), Apress, pp. 400, ISBN 978-1590597378<br />
• Wadia, Zubin; Aranda, Bruno (May 26, 2008), Facelets Essentials: Guide to JavaServer Faces <strong>View</strong> Definition<br />
Framework [4] (1st ed.), Apress, pp. 84, ISBN 978-1430210498<br />
External links<br />
• Facelets Home Page [5]<br />
• Facelets compared to Tiles [6]<br />
• Facelets Developer Documentation [7]<br />
References<br />
[1] Hans Bergsten (June 6, 2004). "Improving JSF by Dumping JSP" (http:/ / onjava. com/ pub/ a/ onjava/ 2004/ 06/ 09/ jsf. html). O'Reilly<br />
Media. .<br />
[2] JavaServer Faces 2.0, The Complete Reference by Ed Burns and Chris Schal, page 55: 'The expert group decided to move forward with<br />
Facelets as the basis for new features while letting JSP remain as a backward compatibility layer'.<br />
[3] http:/ / www. apress. com/ book/ view/ 9781590597378<br />
[4] http:/ / www. apress. com/ book/ view/ 9781430210498<br />
[5] https:/ / facelets. dev. java. net/<br />
[6] http:/ / www. ibm. com/ developerworks/ java/ library/ j-facelets/<br />
[7] https:/ / facelets. dev. java. net/ nonav/ docs/ dev/ docbook. html
final (Java) 120<br />
final (Java)<br />
In the Java programming language, the final keyword is used in several different contexts to define an entity which<br />
cannot later be changed.<br />
Final classes<br />
A final class cannot be subclassed. This is done for reasons of security and efficiency. Accordingly, many of the<br />
Java standard library classes are final, for example java.lang.System and java.lang.String. All methods in a final<br />
class are implicitly final.<br />
Example:<br />
public final class MyFinalClass {...}<br />
Restricted subclassers are often referred to as "soft final" classes. [1]<br />
Final methods<br />
A final method cannot be overridden by subclasses. This is used to prevent unexpected behavior from a subclass<br />
altering a method that may be crucial to the function or consistency of the class. [2]<br />
Example:<br />
public class MyClass {<br />
}<br />
public final void myFinalMethod() {...}<br />
A common misconception is that declaring a class or method final improves efficiency by allowing the compiler to<br />
directly insert the method inline wherever it is called. This is not completely true; the compiler is unable to do this<br />
because the classes loaded at runtime might not be the same versions of the ones that were just compiled. Further,<br />
the runtime environment and JIT compiler have the information about exactly what classes have been loaded, and<br />
are able to make better decisions about when to inline, whether or not the method is final. [3]<br />
Final variables<br />
A final variable can only be assigned once. This assignment does not grant the variable immutable status. If the<br />
variable is a field of a class, it must be assigned in the constructor of its class. (Note: If the variable is a reference,<br />
this means that the variable cannot be re-bound to reference another object. But the object that it references is still<br />
mutable, if it was originally mutable.)<br />
Unlike the value of a constant, the value of a final variable is not necessarily known at compile time.<br />
Example:<br />
public class Sphere {<br />
public static final double PI = 3.141592653589793; // this is<br />
essentially a constant<br />
public final double radius;<br />
public final double xpos;<br />
public final double ypos;<br />
public final double zpos;
final (Java) 121<br />
}<br />
Sphere(double x, double y, double z, double r) {<br />
}<br />
[...]<br />
radius = r;<br />
xpos = x;<br />
ypos = y;<br />
zpos = z;<br />
Any attempt to reassign radius, xpos, ypos, zpos will meet with a compile error. In fact, even if the constructor<br />
doesn't set a final variable, attempting to set it outside the constructor will result in a compile error.<br />
To illustrate that finality doesn't guarantee immutability: suppose we replace the three position variables with a<br />
single one:<br />
public final Position pos;<br />
where pos is an object with three properties pos.x, pos.y and pos.z. Then pos cannot be assigned to, but the three<br />
properties can, unless they are final themselves.<br />
Like full immutability, finality of variables has great advantages, especially in optimization. For instance, Sphere<br />
will probably have a function returning its volume; knowing that its radius is constant allows us to memoize the<br />
computed volume. If we have relatively few Spheres and we need their volumes very often, the performance gain<br />
might be substantial. Making the radius of a Sphere final informs developers and compilers that this sort of<br />
optimization is possible in all code that uses Spheres.<br />
Blank final<br />
The blank final, which was introduced in Java 1.1, is a final variable whose declaration lacks an initializer. [4] [5] A<br />
blank final can only be assigned to once and it must be definitely unassigned when an assignment occurs. In order to<br />
do this, a Java compiler runs a flow analysis to ensure that, for every assignment to a blank final variable, the<br />
variable is definitely unassigned before the assignment; otherwise a compile-time error must occur. [6]<br />
In general, a Java compiler will ensure that the blank final is not used until is assigned a value and that once assigned<br />
a value, the now final variable cannot be reassigned another value. [7]<br />
Difference from the C++ "const" type qualifier<br />
• In C++, a const field is not only protected from being reassigned, but there is the additional limitation that only<br />
const methods can be called on it and it can only be passed as the const argument of other methods.<br />
• Non-static inner classes can freely access any field of the enclosing class, final or not.<br />
External links<br />
• Its Time To Deprecate Final [8]<br />
• The Final Word On the final Keyword by Renaud Waldura [9]
final (Java) 122<br />
References<br />
[1] "How to Use the Eclipse API" (http:/ / www. eclipse. org/ articles/ article. php?file=Article-API-Use/ index. html). The Eclipse Foundation..<br />
2010. . Retrieved 23 July 2010.<br />
[2] Writing Final Classes and Methods (http:/ / java. sun. com/ docs/ books/ tutorial/ java/ IandI/ final. html)<br />
[3] Java theory and practice: Is that your final answer? (http:/ / www. ibm. com/ developerworks/ java/ library/ j-jtp1029. html)<br />
[4] Flanagan, David (May 1997). "Chapter 5 Inner Classes and Other New Language Features:5.6 Other New Features of Java 1.1" (http:/ / web.<br />
deu. edu. tr/ doc/ oreily/ java/ javanut/ ch05_06. htm). Java in a Nutshell (2nd Edition ed.). O'Reilly. ISBN 1-56592-262-X. .<br />
[5] "Types, Values, and Variables" (http:/ / java. sun. com/ docs/ books/ jls/ second_edition/ html/ typesValues. doc. html). Java Language<br />
Specification Chapter 4. Sun Microsystems, Inc. 2000. . Retrieved 23 July 2010.<br />
[6] "Definite Assignment" (http:/ / java. sun. com/ docs/ books/ jls/ second_edition/ html/ defAssign. doc. html). Java Language Specification.<br />
Sun Microsystems, Inc.. 2000. . Retrieved 23 July 2010.<br />
[7] Pattis, Richard E.. "More Java" (http:/ / www. cs. cmu. edu/ ~pattis/ 15-1XX/ 15-200/ lectures/ morejava/ lecture. html). Advanced<br />
Programming/Practicum 15-200. School of Computer Science Carnegie Mellon University. . Retrieved 23 July 2010.<br />
[8] http:/ / butunclebob. com/ ArticleS. MichaelFeathers. ItsTimeToDeprecateFinal<br />
[9] http:/ / renaud. waldura. com/ doc/ java/ final-keyword. shtml#vars<br />
FloodNet<br />
The Zapatista Tactical FloodNet is a Java Applet that assists in the execution of virtual sit-ins by automatically<br />
reloading the targeted website several times every minute. Additionally, it allows for users to post statements to the<br />
site by sending them to the server log.<br />
FloodNet was created by the Electronic Disturbance Theater members Carmin Karasic and Brett Stalbaum. This<br />
activist group executed FloodNet in April and December 1998 on Mexican and American government sites,<br />
respectively.<br />
The FloodNet program will only cause desired effect when thousands of users are logged in simultaneously, where<br />
all their browsers will automatically reload targeted website and cause desired effect. Desired effect being to cause<br />
so much traffic inside the server that any other user attempting to log in will not be able to view the website.<br />
External links<br />
• An explanation of FloodNet [8]<br />
• The FloodNet Foyer [9]
FormEngine 123<br />
FormEngine<br />
Developer(s)<br />
imatics Software GmbH [1]<br />
Stable release 1.6.3 / July 14, 2010<br />
Development status Active<br />
Written in Java<br />
License MIT License<br />
Website<br />
FormEngine Home [2]<br />
The FormEngine is a Java framework for dynamic form creation and complex form processing for web<br />
applications.<br />
About<br />
The primary goal of this framework is to help application developers in two areas of interest:<br />
1. dynamic creation of form definitions at runtime<br />
2. a simple albeit powerful way to dynamically process complex calculations and validations of form input (user<br />
data)<br />
Characteristics<br />
The FormEngine framework is build for use in available (or new) Java web application projects. It can be integrated<br />
with a few easy steps into a servlet container.<br />
Form processing occurs in form sessions that bind data processing abilities along with the snapshot of the current<br />
data model to the task that's been initiated by a user/client. A form session manages a form instance that behaves just<br />
like described in the form definition. The FormEngine relies on AJAX techniques to allow client-server<br />
communication during a form session.<br />
Calculations and data validation have to be implemented server-side only. Several design patterns aim for<br />
minimizing memory needs. Renderers are implemented thread-safe and can be used simultaneously with multiple<br />
form instances of a single form definition.<br />
History<br />
The FormEngine Java framework project started in 2007. It was created to overcome the shortfalls of other web form<br />
frameworks in several areas. It is used in a business process management suite (*) as a replacement for the Chiba<br />
Engine, a form framework to process XForms definitions. The FormEngine framework was first released for open<br />
use under a modified MIT license in december 2009.<br />
Articles and further information<br />
Several articles have been posted about the FormEngine Java framework, such as "FormEngine : Multidynamische<br />
Formulare" (german) [3] .<br />
For further information see External links.
FormEngine 124<br />
See also<br />
• JavaServer Faces<br />
• XForms<br />
• Google Web Toolkit<br />
External links<br />
• form-engine.de Home [2]<br />
• FormEngine example page [4]<br />
• Chiba Engine Home [5]<br />
• imatics ProcessSuite [6] - A business process management suite that makes use of the FormEngine framework<br />
References<br />
[1] http:/ / www. imatics. de<br />
[2] http:/ / www. form-engine. de/ en/ index. jsp<br />
[3] Java Magazine (2010), " it-republik.de (http:/ / it-republik. de/ jaxenter/ artikel/ FormEngine-Multidynamische-Formulare-2893. html)".<br />
FormEngine: Multidynamische Formulare<br />
[4] http:/ / www. form-engine. de/ en/ examples/ examples. jsp<br />
[5] http:/ / chiba-project. org/ chiba/<br />
[6] http:/ / www. processsuite. de/ langen/ index. html<br />
Generics in Java<br />
Generics are a facility of generic programming that was added to the Java programming language in 2004 as part of<br />
J2SE 5.0. They allow "a type or method to operate on objects of various types while providing compile-time type<br />
safety." [1]<br />
Hierarchy and classification<br />
As per Java Language Specification [2] :<br />
• A type variable is an unqualified identifier. Type variables are introduced by generic class declarations, generic<br />
interface declarations, generic method declarations, and by generic constructor declarations.<br />
• A class is generic if it declares one or more type variables. These type variables are known as the type parameters<br />
of the class. It defines one or more type variables that act as parameters. A generic class declaration defines a set<br />
of parameterized types, one for each possible invocation of the type parameter section. All of these parameterized<br />
types share the same class at runtime.<br />
• An interface is generic if it declares one or more type variables. These type variables are known as the type<br />
parameters of the interface. It defines one or more type variables that act as parameters. A generic interface<br />
declaration defines a set of types, one for each possible invocation of the type parameter section. All<br />
parameterized types share the same interface at runtime.<br />
• A method is generic if it declares one or more type variables. These type variables are known as the formal type<br />
parameters of the method. The form of the formal type parameter list is identical to a type parameter list of a class<br />
or interface.<br />
• A constructor can be declared as generic, independently of whether the class the constructor is declared in is itself<br />
generic. A constructor is generic if it declares one or more type variables. These type variables are known as the<br />
formal type parameters of the constructor. The form of the formal type parameter list is identical to a type<br />
parameter list of a generic class or interface.
Generics in Java 125<br />
Motivation for generics<br />
The following block of Java code illustrates a problem that exists when not using generics. First, it declares an<br />
ArrayList of type Object. Then, it adds a String to the ArrayList. Finally, it attempts to retrieve the added String and<br />
cast it to an Integer.<br />
List v = new ArrayList();<br />
v.add("test");<br />
Integer i = (Integer)v.get(0); // Run time error<br />
Although the code compiles without error, it throws a runtime exception (java.lang.ClassCastException) when<br />
executing the third line of code. This type of problem can be avoided by using generics and is the primary motivation<br />
for using generics.<br />
Using generics, the above code fragment can be rewritten as follows:<br />
List v = new ArrayList();<br />
v.add("test");<br />
Integer i = v.get(0); // (type error) Compile time error<br />
The type parameter String within the angle brackets declares the ArrayList to be constituted of String (a descendant<br />
of the ArrayList's generic Object constituents). With generics, it is no longer necessary to cast the third line to any<br />
particular type, because the result of v.get(0) is defined as String by the code generated by the compiler.<br />
Compiling the third line of this fragment with J2SE 5.0 (or later) will yield a compile-time error because the<br />
compiler will detect that v.get(0) returns String instead of Integer. For a more elaborate example, see [3] .<br />
Here is a small excerpt from the definitions of the interfaces List and Iterator in package java.util:<br />
public interface List {<br />
}<br />
void add(E x);<br />
Iterator iterator();<br />
public interface Iterator {<br />
}<br />
E next();<br />
boolean hasNext();<br />
Wildcards<br />
Generic type parameters in Java are not limited to specific classes. Java allows the use of wildcards to specify<br />
bounds on the type of parameters a given generic object may have. Wildcards are type parameters of the form "?",<br />
possibly annotated with a bound. Given that the exact element type of an object with a wildcard is unknown,<br />
restrictions are placed on the type of methods that may be called on the object.<br />
As an example of an unbounded wildcard, List indicates a list which has an unknown object type. Methods<br />
which take such a list as an argument can take any type of list, regardless of parameter type. Reading from the list<br />
will return objects of type Object, and writing non-null elements to the list is not allowed, since the parameter type is<br />
not known.<br />
To specify the upper bound of a generic element, the extends keyword is used, which indicates that the generic type<br />
is a subtype of the bounding class. Thus it must either extend the class, or implement the interface of the bounding<br />
class. So List
Generics in Java 126<br />
The use of wildcards above is necessary since objects of one type parameter cannot be converted to objects of<br />
another parameter. Neither List nor List is a subtype of the other, even though Integer is a<br />
subtype of Number. So, code that deals with List does not work with List. If it did, it would be<br />
possible to insert a Number that is not a Integer into it, which violates type safety. Here is a sample code that<br />
explains the contradiction it brings if List is a subtype of List:<br />
List ints = new ArrayList();<br />
ints.add(2);<br />
List nums = ints; //valid if List is a subtype of List accordin<br />
substitution rule.<br />
nums.add(3.14);<br />
Integer x=ints.get(1); // now 3.14 is assigned to an Integer variable!<br />
The solution with wildcards works because it disallows operations that would violate type safety.<br />
To specify the lower bounding class of a generic element, the super keyword is used. This keyword indicates that the<br />
aforementioned generic type is a super-type of said bounding class. So, List
Generics in Java 127<br />
Pair grade440 = new Pair("mike", "A");<br />
Pair marks440 = new Pair("mike", 100);<br />
System.out.println("grade: " + grade440);<br />
System.out.println("marks: " + marks440);<br />
Generic method definitions<br />
Here is an example of a generic method using the generic class above:<br />
public Pair twice(T value)<br />
{<br />
}<br />
return new Pair(value,value);<br />
In many cases the user of the method need not indicate the type parameters, as they can be inferred:<br />
Pair pair = twice("Hello");<br />
The parameters can be explicitly added if needed:<br />
Pair pair = this.twice("Hello");<br />
Note that you cannot use native types, ex:<br />
Pair pair; // this fails. You have to use Integer instead.<br />
Generics in throws clause<br />
Although exceptions themselves cannot be generic, generic parameters can appear in a throws clause:<br />
public void throwMeConditional<br />
{<br />
}<br />
(boolean conditional, T exception) throws T<br />
if(conditional)<br />
throw exception;<br />
Type erasure<br />
Generics are checked at compile-time for type-correctness. The generic type information is then removed in a<br />
process called type erasure. For example, List will be converted to the non-generic type List, which can<br />
contain arbitrary objects. The compile-time check guarantees that the resulting code is type-correct.<br />
As a result of type erasure, type parameters cannot be determined at run-time. For example, when an ArrayList is<br />
examined at runtime, there is no general way to determine whether, before type erasure, it was an<br />
ArrayList or an ArrayList. Many people are dissatisfied with this restriction [5] . There are partial<br />
approaches. For example, individual elements may be examined to determine the type they belong to; for example, if<br />
an ArrayList contains an Integer, that ArrayList was presumably parameterized with Integer. Reflection can also<br />
determine the type parameter. However, no approach works in all cases.<br />
Demonstrating this point, the following code outputs "Equal":<br />
ArrayList li = new ArrayList();<br />
ArrayList lf = new ArrayList();<br />
if (li.getClass() == lf.getClass()) // evaluates to true
Generics in Java 128<br />
System.out.println("Equal");<br />
Java generics differ from C++ templates. Java generics generate only one compiled version of a generic class or<br />
function regardless of the number of parameterizing types used. Furthermore, the Java run-time environment does<br />
not need to know which parameterized type is used because the type information is validated at compile-time and is<br />
not included in the compiled code. Consequently, instantiating a Java class of a parameterized type is impossible<br />
because instantiation requires a call to a constructor, which is unavailable if the type is unknown.<br />
For example, the following code will not compile:<br />
T instantiateElementType(List arg)<br />
{<br />
}<br />
return new T(); //causes a compile error<br />
Because there is only one copy per generic class at runtime, static variables are shared among all the instances of the<br />
class, regardless of their type parameter. As a result, the type parameter cannot be used in the declaration of static<br />
variables or in static methods. Static variables and static methods are "outside" of the scope of the class's<br />
parameterized types.<br />
See also<br />
• Generic programming<br />
• Java<br />
• Comparison of C# and Java<br />
• Comparison of Java and C++<br />
External links<br />
• Lesson: Generics [6] at The Java Tutorials<br />
• Generics [7] by Sun Microsystems<br />
• Wild FJ [8] by Mads Torgersen, Erik Ernst, and Christian Plesner Hansen<br />
• Java Generics FAQ [5] by Angelika Langer<br />
• JavaWorld Taming the Tiger [9] Excellent overview.<br />
• Java Generics Presentation [10] by DevelopIntelligence<br />
• Java Generics Tutorial [11] by Jakob Jenkov - jenkov.com<br />
References<br />
[1] Java Programming Language (http:/ / java. sun. com/ j2se/ 1. 5. 0/ docs/ guide/ language/ index. html)<br />
[2] Java Language Specification, Third Edition (http:/ / java. sun. com/ docs/ books/ jls/ third_edition/ html/ j3TOC. html) by James Gosling, Bill<br />
Joy, Guy Steele, Gilad Bracha - Prentice Hall PTR 2005<br />
[3] http:/ / java. sun. com/ j2se/ 1. 5/ pdf/ generics-tutorial. pdf - Generics in the Java Programming Language<br />
[4] http:/ / stackoverflow. com/ questions/ 156275/ what-is-the-equivalent-of-the-c-pairl-r-in-java<br />
[5] Gafter, Neal (2006-11-05). "Reified Generics for Java".<br />
[6] http:/ / java. sun. com/ docs/ books/ tutorial/ java/ generics/ index. html<br />
[7] http:/ / java. sun. com/ j2se/ 1. 5. 0/ docs/ guide/ language/ generics. html<br />
[8] http:/ / homepages. inf. ed. ac. uk/ wadler/ fool/ program/ 14. html<br />
[9] http:/ / www. javaworld. com/ javaworld/ jw-06-2004/ jw-0607-tiger2. html<br />
[10] http:/ / www. developintelligence. com/ learn/ tutorials. php<br />
[11] http:/ / tutorials. jenkov. com/ java-generics/ index. html
G-java 129<br />
G-java<br />
G-java 2.x was a cross-platform game/software Java-based compiler for G-Creator. It has since dissolved into<br />
various projects such as Pineapple and Dolphin, although downloads for it are still around, but unsupported. It ran on<br />
and created software for any Java supported operating systems such as Microsoft Windows 95+, Mac OS, Linux,<br />
Unix and Sun Solaris. G-java is made up of two components: the IDE and the API, both of which were originally<br />
based on Game Maker but have since been modified and became more close to Java's API.<br />
G-Java API<br />
The G-java API is a java API for creating games and other software based on the Game Maker Language used in<br />
Game Maker. This allows Game Maker developers to quickly learn Java, while also giving Java programmers a lot<br />
of useful functions for game or software development. So far, the G-java API is still in an alpha stage, but the<br />
JavaDocs can already be viewed: G-java API javadoc [1]<br />
History<br />
Originally G-java was a Game Maker to Java converter application written by TGMG(lead developer), IsmAvatar<br />
(optimization), and BZGaming (programmed some functions) in the Java programming language. It was first<br />
released in December 2004. It is designed to allow its users to easily develop multi-platform Java computer games<br />
without learning the Java language. However with the release of Game Maker 7 (G-java was at version 1.08 beta 8<br />
and supported many of GM's features), Mark Overmars, the creator of Game Maker, made a public announcement<br />
that G-Java was now officially disallowed by the new GM7 license agreement: [2], and has also encrypted the GMK<br />
files (Game Maker 7's saved file) to discourage similar projects. Although Game Maker was originally freeware, it<br />
switched to shareware by version 5. Conversely, TGMG hopes to improve on Game maker by making G-java2 open<br />
source.<br />
G-java used to use .gm6 files created in the Game Maker IDE, and converts them to .jar files which can be executed<br />
in any Java VM within most modern graphical web browsers. For experienced users, G-java contained a built-in<br />
scripting programming language called "EGML", or "Extended Game Maker Language". This allow users to create<br />
programs with Java functions not available in the Game Maker Language.<br />
G-Java 2.0 was initially supposed to implement the NetBeans source-code to save some work. However, this proved<br />
to be extremely limited and too big.<br />
G-Java 2.0 was then renamed to G-Creator, codenamed Aurora(Portuguese word for dawn), and started from the<br />
beginning - the core. G-java 2.0 became the main compiler of G-Creator, before both projects dissolved altogether.<br />
G-Java and LateralGM<br />
The G-Java project's ancestor, Dolphin, is currently being developed as a LateralGM plugin for the same purpose.<br />
External links<br />
• G-java site [3] - old G-Java website; This is outdated and may be removed soon.<br />
• G-Creator site [4] - Official G-Creator website.<br />
• G-java/G-Creator forums [5] - official forums.<br />
• LateralGM [6] - An open source project affiliated with and similar to G-Java, lead by IsmAvatar.
G-java 130<br />
References<br />
[1] http:/ / www. g-java. com/ javadoc/<br />
[2] http:/ / forums. gamemaker. nl/ index. php?showtopic=266467& view=findpost& p=1882461<br />
[3] http:/ / www. g-java. com<br />
[4] http:/ / www. g-creator. org<br />
[5] http:/ / forums. g-creator. org/<br />
[6] http:/ / www. ismavatar. com/ lgm/<br />
GlassFish Metro<br />
Metro is an opensource web service stack that is a part of the GlassFish project, though it can also be used in a<br />
stand-alone configuration. [1] Components of metro include JAXB RI, JAX-WS RI, SAAJ RI, SJSXP, and WSIT. It<br />
is available under the CDDL and GPLv2 (with classpath exception.) [2]<br />
It is supported by Sun Microsystems.<br />
History<br />
Originally, the Glassfish project developed two semi-independent project :<br />
• JAX-WS RI, the Reference implementation of the JAX-WS specification<br />
• WSIT, a Java implementation of some of the WS-* and an enhanced support for interoperability with the .NET<br />
Framework. It is based on JAX-WS RI as "Web Service layer".<br />
In June 2007, it has been decided to bundle these two components as a single component named Metro[3].<br />
Market share<br />
Metro is bundled with Java SE 6 in order to allow consumers of Java SE 6 to consume Web Services [4]<br />
Metro is bundled with numerous Application Servers [5] such as :<br />
• GlassFish<br />
• Sun Java System Application Server Platform Edition 9.x<br />
• Oracle WebLogic Server<br />
• JBoss (as of version 5.x)<br />
• TmaxSoft JEUS 6.x<br />
The JAXB reference implementation developed for Metro is used in virtually every Java Web Services framework<br />
(Apache Axis2, Codehaus XFire, Apache CXF) and Application Servers.
GlassFish Metro 131<br />
Features<br />
Metro compares well with other web service frameworks in terms of functionality. A comparison is provided by<br />
Codehaus at [6], which compares Apache Axis 1.x, Axis 2.x, Celtix, Glue, JBossWS, Xfire 1.2 and JAX-WS RI +<br />
WSIT (the bundle was not yet named Metro at this time).<br />
See also<br />
• Apache CXF<br />
External links<br />
• Official website [7]<br />
References<br />
[1] "metro: Discover Metro" (https:/ / metro. dev. java. net/ discover/ ). .<br />
[2] "metro: Metro FAQ" (https:/ / metro. dev. java. net/ discover/ faq. html). .<br />
[3] http:/ / blogs. sun. com/ arungupta/ entry/ announcing_metro_naming_the_web<br />
[4] https:/ / jax-ws. dev. java. net/ faq/ index. html#different_versions<br />
[5] http:/ / blogs. sun. com/ theaquarium/ entry/ metro_now_on_tomcat_6<br />
[6] http:/ / xfire. codehaus. org/ Stack+ Comparison<br />
[7] https:/ / metro. dev. java. net/
James Gosling 132<br />
James Gosling<br />
James Arthur Gosling<br />
Born May 19, 1955<br />
near Calgary, Alberta, Canada<br />
Residence United States<br />
Nationality Canada<br />
Alma mater Carnegie Mellon University, University of Calgary<br />
Occupation Computer Scientist<br />
Employer None [1]<br />
Known for Java programming language<br />
Awards Officer of the Order of Canada<br />
Website<br />
James Gosling's weblog [2]<br />
James A. Gosling, OC (born May 19, 1955 near Calgary, Alberta, Canada) is a software developer, best known as<br />
the father of the Java programming language.<br />
Education and career<br />
In 1977, James Gosling received a B.Sc in Computer Science from the University of Calgary. In 1983, he earned a<br />
Ph.D in Computer Science from Carnegie Mellon University, and his doctoral thesis was titled "The Algebraic<br />
Manipulation of Constraints". While working towards his doctorate, he wrote a version of emacs (gosmacs), and<br />
before joining Sun Microsystems he built a multi-processor version of Unix [3] while at Carnegie Mellon University,<br />
as well as several compilers and mail systems.<br />
Between 1984 and 2010, Gosling was with Sun Microsystems. He is known as the father of the Java programming<br />
language.<br />
[1] [4]<br />
On April 2, 2010, Gosling left Sun Microsystems which had recently been acquired by the Oracle Corporation.<br />
Regarding why he left, Gosling wrote on his blog that "Just about anything I could say that would be accurate and<br />
honest would do more harm than good."
James Gosling 133<br />
Contributions<br />
He is generally credited as the inventor of the Java programming language in 1994. [5] He created the original design<br />
of Java and implemented its original compiler and virtual machine. For this achievement he was elected to the<br />
United States National Academy of Engineering. He has also made major contributions to several other software<br />
systems, such as NeWS and Gosling Emacs. He co-wrote the "bundle" program, a utility thoroughly detailed in<br />
Brian Kernighan and Rob Pike's book The Unix Programming Environment.<br />
Honors<br />
In 2007, he was made an Officer of the Order of Canada. [6] The Order is Canada's highest civilian honour. Officers<br />
are the second highest grade.<br />
Books<br />
• Ken Arnold, James Gosling, David Holmes, The Java Programming Language, Fourth Edition, Addison-Wesley<br />
Professional, 2005, ISBN 0-321-34980-6<br />
• James Gosling, Bill Joy, Guy L. Steele Jr., Gilad Bracha, The Java Language Specification, Third Edition,<br />
Addison-Wesley Professional, 2005, ISBN 0-321-24678-0<br />
• Ken Arnold, James Gosling, David Holmes, The Java Programming Language, Third Edition, Addison-Wesley<br />
Professional, 2000, ISBN 0-201-70433-1<br />
• James Gosling, Bill Joy, Guy L. Steele Jr., Gilad Bracha, The Java Language Specification, Second Edition,<br />
Addison-Wesley, 2000, ISBN 0-201-31008-2<br />
• Gregory Bollella (Editor), Benjamin Brosgol, James Gosling, Peter Dibble, Steve Furr, David Hardin, Mark<br />
Turnbull, The Real-Time Specification for Java, Addison Wesley Longman, 2000, ISBN 0-201-70323-8<br />
• Ken Arnold, James Gosling, The Java programming language Second Edition, Addison-Wesley, 1997, ISBN<br />
0-201-31006-6<br />
• Ken Arnold, James Gosling, The Java programming language, Addison-Wesley, 1996, ISBN 0-201-63455-4<br />
• James Gosling, Bill Joy, Guy L. Steele Jr., The Java Language Specification, Addison Wesley Publishing<br />
Company, 1996, ISBN 0-201-63451-1<br />
• James Gosling, Frank Yellin, The Java Team, The Java Application Programming Interface, Volume 2: Window<br />
Toolkit and Applets, Addison-Wesley, 1996, ISBN 0-201-63459-7<br />
• James Gosling, Frank Yellin, The Java Team, The Java Application Programming Interface, Volume 1: Core<br />
Packages, Addison-Wesley, 1996, ISBN 0-201-63453-8<br />
• James Gosling, Henry McGilton, The Java language Environment: A white paper [7] , Sun Microsystems, 1996<br />
• James Gosling, David S. H. Rosenthal, Michelle J. Arden, The NeWS Book : An Introduction to the<br />
Network/Extensible Window System (Sun Technical Reference Library), Springer, 1989, ISBN 0-387-96915-2
James Gosling 134<br />
External links<br />
• James Gosling's personal weblog [8]<br />
• James Gosling's weblog at Sun [9]<br />
• Presentation [10] by James Gosling about the origins of Java, from the JVM Languages Summit 2008<br />
• slide show depicting Gosling's life [11]<br />
References<br />
[1] "Time to move on..." (http:/ / nighthacks. com/ roller/ jag/ entry/ time_to_move_on). James Gosling's personal blog. .<br />
[2] http:/ / nighthacks. com/ roller/ jag<br />
[3] James Gosling mentioned a multiprocessor Unix in his statement during the US vs Microsoft Antitrust DOJ trial in 1998 "DOJ/Antitrust"<br />
(http:/ / www. usdoj. gov/ atr/ cases/ f2000/ 2049. htm). Statement in MS Antitrust case. US DOJ. . Retrieved 2007-02.<br />
[4] Father of Java James Gosling quits Oracle (http:/ / opensource. cbronline. com/ news/ father_of_java_james_gosling_quits_oracle_120410)<br />
[5] "Sun Labs-The First Five Years: The First Fifty Technical Reports. A Commemorative Issue" (http:/ / portal. acm. org/ citation.<br />
cfm?id=974955& dl=GUIDE& coll=GUIDE& CFID=75229392& CFTOKEN=55758856). Ching-Chih Chang, Amy Hall, Jeanie Treichel.<br />
Sun Microsystems, Inc.. . Retrieved 2010-02-07.<br />
[6] Order of Canada announcement (http:/ / www. gg. ca/ media/ doc. asp?lang=e& DocID=4984)<br />
[7] http:/ / java. sun. com/ docs/ white/ langenv/<br />
[8] http:/ / nighthacks. com/ roller/ jag/<br />
[9] http:/ / blogs. sun. com/ jag/<br />
[10] http:/ / www. infoq. com/ presentations/ gosling-jvm-lang-summit-keynote<br />
[11] http:/ / www. eweek. com/ c/ a/ Application-Development/ The-Life-and-Times-of-Java-and-James-Gosling-746438/<br />
Gray Flimmer<br />
Gray flimmer(ing) - The constant flashing of a Java applet, usually in animation, with the refresh() method. This<br />
can usually be avoided by implementation of the update() method or by using the technique of double buffering. The<br />
singular term 'gray flimmer' refers to a single flash of an image in a Java applet. When gray flimmering occurs, the<br />
image flashes in such a way that it alternates rapidly between the actual image and a blank gray frame. This is where<br />
the term 'gray flimmering' originates.
Todd Greanier 135<br />
Todd Greanier<br />
Todd Greanier is an author and software architect, widely regarded as an expert in Java programming. [1] [2] He has<br />
written several books on the subject, including Java Foundations, which is used as a textbook in many college-level<br />
computer science programs. It has been translated into over forty languages and is the standard text for Java<br />
programmers in India, Russia, Germany, and South Africa.<br />
Once a popular instructor for Sun Microsystems, Greanier now works to develop and deliver online training<br />
programs. He was a frequent contributor to the now defunct New York Sun newspaper, [3] and was co-author (with<br />
sportswriter Sean Lahman) of three books on professional football. [4]<br />
Todd is currently working on a book on boxing history and is one of the founders (with Sean Lahman) of Bluebeard<br />
Publishing. [5]<br />
External links<br />
• Java Foundations [6] (at Google Books)<br />
• JavaWorld article on the Java Serialization API [7]<br />
References<br />
[1] From Sun Developer Network (http:/ / java. sun. com/ developer/ technicalArticles/ Programming/ serialization/ ) — "Greanier…has been<br />
teaching and developing Java since it was introduced publicly. An expert in distributed Java technologies, he teaches classes in a wide range<br />
of topics, including JDBC, RMI, CORBA, UML, Swing, servlets/JSP, security, JavaBeans, Enterprise Java Beans, and multithreading. He also<br />
creates custom seminars for corporations, slanted to their specific needs."<br />
[2] Review of Greanier's appearance at Java University. (http:/ / www. onjava. com/ pub/ a/ onjava/ 2002/ 04/ 10/ javau. html) — "Greanier, a<br />
longtime Java developer and trainer, is an engaging instructor…"<br />
[3] authors' archive at New York Sun website (http:/ / www. nysun. com/ authors/ Todd+ Greanier)<br />
[4] Listing of football books at Amazon (http:/ / www. amazon. com/ s/ ref=nb_ss_b?url=search-alias=stripbooks& field-keywords=todd+<br />
greanier+ football).<br />
[5] Bluebeard Publishing website (http:/ / bluebeardpublishing. com/ ).<br />
[6] http:/ / books. google. com/ books?hl=en& id=vbBXKgDJun0C& dq=todd+ greanier& printsec=frontcover& source=web&<br />
ots=LeJJ2zpZFA& sig=N34M4CJjzy6bSwojv-Mr6qkppIE& sa=X& oi=book_result& resnum=3& ct=result<br />
[7] http:/ / www. javaworld. com/ javaworld/ jw-07-2000/ jw-0714-flatten. html
Head First (book series) 136<br />
Head First (book series)<br />
Head First is a series of introductory instructional books to many topics, published by O'Reilly Media. It stresses an<br />
unorthodox, visually intensive, reader-involving combination of puzzles, jokes, nonstandard design and layout, and<br />
an engaging, conversational style to immerse the reader in a given topic.<br />
Originally, the series covered programming and software engineering, but is now expanding to other topics in<br />
science, mathematics and business, due to success[1]. The series was created by Bert Bates and Kathy Sierra, and<br />
began with Head First Java in 2003.<br />
Concept<br />
The main idea of the series is to effectively stimulate the brain by: [2]<br />
• Telling stories<br />
• Visualizing<br />
• Using attention-grabbing tactics: page layout, non-standard examples, puzzles, jokes, and other means.<br />
By using metacognition [3] the series' authors and editors try to employ varied methods to present information and<br />
accelerate the learning process.<br />
Books<br />
The official web site for the Head First series has forums for each book as well as code downloads and sample<br />
chapters. They include:<br />
• Head First Software Development (ISBN 0-596-52735-7) by Dan Pilone and Russ Miles<br />
• Head First PMP (ISBN 0-596-10234-8) by Jennifer Greene and Andrew Stellman<br />
• Head First Object-Oriented Analysis and Design (ISBN 0-596-00867-8) by Brett McLaughlin, Gary Pollice and<br />
David West<br />
• Head First Ajax (ISBN 0-596-51578-2) by Rebecca Riordan<br />
• Head First HTML with CSS & XHTML (ISBN 0-596-10197-X) by Elisabeth Freeman and Eric Freeman<br />
• Head First Java (ISBN 0-596-00920-8) by Kathy Sierra and Bert Bates<br />
• Head First Design Patterns (ISBN 0-596-00712-4) by Eric Freeman, Elisabeth Freeman, Kathy Sierra and Bert<br />
Bates<br />
• Head First SQL (ISBN 0-596-52684-9) by Lynn Beighley<br />
• Head First Rails (ISBN 0-596-51577-4) by David Griffiths<br />
• Head First Servlets & JSPs (ISBN 0-596-51668-1) by Bryan Basham, Kathy Sierra and Bert Bates<br />
• Head First JavaScript (ISBN 0-596-52774-8) by Michael Morrison<br />
• Head First PHP & MySQL (ISBN 0-596-00630-3) by Lynn Beighley and Michael Morrison<br />
• Head First Statistics (ISBN 0-596-52758-6) by Dawn Griffiths<br />
• Head First iPhone Development (ISBN 0-596-80354-0) by Dan Pilone and Tracey Pilone<br />
• Head First Programming (ISBN 0-596-80237-4) by Paul Barry and David Griffiths<br />
The offerings in the Head First series are quickly expanding and also delving into subjects that are not directly<br />
related to IT, such as Math (Head First Algebra, Head First Statistics), Science (Head First Physics) and project<br />
management (Head First PMP). The books are also gaining some popularity for classroom use because of their<br />
novel approach to their subject matters.
Head First (book series) 137<br />
Head First Labs<br />
O'Reilly established Head First Labs, where books of the series are presented and the main idea behind the series is<br />
explained. The Labs also hosts blogs by some of their authors and hosts some applets that complement their books.<br />
Awards<br />
The books in the series have received three nominations for Product Excellence Jolt Awards, winning in 2005 for<br />
Head First Design Patterns, and were recognized on Amazon.com's yearly top 10 list for computer books from 2003<br />
to 2005.<br />
External links<br />
• Head First Labs [4]<br />
• Blog [5] and blog archive [6] of Head First Labs<br />
References<br />
[1] http:/ / www. headfirstlabs. com/<br />
[2] "How Head First Helps You Learn" (http:/ / www. headfirstlabs. com/ about. php). . Retrieved 2008-06-08.<br />
[3] "The Head First Formula" (http:/ / www. headfirstlabs. com/ readme. php). . Retrieved 2008-06-08.<br />
[4] http:/ / www. headfirstlabs. com/ books/<br />
[5] http:/ / feeds. feedburner. com/ headfirst-oreillymedia<br />
[6] http:/ / www. headfirstlabs. com/ archive. php<br />
Jim Hugunin<br />
Jim Hugunin is a software programmer who created the Python programming language extension Numeric<br />
(ancestor to NumPy), and later created Python implementations for the Java Platform (Jython) and for Microsoft<br />
.NET platform (IronPython); he has also co-designed the AspectJ extension for the Java programming language.<br />
Since 2004 he has been working for Microsoft, mainly on IronPython and Dynamic Language Runtime [1] .<br />
References<br />
[1] Jim Hugunin blog (http:/ / blogs. msdn. com/ hugunin/ ) at MSDN
Inner class 138<br />
Inner class<br />
In object-oriented programming, an inner class (aka nested class) is a class declared entirely within the body of<br />
another class or interface. It is distinguished from a subclass.<br />
Inner classes became a feature of the Java programming language starting with version 1.1. They are also a feature of<br />
the D programming language.<br />
In Python, it is possible to nest a class within another class, method or function.<br />
Overview<br />
An instance of a normal or top-level class can exist on its own. By contrast, an instance of an inner class cannot be<br />
instantiated without being bound to a top-level class.<br />
Let us take the abstract notion of a Car with four wheels. Our wheels have a specific feature that relies on being part<br />
of our Car. This notion does not represent the wheels as wheels in a more general form that could be part of vehicle.<br />
Instead it represents them as specific to this one. We can model this notion using inner classes as follows:<br />
We have the top-level class Car. Instances of Class Car are composed of four instances of the class Wheel. This<br />
particular implementation of Wheel is specific to the car, so the code does not model the general notion of a Wheel<br />
which would be better represented as a top-level class. Therefore, it is semantically connected to the class Car and<br />
the code of Wheel is in some way coupled to its outer class.<br />
Inner classes provide us with a mechanism to accurately model this connection. We say that our wheel class is<br />
Car.Wheel, Car being the top-level class and Wheel being the inner class.<br />
Inner classes therefore allow for the object orientation of certain parts of the program that would otherwise not be<br />
encapsulated into class.<br />
Larger segments of code within a class might be better modeled or refactored as a separate top-level class, rather<br />
than an inner class. This would make the code more general in its application and therefore more re-usable but<br />
potentially might be premature generalization. This may prove more effective if code has many inner classes with<br />
the shared functionality .<br />
Types of inner class<br />
In Java there are four types of nested class:<br />
• Static member class, also simply called nested class - They are declared static. Like other things in static scope,<br />
they do not have an enclosing instance, and cannot access instance variables and methods of the enclosing class.<br />
They are almost identical to non-nested classes except for scope details (they can refer to static variables and<br />
methods of the enclosing class without qualifying the name; other classes that are not one of its enclosing classes<br />
have to qualify its name with its enclosing class's name). Nested interfaces are implicitly static.<br />
• Inner class - The following categories are called inner classes. Each instance of these classes has a reference to an<br />
enclosing instance (i.e. an instance of the enclosing class), except for local and anonymous classes declared in<br />
static context. Hence, they can implicitly refer to instance variables and methods of the enclosing class. The<br />
enclosing instance reference can be explicitly obtained via EnclosingClassName.this. Inner classes may not have<br />
static variables or methods, except for compile-time constant variables. When they are created, they must have a<br />
reference to an instance of the enclosing class; which means they must either be created within an instance<br />
method or constructor of the enclosing class, or (for member and anonymous classes) be created using the syntax<br />
enclosingInstance.new InnerClass().<br />
• Member class - They are declared outside a function (hence a "member") and not declared "static".
Inner class 139<br />
• Local class - These are classes which are declared in the body of a function. They can only be referred to in the<br />
rest of the function. They can use local variables and parameters of the function, but only ones which are<br />
declared "final". (This is because the local class instance must maintain a separate copy of the variable, as it<br />
may out-live the function; so as not to have the confusion of two modifiable variables with the same name in<br />
the same scope, the variable is forced to be non-modifiable.)<br />
• Anonymous class - These are local classes which are automatically declared and instantiated in the middle of<br />
an expression. They can only directly extend one class or implement one interface. They can specify<br />
arguments to the constructor of the superclass, but cannot otherwise have a constructor (however, this is not a<br />
limitation, since it can have an instance initializer block to perform any initialization).<br />
C++ has nested classes that are like Java's static member classes (first kind above), except that they are not declared<br />
with "static".<br />
GUI code<br />
Local inner classes are often used in Java to define callbacks for GUI code. Components can then share an object<br />
that implements an event handling interface or extends an abstract adapter class, containing the code to be executed<br />
when a given event is triggered.<br />
Anonymous inner classes are also used where the event handling code is only used by one component and therefore<br />
does not need a named reference.<br />
This avoids a large monolithic actionPerformed(ActionEvent) method with multiple if else branches to identify the<br />
source of the event. This type of code is often considered messy and the inner class variations are considered to be<br />
better in all regards.<br />
External links<br />
• So what are inner classes good for anyway? [1]<br />
• Nested classes in D [2]<br />
References<br />
[1] http:/ / www. javaworld. com/ javaworld/ javaqa/ 2000-03/ 02-qa-innerclass. html<br />
[2] http:/ / www. digitalmars. com/ d/ class. html#nested
Interface (Java) 140<br />
Interface (Java)<br />
An interface in the Java programming language is an abstract type that is used to specify an interface (in the generic<br />
sense of the term) that classes must implement. Interfaces are declared using the interface keyword, and may only<br />
contain method signatures and constant declarations (variable declarations that are declared to be both static and<br />
final). An interface may never contain method definitions.<br />
As interfaces are implicitly abstract, they cannot be directly instantiated except when instantiated by a class that<br />
implements the said interface. The class must implement all of the methods described in the interface, or be an<br />
abstract class. Object references in Java may be specified to be of an interface type; in which case, they must either<br />
be null, or be bound to an object that implements the interface.<br />
One benefit of using interfaces is that they simulate multiple inheritance. All classes in Java (other than<br />
java.lang.Object, the root class of the Java type system) must have exactly one base class; multiple inheritance of<br />
classes is not allowed. Furthermore, a Java class may implement, and an interface may extend, any number of<br />
interfaces; however an interface may not implement an interface.<br />
Overview<br />
Interfaces are used to encode similarities which classes of various types share, but do not necessarily constitute a<br />
class relationship. For instance, a human and a parrot can both whistle; however, it would not make sense to<br />
represent Humans and Parrots as subclasses of a Whistler class. Rather they would most likely be subclasses of an<br />
Animal class (likely with intermediate classes), but both would implement the Whistler interface.<br />
Another use of interfaces is being able to use an object without knowing its type of class, but rather only that it<br />
implements a certain interface. For instance, if one were annoyed by a whistling noise, one may not know whether it<br />
is a human or a parrot, because all that could be determined is that a whistler is whistling. In a more practical<br />
example, a sorting algorithm may expect an object of type Comparable. Thus, it knows that the object's type can<br />
somehow be sorted, but it is irrelevant what the type of the object is. The call whistler.whistle() will call the<br />
implemented method whistle of object whistler no matter what class it has, provided it implements Whistler.<br />
For example:<br />
interface Bounceable<br />
{<br />
void setBounce(); // Note the semicolon:<br />
implementations are allowed.<br />
}<br />
Usage<br />
Defining an interface<br />
// Interface methods are public and abstract.<br />
// Think of them as prototypes only; no<br />
Interfaces are defined with the following syntax (compare to Java's class definition):<br />
[visibility] interface InterfaceName [extends other interfaces] {<br />
}<br />
constant declarations<br />
member type declarations<br />
abstract method declarations
Interface (Java) 141<br />
The body of the interface contains abstract methods, but since all methods in an interface are, by definition, abstract,<br />
the abstract keyword is not required. Since the interface specifies a set of exposed behaviors, all methods are<br />
implicitly public.<br />
Thus, a simple interface may be<br />
public interface Predator {<br />
}<br />
boolean chasePrey(Prey p);<br />
void eatPrey(Prey p);<br />
The member type declarations in an interface are implicitly static and public, but otherwise they can be any type of<br />
class or interface. [1]<br />
The syntax for implementing an interface uses this formula:<br />
... implements InterfaceName[, another interface, another, ...] ...<br />
Classes may implement an interface. For example,<br />
public class Lion implements Predator {<br />
}<br />
public boolean chasePrey(Prey p) {<br />
}<br />
// programming to chase prey p (specifically for a lion)<br />
public void eatPrey (Prey p) {<br />
}<br />
// programming to eat prey p (specifically for a lion)<br />
If a class implements an interface and does not implement all its methods, it must be marked as abstract. If a class is<br />
abstract, one of its subclasses is expected to implement its unimplemented methods.<br />
Classes can implement multiple interfaces<br />
public class Frog implements Predator, Prey { ... }<br />
Interfaces are commonly used in the Java language for callbacks. [2] Java does not allow the passing of methods<br />
(procedures) as arguments. Therefore, the practice is to define an interface and use it as the argument and use the<br />
method signature knowing that the signature will be later implemented.<br />
Subinterfaces<br />
Interfaces can extend several other interfaces, using the same formula as described above. For example<br />
public interface VenomousPredator extends Predator, Venomous {<br />
}<br />
//interface body<br />
is legal and defines a subinterface. Note how it allows multiple inheritance, unlike classes. Note also that Predator<br />
and Venomous may possibly define or inherit methods with the same signature, say kill(Prey prey). When a class<br />
implements VenomousPredator it will implement both methods simultaneously.
Interface (Java) 142<br />
Examples<br />
Some common Java interfaces are:<br />
• Comparable has the method compareTo, which is used to describe two objects as equal, or to indicate one is<br />
greater than the other. Generics allow implementing classes to specify which class instances can be compared to<br />
them.<br />
• Serializable is a marker interface with no methods or fields - it has an empty body. It is used to indicate that a<br />
class can be serialized. Its Javadoc describes how it should function, although nothing is programmatically<br />
enforced.<br />
Java interface modifiers<br />
Access Modifier Interface Modifier<br />
public abstract<br />
strictfp<br />
Note that improper usage of modifiers of interfaces may result in unstable software behavior.<br />
See also<br />
• Mixin<br />
External links<br />
• What Is an Interface? [3]<br />
• Interfaces and Packages [4]<br />
• Difference between a Java interface and a Java abstract class [5]<br />
References<br />
[1] "The Java Language Specification" (http:/ / java. sun. com/ docs/ books/ jls/ third_edition/ html/ interfaces. html#9. 5). .<br />
[2] "Java World" (http:/ / www. javaworld. com/ javaworld/ javatips/ jw-javatip10. html). .<br />
[3] http:/ / java. sun. com/ docs/ books/ tutorial/ java/ concepts/ interface. html<br />
[4] http:/ / java. sun. com/ docs/ books/ tutorial/ java/ interpack/ index. html<br />
[5] http:/ / javapapers. com/ ?p=17
Internet Foundation Classes 143<br />
Internet Foundation Classes<br />
The Internet Foundation Classes (IFC) were a graphics library for Java originally developed by Netcode<br />
Corporation and first released by Netscape Corporation on December 16, 1996.<br />
History<br />
On April 2, 1997, Sun Microsystems and Netscape announced their intention to combine IFC with other<br />
technologies to form the Java Foundation Classes [1] .<br />
Ultimately, Sun merged the IFC with other technologies under the name "Swing", adding the capability for a<br />
pluggable look and feel of the widgets.<br />
Because its technology has been merged to constitute Swing and Java 2D, IFC is now no longer maintained.<br />
Differences with Swing<br />
Swing draw a lot of features from IFC:<br />
• contrary to AWT, IFC were written in pure Java, thus being (at the time) browser-independent.<br />
• IFC already provided two Layout managers, that would be later included in the standard JDK<br />
• some IFC components were able to read HTML content from URLs, but the implementation was still far from<br />
reliable.<br />
However, Swing also improved IFC in a lot of ways:<br />
• IFC did not have a Model-<strong>View</strong> architecture<br />
• contrary to Swing, the Look and feel of IFC components was written in the components themselves, making it<br />
impossible to change it easily.<br />
• IFC components were not JavaBeans. IFC had a specific persistence mechanism [2] , but it was a bit complex, and<br />
not compatible with the Java Serialization API.<br />
• event mechanism was still raw [3] , and the Event loop sometimes needed to be accessed directly.<br />
Examples<br />
Hello World<br />
This is the classic Hello world program in IFC:<br />
import netscape.application.*;<br />
import netscape.util.*;<br />
public class HelloWorld extends Application {<br />
public void init() {<br />
}<br />
super.init();<br />
// Create a text field<br />
TextField textField = new TextField(100, 24, 128, 24);<br />
// Set the string to be displayed in the text field.<br />
textField.setStringValue("Hello World");<br />
// Add the text field to the view hierarchy.<br />
mainRoot<strong>View</strong>().addSubview(textField);
Internet Foundation Classes 144<br />
// This method allows HelloWorld to run as a stand alone<br />
application.<br />
}<br />
public static void main(String args[]) {<br />
}<br />
HelloWorld = new HelloWorld ();<br />
ExternalWindow mainWindow = new ExternalWindow();<br />
Size size;<br />
app.setMainRoot<strong>View</strong>(mainWindow.root<strong>View</strong>());<br />
size = mainWindow.windowSizeForContentSize(320, 200);<br />
mainWindow.sizeTo(size.width, size.height);<br />
mainWindow.show();<br />
app.run();<br />
To be compared with the equivalent Java Swing code:<br />
import javax.swing.*;<br />
public class HelloWorld extends JFrame {<br />
}<br />
public HelloWorld() {<br />
}<br />
setDefaultCloseOperation(DISPOSE_ON_CLOSE);<br />
add(new JLabel("Hello, World!"));<br />
public static void main(String[] args) {<br />
}<br />
See also<br />
• Swing<br />
HelloWorld app = new HelloWorld();<br />
app.pack();<br />
External links<br />
• IFC presentation [4]<br />
app.setVisible(true);<br />
• IFC runtime download [5]<br />
• IFC programming guide [6]<br />
• IFC class hierarchy [7]<br />
• IFC tutorial [8]<br />
The last places, where to download the IFC:<br />
• ftp-Server 1 Uni-Potsdam [9]<br />
• ftp-Server 2 Uni-Potsdam [10]<br />
• ftp-Server 3 Uni-Potsdam [11]
Internet Foundation Classes 145<br />
• ftp-Server Uni-Bochum [12]<br />
• ftp-Server SunSite [13]<br />
All find from<br />
• FileSearching.com [14]<br />
The web-archive where is the last place to find really all files:<br />
• WebArchive of the IFC-side [15]<br />
References<br />
[1] "Sun and Netscape to jointly develop Java Foundation Classes" (http:/ / wp. netscape. com/ newsref/ pr/ newsrelease378. html). Netscape<br />
Communications Corporation. 1997-04-02. . Retrieved 2007-07-14.<br />
[2] "IFC 1.1 guide - Persistence" (http:/ / infodoc. unicaen. fr/ docs/ Java/ guide. IFC1. 1/ persist. mak. html#1004819). 2000-06-15. . Retrieved<br />
2007-07-15.<br />
[3] "IFC 1.1 guide - Targets and commands" (http:/ / infodoc. unicaen. fr/ docs/ Java/ guide. IFC1. 1/ targets. mak. html#100582). 2000-06-15. .<br />
Retrieved 2007-07-15.<br />
[4] http:/ / www. phdcc. com/ javaart2. html<br />
[5] http:/ / wp. netscape. com/ eng/ ifc/ download. html<br />
[6] http:/ / infodoc. unicaen. fr/ docs/ Java/ guide. IFC1. 1/<br />
[7] http:/ / infodoc. unicaen. fr/ docs/ Java/ Reference. IFC1. 1/ tree. html<br />
[8] http:/ / infodoc. unicaen. fr/ docs/ Java/ cookbook/<br />
[9] ftp:/ / ftp. uni-potsdam. de/ pub/ WWW/ Netscape/ navigator/ plugins/ ifc/ 1. 0/<br />
[10] ftp:/ / ftp. uni-potsdam. de/ pub/ WWW/ clients/ netscape/ plugins/ ifc/ 1. 0/<br />
[11] ftp:/ / ftp. uni-potsdam. de/ pub/ WWW/ netscape/ navigator/ plugins/ ifc/ 1. 0/<br />
[12] ftp:/ / ftp. ruhr-uni-bochum. de/ . subdisc1/ local/ jk. collection/<br />
[13] ftp:/ / ftp. anu. edu. au/ sunsite/ mnt/ disk3/ WWW/ netscape/ navigator/ plugins/ ifc/ 1. 0/<br />
[14] http:/ / www. filesearching. com/ cgi-bin/ s?q=nsifc10<br />
[15] http:/ / web. archive. org/ web/ 20001021124345/ developer. netscape. com/ docs/ manuals/ ifc/ downloads/ downloads. html
JAD (JAva Decompiler) 146<br />
JAD (JAva Decompiler)<br />
Developer(s) Pavel Kouznetsov<br />
Initial release Before 1999<br />
Written in C++<br />
Operating<br />
system<br />
Cross-platform<br />
Available in English<br />
Type Software engineering<br />
License Free for non-commercial use (Copyright: Pavel Kouznetsov)<br />
Jad (JAva Decompiler) is a decompiler for the Java programming language. Jad provides a command-line user<br />
interface to extract source code from class files. The most popular GUI for Jad is DJ Java Decompiler http:/ /<br />
members. fortunecity. com/ neshkov/ dj. html. According to CNET.com, in the past 8 years the various versions of<br />
DJ Java Decompiler has been downloaded over 10 Million times. A graphical user interface for Jad is JadClipse<br />
which is a plugin to the Eclipse IDE.<br />
The domain name used by the official website expired on 02/25/2009.<br />
The most recent version of JAD says it supports only Java versions 45.3, 46.0 and 47.0, not Java 5.<br />
A similar alternative, JD-Core [1] , has emerged that supports JDK 1.1.8 to JDK 1.6.0, jrockit90_150, jikes-1.2.2,<br />
harmony-jdk.<br />
See also<br />
• Mocha (decompiler)<br />
External links<br />
• New download site [2]<br />
• JadClipse plugin for Eclipse IDE [3]<br />
• JadRetro decompiler helper for Jad [4]<br />
• uuDeJava decompiler helper for Jad [5]<br />
• Original Jad site, including downloads [6] at the Wayback Machine (archived February 14, 2008).<br />
• DJ Java Decompiler New homepage [7]<br />
References<br />
[1] http:/ / java. decompiler. free. fr/<br />
[2] http:/ / www. varaneckas. com/ jad<br />
[3] http:/ / jadclipse. sf. net/<br />
[4] http:/ / jadretro. sourceforge. net/<br />
[5] http:/ / www. uuware. com/ uudejava_en. htm<br />
[6] http:/ / web. archive. org/ web/ 20080214075546/ http:/ / www. kpdus. com/ jad. html<br />
[7] http:/ / www. neshkov. com/ dj. html
JAD (file format) 147<br />
JAD (file format)<br />
Filename extension .jad<br />
Internet media<br />
type<br />
text/vnd.sun.j2me.app-descriptor<br />
Developed by Sun Microsystems, Inc.<br />
Type of format Descriptor file<br />
Standard(s) Java application<br />
Java Application Descriptor (JAD) files describe the MIDlets (Java ME applications) that are distributed as JAR<br />
files. JAD files are commonly used to package Java applications or games that can be downloaded to mobile phones.<br />
Java applications enable Mobile phones to interact programmatically with online web services, such as the ability to<br />
send SMS messages via GSM mobile internet or interact in multiplayer games. Some BlackBerry devices use JAD<br />
files for themes.<br />
Recent midlets contain a manifest file in the JAR archive. This file contains much of the information stored in the<br />
JAD file, rendering it unnecessary in most cases.<br />
JAD files format<br />
MIDlet-1: , , <br />
MIDlet-Jar-Size: <br />
MIDlet-Jar-URL: <br />
MIDlet-Name: <br />
MIDlet-Vendor: <br />
MIDlet-Version: <br />
MicroEdition-Configuration: <br />
MicroEdition-Profile: <br />
JAD mime type<br />
The MIDP2 specification instructs that web servers should serve JAD files with a MIME type of<br />
"text/vnd.sun.j2me.app-descriptor". If this mime type is not correctly configured, many phones will<br />
fail to install the midlet.<br />
See also<br />
• .sis<br />
• Decompilation<br />
• Mobile development<br />
• Midp2
JAD (file format) 148<br />
External links<br />
• JADs and JARs [1]<br />
• Retrieving MIDlet Attributes [2]<br />
• Online check of JAD file syntax and mime type [3]<br />
References<br />
[1] http:/ / developers. sun. com/ mobility/ learn/ midp/ lifecycle/ #jadsnjars<br />
[2] http:/ / developers. sun. com/ mobility/ midp/ ttips/ getAppProperty/<br />
[3] http:/ / jadcheck. appspot. com
JAMWiki 149<br />
JAMWiki<br />
Developer(s) Ryan Holliday<br />
Initial release June 30, 2006<br />
Stable release 0.9.1 / July 26, 2010<br />
Written in Java, servlets and JSP<br />
Operating<br />
system<br />
Cross-platform<br />
Type wiki software<br />
License GNU Lesser General Public License<br />
Website http:/ / www. jamwiki. org<br />
JAMWiki is wiki software built around the standard components of Java, servlets and JSP. It was written by Ryan<br />
Holliday and released under the LGPL. While for the user JAMWiki is highly similar to MediaWiki and even uses<br />
the same wiki syntax (including templates, etc), it is not a MediaWiki clone but independent implementation, written<br />
in a different language and using a different database schema.<br />
JAMWiki internally uses Spring framework and has two code generation layers: servlets (that can be mapped to the<br />
various special pages of the wiki) and JSP (for the final page generation). Servlet (that is similar to standard servlet<br />
but is not exactly the same class) receives HTTP request, does all processing and puts the name-value pairs into<br />
provided context data structure ("model"). On the next stage, JSP uses these values to build the final output. Search<br />
is implemented using Lucene. Build system is currently powered by Maven.<br />
JamWiki runs inside Tomcat, Glassfish or other similar server and supports a wide range of databases to store the<br />
data.<br />
History<br />
Ryan Holliday started developing JAMWiki in June 2006. [1]<br />
Features<br />
• Wikipedia style syntax - At the present time JAMWiki supports the majority of the Mediawiki syntax including:<br />
• User watchlists.<br />
• Mediawiki footnotes (references).<br />
• Mediawiki templates (recent releases also support conditional constructs)<br />
• Mediawiki categories.<br />
• Image support (including automatic image resizing).<br />
• Topic delete / undelete.<br />
• Topic versioning.<br />
• Searching (powered by Lucene)<br />
• Page move/redirect<br />
• Internationalization - JAMWiki uses UTF-8 unicode as its standard encoding, making it work in languages such<br />
as Japanese and Chinese.<br />
• XML import / export - JAMWiki can import and export topics in Mediawiki-compatible XML format.
JAMWiki 150<br />
External links<br />
• Official JAMWiki wiki [2]<br />
Sites using JAMWiki<br />
• MathEclipse.org [3]<br />
• linux.org.ru [4]<br />
• WingS Framework [5]<br />
• uniBlogger [6]<br />
• Ultrastudio.org [7]<br />
References<br />
[1] Ryan Holliday's blog 2006-06 (http:/ / www. mountaininterval. org/ journal-2006-06. html#20060623)<br />
[2] http:/ / www. jamwiki. org/<br />
[3] http:/ / www. matheclipse. org<br />
[4] http:/ / www. linux. org. ru/ wiki/<br />
[5] http:/ / wingsframework. org/ wiki/<br />
[6] http:/ / www. uniblogger. com<br />
[7] http:/ / ultrastudio. org
JGroups 151<br />
JGroups<br />
Stable release 2.6.3 / June 30, 2008<br />
Development status Active<br />
Written in Java<br />
Operating system Cross-platform<br />
Type reliable multicast system<br />
License GNU Lesser General Public License<br />
Website http:/ / www. jgroups. org/<br />
JGroups is a reliable multicast system that's written in the Java language.<br />
JGroups adds a "grouping" layer over a transport protocol, internally keeping a list of participants. This list is used<br />
to:<br />
• Make the application aware of the listeners<br />
• Make some or all transmissions reliable<br />
• Allow atomic (all or none) transmissions<br />
• Allow totally ordered transmissions<br />
JGroups is a toolkit for reliable multicast communication. It can be used to create groups of processes whose<br />
members can send messages to each other. JGroups enables developers to create reliable multipoint (multicast)<br />
applications where reliability is a deployment issue. JGroups also relieves the application developer from<br />
implementing this logic themselves. This saves significant development time and allows for the application to be<br />
deployed in different environments without having to change code.<br />
JGroups Features<br />
• Group creation and deletion. Group members can be spread across LANs or WANs<br />
• Joining and leaving of groups<br />
• Membership detection and notification about joined/left/crashed members<br />
• Detection and removal of crashed members<br />
• Sending and receiving of member-to-group messages (point-to-multipoint)<br />
• Sending and receiving of member-to-member messages (point-to-point)<br />
Flexible Protocol Stack<br />
The most powerful feature of JGroups is its flexible protocol stack, which allows developers to adapt it to exactly<br />
match their application requirements and network characteristics. The benefit of this is that you only pay for what<br />
you use. By mixing and matching protocols, various differing application requirements can be satisfied. JGroups<br />
comes with a number of protocols (but anyone can write their own), for example<br />
• Transport protocols: UDP (IP Multicast), TCP, JMS<br />
• Fragmentation of large messages<br />
• Reliable unicast and multicast message transmission. Lost messages are retransmitted<br />
• Failure detection: crashed members are excluded from the membership<br />
• Ordering protocols: Atomic (all-or-none message delivery), Fifo, Causal, Total Order (sequencer or token based)<br />
• Membership<br />
• Encryption
JGroups 152<br />
External links<br />
• The JGroups website [1]<br />
• A simple request distribution example in JGroups [2]<br />
• A slideshow presenting JGroups [3]<br />
References<br />
[1] http:/ / www. jgroups. org/ javagroupsnew/ docs/ index. html<br />
[2] http:/ / www. alishomepage. com/ Scholar/ Master/ JGroups/ RequestDistributor. java<br />
[3] http:/ / www. alishomepage. com/ Scholar/ Master/ JGroups/ Slideshow. pdf<br />
JPicus<br />
JPicus is a Java TM I/O analysis framework. It consists of the following major parts:<br />
• Agent - it plugs into the Java TM Virtual Machine and collects I/O analysis data, like open file handles, byte<br />
counters etc<br />
• User interface - Eclipse based user interface that lets the user take a snapshot and visualise it<br />
JPicus is similar to Java CPU and memory allocation profilers with the difference that it operates in the I/O domain.<br />
External links<br />
• Official site [1]<br />
References<br />
[1] http:/ / jpicus. com
Java Class Library 153<br />
Java Class Library<br />
The Java Class Library is a set of<br />
dynamically loadable libraries that<br />
Java applications can call at runtime.<br />
Because the Java Platform is not<br />
dependent on any specific operating<br />
system, applications cannot rely on any<br />
of the existing libraries. Instead, the<br />
Java Platform provides a<br />
comprehensive set of standard class<br />
libraries, containing much of the same<br />
reusable functions commonly found in<br />
modern operating systems.<br />
The Java class libraries serve three purposes within the Java Platform:<br />
Java Platform diagram<br />
• Like other standard code libraries, they provide the programmer a well-known set of functions to perform<br />
common tasks, such as maintaining lists of items or performing complex string parsing.<br />
• In addition, the class libraries provide an abstract interface to tasks that would normally depend heavily on the<br />
hardware and operating system. Tasks such as network access and file access are often heavily dependent on the<br />
native capabilities of the platform.<br />
• Finally, some underlying platforms may not support all of the features a Java application expects. In these cases,<br />
the class libraries can either emulate those features using whatever is available, or provide a consistent way to<br />
check for the presence of a specific feature.<br />
Architecture<br />
The Java Class Library is almost entirely written in Java itself, except for the parts that need direct access to the<br />
hardware and operating system (such as for I/O, or bitmap graphics). The classes that give access to these functions<br />
commonly use native interface wrappers to access the API of the operating system.<br />
Almost all of the Java Class Library is stored in a single Java archive file called "rt.jar", which is provided with JRE<br />
and JDK distributions. The Java Class Library (rt.jar) is located in the default bootstrap classpath [1] , and does not<br />
have to be found in the classpath declared for the application.<br />
Conformance<br />
Any Java implementation must pass the Java Technology Compatibility Kit tests for compliance.<br />
Main Features<br />
Features of the Class Library are accessed through classes grouped by packages.<br />
• java.lang contains fundamental classes and interfaces closely tied to the language and runtime system.<br />
• I/O and networking: access to the platform file system, and more generally to networks, is provided through the<br />
java.io, java.nio, and java.net packages.<br />
• Mathematics package: java.math provides regular mathematical expressions, as well as arbitrary-precision<br />
decimals and integers numbers.<br />
• Collections and Utilities : provide built-in Collection data structures, and various utility classes, for Regular<br />
expressions, Concurrency, logging and Data compression.
Java Class Library 154<br />
• GUI and 2D Graphics: the java.awt package supports basic GUI operations and binds to the underlying native<br />
system. It also contains the 2D Graphics API. The javax.swing package is built on AWT and provides a platform<br />
independent widget toolkit, as well as a Pluggable look and feel. It also deals with editable and non-editable text<br />
components.<br />
• Sound: provides interfaces and classes for reading, writing, sequencing, and synthesizing of sound data.<br />
• Text: the java.text package deals with text, dates, numbers, and messages.<br />
• Image package: java.awt.image and javax.imageio provide APIs to write, read, and modify images.<br />
• XML: built-in classes handle SAX, DOM, StAX, XSLT transforms, XPath, and various APIs for Web services, as<br />
SOAP protocol and JAX-WS.<br />
• CORBA and RMI APIs, including a built-in ORB<br />
• Security and Cryptography<br />
• Databases: access to SQL databases is provided through the java.sql package.<br />
• Access to Scripting engines: the javax.script package gives access any Scripting language that conforms to this<br />
API.<br />
• Applets: java.applet allows applications to be downloaded over a network and run within a guarded sandbox<br />
• Java Beans: java.beans provides ways to manipulate reusable components.<br />
Licensing<br />
Following their promise to release a fully buildable JDK based almost completely on free and open source code in<br />
the first half of 2007 [2] , Sun released the complete source code of the Class Library under the GPL on May 8, 2007,<br />
except some limited parts that were licensed by Sun from third parties who did not want their code to be released<br />
under a free and open-source license. [3] Sun's goal is to replace the parts that remain proprietary and closed source<br />
with alternative implementations and make the Class Library completely free and open source. [4]<br />
As of May 2008, the only part of the Class library that remain proprietary and closed-source (4% as of May 2007 for<br />
OpenJDK 7 [5] , and less than 1% as of May 2008 and OpenJDK 6 [6] [7] ) is [8] [9] :<br />
• The SNMP implementation [9] .<br />
Since the first May 2007 release, Sun Microsystems, with the help of the community, has released as Open-source or<br />
replaced with Open-source alternatives almost all the encumbered code:<br />
• All the audio engine code, including the software synthetizer, has been released as Open-source [9] [10] . The<br />
closed-source software synthesizer has been replaced by a new synthesizer developed specifically for OpenJDK<br />
called Gervill [11] ,<br />
• All cryptography classes used in the Class library have been released as Open-source [12] ,<br />
[13] [14] [15]<br />
• The code that scales and rasterizes fonts has been replaced by FreeType<br />
• The native color management system has been replaced by LittleCMS [14] . There is a pluggable layer in the JDK,<br />
so that the commercial version can use the old color management system and OpenJDK can use LittleCMS.<br />
• The anti-aliasing graphics rasterizer code has been replaced by the Open-sourced Pisces renderer used in the<br />
phoneME project [14] [16] [17] . This code is fully functional, but still needs some performance enhancements [18] ,<br />
• The Javascript plugin has been open-sourced (the JavaScript engine itself was open-sourced from the<br />
beginning) [19] .
Java Class Library 155<br />
Alternative implementations<br />
GNU Classpath is the other main free software class library for Java. Contrary to other implementations, it only<br />
implements the Class Library, and is used by many free Java runtimes (like Kaffe, SableVM, JamVM, CACAO).<br />
Apache Harmony is another free software class library. Its aim is to also implement the other parts of the Java stack<br />
(Virtual Machine, Compiler, and other tools required for any Java implementation).<br />
See also<br />
• Java Platform, Standard Edition<br />
• List of Java APIs<br />
• OpenJDK<br />
• Free Java implementations<br />
• Standard library<br />
• Java applet<br />
External links<br />
• Java SE Main page [20]<br />
• Java SE 6 API Javadocs<br />
• Java SE API documentation [21]<br />
• Java software development kits (status as of August 2006):<br />
• 1.7 [22] (early development)<br />
• 1.6 [23] (stable, current)<br />
• 1.5 [24] (stable)<br />
• 1.4 [25] (stable)<br />
• 1.3 [26] (obsolete)<br />
References<br />
[1] How Classes are Found (http:/ / java. sun. com/ javase/ 6/ docs/ technotes/ tools/ findingclasses. html)<br />
[2] http:/ / www. sun. com/ software/ opensource/ java/ faq. jsp#b4<br />
[3] "Open JDK is here!" (http:/ / mail. openjdk. java. net/ pipermail/ announce/ 2007-May. txt). Sun Microsystems. 2007-05-08. . Retrieved<br />
2007-05-09.<br />
[4] Since there's some encumbered code in the JDK, Sun will continue to use that code in commercial releases until it is replaced by<br />
fully-functional free and open-source alternatives.<br />
[5] Fitzsimmons, Thomas (2007-05-18). "Plans for OpenJDK" (http:/ / fitzsim. org/ blog/ ?p=17). . Retrieved 2007-05-22.<br />
[6] Angel, Lillian (2008-03-13). "OpenJDK to replace IcedTea in Fedora 9" (http:/ / langel. wordpress. com/ 2008/ 03/ 13/ openjdk-in-fedora-9/<br />
). . Retrieved 2008-04-05.<br />
[7] Wade, Karsten (2008-03-13). "OpenJDK in Fedora 9!" (http:/ / developer. redhatmagazine. com/ 2008/ 03/ 12/<br />
openjdk-to-replace-icedtea-in-fedora-9/ ). redhatmagazine.com. . Retrieved 2008-04-05. "Thomas Fitzsimmons updated the Fedora 9 release<br />
notes source pages to reflect that Fedora 9 would ship with OpenJDK 6 instead of the IcedTea implementation of OpenJDK 7. Fedora 9<br />
(Sulphur) is due to release in May 2008."<br />
[8] Herron, David (2007-10-04). "Plans for OpenJDK" (http:/ / weblogs. java. net/ blog/ robogeek/ archive/ 2007/ 10/ openjdk_encumbr. html). .<br />
Retrieved 2007-10-09.<br />
[9] "OpenJDK 6 b10 source posted" (http:/ / mail. openjdk. java. net/ pipermail/ jdk6-dev/ 2008-May/ 000058. html). 2008-05-30. . Retrieved<br />
2008-06-01.<br />
[10] audio-engine project page (http:/ / openjdk. java. net/ projects/ audio-engine/ )<br />
[11] "Gervill - Software Synthesizer" (https:/ / gervill. dev. java. net/ ). . Retrieved 2008-06-01.<br />
[12] "Crypto has been added to OpenJDK" (http:/ / mail. openjdk. java. net/ pipermail/ security-dev/ 2007-September/ 000015. html).<br />
2007-09-27. . Retrieved 2007-10-07.<br />
[13] font-scaler projectpage (http:/ / openjdk. java. net/ projects/ font-scaler/ )<br />
[14] Java2D project page (http:/ / openjdk. java. net/ groups/ 2d/ )
Java Class Library 156<br />
[15] "Freetype font rasteriser" (http:/ / mail. openjdk. java. net/ pipermail/ font-scaler-dev/ 2007-August/ 000011. html). 2007-08-07. . Retrieved<br />
2007-11-24.<br />
[16] phoneme.dev.java.net/ (https:/ / phoneme. dev. java. net/ )<br />
[17] graphics-rasterizer project page (http:/ / openjdk. java. net/ projects/ graphics-rasterizer/ )<br />
[18] Graham, Jim (2007-10-03). "Open Source rasterizer" (http:/ / mail. openjdk. java. net/ pipermail/ 2d-dev/ 2007-October/ 000078. html). Sun<br />
Microsystems. . Retrieved 2007-05-09.<br />
[19] "Javascript is encumbered and there is no javascript plugin support." (http:/ / icedtea. classpath. org/ bugzilla/ show_bug. cgi?id=85).<br />
IcedTea. 2008-03-11. . Retrieved 2008-06-01. "Changing Summary. JavaScript is no longer encumbered, but we still need liveconnect<br />
support."<br />
[20] http:/ / java. sun. com/ j2se/<br />
[21] http:/ / java. sun. com/ reference/ api/ index. html<br />
[22] https:/ / jdk7. dev. java. net/<br />
[23] http:/ / java. sun. com/ javase/ 6/<br />
[24] http:/ / java. sun. com/ j2se/ 1. 5. 0/<br />
[25] http:/ / java. sun. com/ j2se/ 1. 4. 2/<br />
[26] http:/ / java. sun. com/ j2se/ 1. 3/<br />
Java Classloader<br />
The Java Classloader is a part of the Java Runtime Environment that dynamically loads Java classes into the Java<br />
Virtual Machine [1] . Usually classes are only loaded on demand. The Java run time system does not need to know<br />
about files and file systems because of class loaders. Delegation is an important concept to understand when learning<br />
about class loaders.<br />
A software library is a collection of more or less related object code. In the Java language, libraries are typically<br />
packaged in Jar files. Libraries can contain objects of different types. The most important type of object contained in<br />
a Jar file is a Java class. A class can be thought of as a named unit of code. The class loader is responsible for<br />
locating libraries, reading their contents, and loading the classes contained within the libraries. This loading is<br />
typically done "on demand", in that it does not occur until the class is actually used by the program. A class with a<br />
given name can only be loaded once by a given classloader.<br />
Class loading process<br />
Each Java class must be loaded by a class loader [2] . Furthermore, Java programs may make use of external libraries<br />
(that is, libraries written and provided by someone other than the author of the program) or may itself be composed,<br />
at least in part, by a number of libraries.<br />
When the JVM is started, three class loaders are used [3] [4] :<br />
1. Bootstrap class loader<br />
2. Extensions class loader<br />
3. System class loader<br />
The bootstrap class loader loads the core Java libraries [5] (/lib directory). This class loader, which<br />
is part of the core JVM, is written in native code.<br />
The extensions class loader loads the code in the extensions directories (/lib/ext or any other<br />
directory specified by the java.ext.dirs system property). It is implemented by the<br />
sun.misc.Launcher$ExtClassLoader class.<br />
The system class loader loads code found on java.class.path, which maps to the system CLASSPATH variable. This<br />
is implemented by the sun.misc.Launcher$AppClassLoader class.
Java Classloader 157<br />
User-defined class loaders<br />
By default, all user classes are loaded by the default system class loader, but it is possible to replace it by a<br />
user-defined ClassLoader (which defaults to the original root system class loader), and even to chain class loaders<br />
as desired.<br />
This makes it possible (for example):<br />
• to load or unload classes at runtime (for example to load libraries dynamically at runtime, even from a HTTP<br />
resource). This is an important feature for:<br />
• implementing scripting languages,<br />
• using bean builders,<br />
• allowing user-defined extensibility<br />
• allowing multiple namespaces to communicate. This is one of the foundations of CORBA / RMI protocols, for<br />
example.<br />
• to change the way the bytecode is loaded (for example, it is possible to use encrypted Java class bytecode [6] ).<br />
• to modify the loaded bytecode (for example, for load-time weaving of aspects when using Aspect Oriented<br />
Programming).<br />
Class Loaders in JEE<br />
Java Platform, Enterprise Edition (JEE) application servers typically load classes from a deployed WAR or EAR<br />
archive by a tree of Classloaders, isolating the application from other applications, but sharing classes between<br />
[2] [7]<br />
deployed modules. So-called "servlet containers" are typically implemented in terms of multiple classloaders<br />
JAR hell<br />
JAR hell is a term similar to DLL hell used to describe all the various ways in which the classloading process can<br />
end up not working. [8] Three ways JAR hell can occur are explained below:<br />
• The first case is when a developer or deployer of a Java application has accidentally made two different versions<br />
of a library available to the system. This will not be considered an error by the system. Rather, the system will<br />
load classes from one or the other library. Adding the new library to the list of available libraries instead of<br />
replacing it, may see the application still behaving as though the old library is in use, which it may well be.<br />
• Another version of the problem arises when two libraries (or a library and the application) require different<br />
versions of the same third library. If both versions of the third library use the same class names, there is no way to<br />
load both versions of the third library with the same classloader.<br />
• The most complex JAR hell problems arise in circumstances that take advantage of the full complexity of the<br />
classloading system. A Java program is not required to use only a single "flat" classloader, but instead may be<br />
composed of several (or, in fact, an indefinite number of) nested, cooperating classloaders. Classes loaded by<br />
different classloaders may interact in complex ways not fully comprehended by a developer, leading to<br />
inexplicable errors or bugs.<br />
The OSGi Alliance specified (starting as JSR 8 in 1998) a modularity framework that solved JAR hell for current<br />
and future VMs both in ME, SE, and EE that is widely adopted. Using metadata in the JAR manifest, JAR files<br />
(called bundles) are wired on a per-package basis. Bundles can export packages, import packages and keep packages<br />
private, providing the basic constructs of modularity and versioned dependency management.<br />
To remedy the JAR hell problems a Java Community Process — JSR 277 was initiated in 2005. The resolution —<br />
Java Module System — intended to introduce a new distribution format, modules versioning scheme and a common<br />
modules repository (similar in purpose to Microsoft .NET's Global Assembly Cache). In December 2008 Sun<br />
announced that JSR 277 was put on hold [9] .
Java Classloader 158<br />
See also<br />
• Loader (computing)<br />
• Dynamic loading<br />
• DLL hell<br />
• OSGi<br />
• Apache Maven, automated software build tool with dependency management<br />
External links<br />
• Brandon E. Taylor, "Java Class Loading: The Basics [10] ", 2003<br />
• Jeff Hanson, "Take Control of Class Loading in Java [11] ", 2006-06-01<br />
• Andreas Schaefer, "Inside Class Loaders [12] ", 2003-11-12<br />
• Sheng Liang and Gilad Bracha, "Dynamic class loading in the Java virtual machine [13] ", In Proceedings of the<br />
13 th ACM Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA'98),<br />
ACM SIGPLAN Notices, vol. 33, no. 10, ACM Press, 1998, pp. 36–44<br />
• Dr. Christoph G. Jung, "Classloaders Revisited Hotdeploy [14] ", Java Specialist Newsletter, 2001-06-07<br />
• Don Schwarz, "Managing Component Dependencies Using ClassLoaders [15] ", 2005-04-13<br />
References<br />
[1] "The basics of Java class loaders" (http:/ / www. javaworld. com/ javaworld/ jw-10-1996/ jw-10-indepth. html). JavaWorld. 1996-10-01. .<br />
Retrieved 2008-01-26.<br />
[2] Christudas, Binildas (2005-01-26). "Internals of Java Class Loading" (http:/ / www. onjava. com/ pub/ a/ onjava/ 2005/ 01/ 26/ classloading.<br />
html). onjava.com. . Retrieved 2009-10-02.<br />
[3] "Understanding Extension Class Loading" (http:/ / java. sun. com/ docs/ books/ tutorial/ ext/ basics/ load. html). java.sun.com. 2008-02-14. .<br />
Retrieved 2009-12-08.<br />
[4] Sosnoski, Dennis (2003-04-29). "Classes and class loading" (http:/ / www. ibm. com/ developerworks/ java/ library/ j-dyn0429/ ). ibm.com. .<br />
Retrieved 2008-01-26.<br />
[5] These libraries are stored in Jar files called rt.jar, core.jar, server.jar, etc.<br />
[6] Roubtsov, Vladimir (2003-05-09). "Cracking Java byte-code encryption" (http:/ / www. javaworld. com/ javaworld/ javaqa/ 2003-05/<br />
01-qa-0509-jcrypt. html?page=1). javaworld.com. . Retrieved 2008-01-26.<br />
[7] deBoer, Tim; Karasiuk, Gary (2002-08-21). "J2EE Class Loading Demystified" (http:/ / www-128. ibm. com/ developerworks/ websphere/<br />
library/ techarticles/ 0112_deboer/ deboer. html). ibm.com. . Retrieved 2008-01-26.<br />
[8] http:/ / incubator. apache. org/ depot/ version/ jar-hell. html<br />
[9] http:/ / www. osgi. org/ News/ 20081217<br />
[10] http:/ / www. developer. com/ java/ other/ article. php/ 2248831<br />
[11] http:/ / www. devx. com/ Java/ Article/ 31614<br />
[12] http:/ / www. onjava. com/ pub/ a/ onjava/ 2003/ 11/ 12/ classloader. html<br />
[13] http:/ / citeseer. ist. psu. edu/ liang98dynamic. html<br />
[14] http:/ / www. roseindia. net/ javatutorials/ hotdeploy. shtml<br />
[15] http:/ / www. onjava. com/ pub/ a/ onjava/ 2005/ 04/ 13/ dependencies. html?page=1
Java compiler 159<br />
Java compiler<br />
A Java compiler is a compiler for the Java programming language. The most common form of output from a Java<br />
compiler are Java class files containing platform-neutral Java bytecode. There exist also compilers emitting<br />
optimized native machine code for a particular hardware/operating system combination.<br />
Most Java-to-bytecode compilers, Jikes being a well known exception, do virtually no optimization, leaving this<br />
until runtime to be done by the JRE.<br />
The Java Virtual Machine (JVM) loads the class files and either interprets the bytecode or just-in-time compiles it to<br />
machine code and then possibly optimizes it using dynamic compilation.<br />
The very first Java compiler developed by Sun Microsystems was written in C using some libraries from C++.<br />
Major Java compilers<br />
As of 2010, the following are major Java compilers:<br />
• javac, included in JDK from Sun Microsystems, open-sourced since 13 November 2006.<br />
• GCJ, a part of gcc which compiles C, Fortran, Pascal and other programming languages besides Java. It can also<br />
generate native code using the back-end of gcc.<br />
• ECJ, the Eclipse Compiler for Java, is an open source incremental compiler used by the Eclipse JDT.<br />
Java decompilers<br />
A Java decompiler tries to reverse the process of compiling, that is it tries to decompile Java bytecode files (*.class)<br />
back to Java source files (*.java).<br />
• DJ Java Decompiler [1] (Uses JAD) 10 use trial version<br />
• JAD, written in C++, free for non-commercial use.<br />
• JD [1], younger project, includes GUI, optional Eclipse-plugin.<br />
• JODE [2], decompiler and optimizer, open-source.<br />
• Mocha, one of the first decompilers for Java.<br />
External links<br />
• Sun's OpenJDK javac page [3]<br />
• Jikes homepage [4]<br />
• JSR 199 [5] Java Compiler API Java Specification Request for invoking the Java compiler from a Java program<br />
References<br />
[1] http:/ / www. neshkov. com/<br />
[2] http:/ / jode. sourceforge. net/<br />
[3] http:/ / openjdk. java. net/ groups/ compiler/<br />
[4] http:/ / jikes. sourceforge. net/<br />
[5] http:/ / www. jcp. org/ en/ jsr/ detail?id=199
Java Development Kit 160<br />
Java Development Kit<br />
Developer(s) Sun Microsystems (Owned by Oracle Corporation)<br />
Stable release<br />
Preview release<br />
Operating<br />
system<br />
6 Update 21 [1] / July 7, 2010<br />
JDK 7 Preview Release, Build b101 / July 15, 2010 [2]<br />
Cross-platform<br />
Type Software development kit<br />
License Sun License (most of it also under GPL)<br />
Website http:/ / java. sun. com/ javase/<br />
The Java Development Kit (JDK) is a Sun Microsystems product aimed at Java developers. Since the introduction<br />
of Java, it has been by far the most widely used Java SDK. On 17 November 2006, Sun announced that it would be<br />
released under the GNU General Public License (GPL), thus making it free software. This happened in large part on<br />
8 May 2007 [3] ; Sun contributed the source code to the OpenJDK.<br />
JDK contents<br />
The JDK has as its primary components a collection of programming tools, including:<br />
• java – the loader for Java applications. This tool is an interpreter and can interpret the class files generated by the<br />
javac compiler. Now a single launcher is used for both development and deployment. The old deployment<br />
launcher, jre, no longer comes with Sun JDK.<br />
• javac – the compiler, which converts source code into Java bytecode<br />
• jar – the archiver, which packages related class libraries into a single JAR file. This tool also helps manage JAR<br />
files.<br />
• javadoc – the documentation generator, which automatically generates documentation from source code<br />
comments<br />
• jdb – the debugger<br />
• jps – the process status tool, which displays process information for current Java processes<br />
• javap – the class file disassembler<br />
• appletviewer – this tool can be used to run and debug Java applets without a web browser.<br />
• javah – the C header and stub generator, used to write native methods<br />
• javaws – the Java Web Start launcher for JNLP applications<br />
• extcheck – a utility which can detect JAR-file conflicts.<br />
• apt – the annotation-processing tool<br />
• jhat – (experimental) Java heap analysis tool
Java Development Kit 161<br />
• jstack – (experimental) utility which prints Java stack traces of Java threads<br />
• jstat – (experimental) Java Virtual Machine statistics monitoring tool<br />
• jstatd – (experimental) jstat daemon<br />
• jinfo – (experimental) This utility gets configuration information from a running Java process or crash dump.<br />
• jmap – (experimental) This utility outputs the memory map for Java and can print shared object memory maps or<br />
heap memory details of a given process or core dump.<br />
• idlj – the IDL-to-Java compiler. This utility generates Java bindings from a given IDL file.<br />
• policytool – the policy creation and management tool, which can determine policy for a Java runtime, specifying<br />
which permissions are available for code from various sources<br />
• VisualVM – visual tool integrating several commandline JDK tools and lightweight performance and memory<br />
profiling capabilities<br />
• wsimport – generates portable JAX-WS artifacts for invoking a web service.<br />
• jrunscript – Java command-line script shell.<br />
The JDK also comes with a complete Java Runtime Environment, usually called a private runtime. It consists of a<br />
Java Virtual Machine and all of the class libraries present in the production environment, as well as additional<br />
libraries only useful to developers, such as the internationalization libraries and the IDL libraries.<br />
Copies of the JDK also include a wide selection of example programs demonstrating the use of almost all portions of<br />
the Java API.<br />
Ambiguity between a JDK and an SDK<br />
The JDK forms an extended subset of a software development kit (SDK). In the descriptions which accompany its<br />
recent releases for Java SE, EE, and ME, Sun acknowledges that under its terminology, the JDK forms the subset of<br />
the SDK which has the responsibility for the writing and running of Java programs. The remainder of the SDK<br />
comprises extra software, such as application servers, debuggers, and documentation.<br />
Other JDKs<br />
There are other JDKs commonly available for a variety of platforms, some of which started from the Sun JDK<br />
source and some which did not. All of them adhere to the basic Java specifications, but they often differ in explicitly<br />
unspecified areas, such as garbage collection, compilation strategies, and optimization techniques. They include:<br />
• GNU's GCJ (The GNU Compiler for Java)<br />
• IBM's J9 JDK, for AIX, Linux, Windows, MVS, OS/400, Pocket PC, z/OS [4]<br />
• Oracle Corporation's JRockit JDK, for Windows, Linux and Solaris [5]<br />
• Blackdown Java – The Blackdown Group's port of Sun's JDK for Linux<br />
• Apple's Mac OS Runtime for Java JVM/JDK for Mac OS [6]
Java Development Kit 162<br />
See also<br />
• Classpath (Java)<br />
• Java platform<br />
• Java version history<br />
External links<br />
• Sun Java SE [7] – Sun's current stable release (6).<br />
• IBM Java technology JDK [8]<br />
• Oracle's JRockit JDK [5]<br />
• Open source JDK 7 project [22]<br />
• Open source JDK project [9]<br />
• Community support [10]<br />
• GNU Classpath [11] – a Free software JDK alternative<br />
• Apache Harmony [38] – an Open source JDK alternative<br />
• Javadoc Developer Kit (JDK) Search Engine [12]<br />
• Developer Support Services from Sun Microsystems [13]<br />
References<br />
[1] "Java SE Downloads - Sun Developer Network (SDN)" (http:/ / java. sun. com/ javase/ downloads/ widget/ jdk6. jsp). .<br />
[2] http:/ / dlc. sun. com. edgesuite. net/ jdk7/ binaries/ index. html<br />
[3] "Sun's May 8th announcement of source code for JDK" (http:/ / www. prnewswire. com/ cgi-bin/ stories. pl?ACCT=104& STORY=/ www/<br />
story/ 05-08-2007/ 0004583482). .<br />
[4] http:/ / www-128. ibm. com/ developerworks/ java/ jdk/<br />
[5] http:/ / www. oracle. com/ appserver/ jrockit/ index. html<br />
[6] http:/ / docs. info. apple. com/ article. html?artnum=120209<br />
[7] http:/ / java. sun. com/ javase/<br />
[8] http:/ / www. ibm. com/ developerworks/ java/ jdk/<br />
[9] http:/ / openjdk. java. net/<br />
[10] http:/ / community. java. net/ jdk/<br />
[11] http:/ / www. gnu. org/ software/ classpath/<br />
[12] http:/ / javadoc. ankerl. com/<br />
[13] http:/ / www. sun. com/ service/ developer/ index. jsp
Java Interface Definition Language 163<br />
Java Interface Definition Language<br />
In software development, Java Interface Definition Language, or Java IDL, is an implementation of the CORBA<br />
specification and enables interoperability and connectivity with heterogeneous objects. It is basically an Object<br />
Request Broker provided with JDK. The Java IDL enables distributed Web applications to transparently invoke<br />
operations on remote network services using the industry standards IDL and IIOP from OMG.<br />
External links<br />
• Sun Developer Network: Core Java: Java IDL [1]<br />
References<br />
[1] http:/ / java. sun. com/ products/ jdk/ idl/<br />
Java resource bundle<br />
A resource bundle is a Java .properties file that contains locale-specific data [1] . It is a way of internationalising a<br />
Java application by making the code locale-independent.<br />
Naming a resource bundle<br />
Resource bundles have a naming convention to identify them when they deal with different languages. The file name<br />
is followed by an underscore and a two-letter language code (ISO 639-2 code) that specifies the language that the<br />
resource bundle deals with. So, for example, an application that supports Spanish and French can have these resource<br />
bundles, respectively:<br />
resbund_es.properties<br />
resbund_fr.properties<br />
This can also be followed by another underscore and a two-letter country code (ISO 3166-1). In this case, an<br />
application that supports British English and US English respectively will have the following files:<br />
resbund_en_GB.properties<br />
resbund_en_US.properties<br />
Content of a resource bundle<br />
Resource bundles are essentially text files. The most common type of content in a resource bundle is a list of strings.<br />
Each string has a “key” to identify it, which is the same in all the different resource bundles. When writing the code<br />
for the application, only the key is mentioned (this is why we say that the code is locale-independent). Using the<br />
methods provided in the Java API for the ResourceBundle class [2] , we can access the string (i.e. the "value")<br />
associated with the key. Depending on which locale the application is handling, it will call the adequate resource<br />
bundle at runtime [3] .<br />
For instance, our resource bundle for the UK English locale can contain “firstKey = Localisation” and our US<br />
English one can contain “firstKey = Localization”. We will refer only to “firstKey” in the code and, according to the<br />
current locale settings, the application will use either “Localization” or “Localisation”.
Java resource bundle 164<br />
Benefits of using resource bundles<br />
Extracting locale-sensitive objects such as strings from the code (as opposed to hard-coding them) means that the<br />
application can handle multiple locales without having to write different code for each locale. It also means that<br />
translators can deal with just the translatable text and not the programming code. Therefore, using resource bundles<br />
improves the internationalisation and the localisation process of a software product.<br />
Translating a resource bundle<br />
Some CAT tools like OmegaT, OmegaT+ [4] or Sun's Open language tools can specifically handle resource bundles.<br />
In addition to these, translators can use any text editor to create new resource bundles or to modify existing ones.<br />
References<br />
[1] O'Conner, B. Java Internationalization: Localization with ResourceBundles, Sun Developer Network. (http:/ / java. sun. com/ developer/<br />
technicalArticles/ Intl/ ResourceBundles/ )<br />
[2] Java API ResourceBundle Class (http:/ / java. sun. com/ j2se/ 1. 5. 0/ docs/ api/ )<br />
[3] Esselink, B. A Practical Guide to Software Localisation, John Benjamins Publishing (1998).<br />
[4] OmegaT+ (http:/ / omegatplus. sourceforge. net/ )<br />
Java TV<br />
Java TV is a Java-based software framework designed for use on TV set-top boxes, based around components called<br />
Xlets. It is currently used only on the Connected Device Configuration, specifically for iTV applications<br />
development.<br />
The API includes the Xlet classes in the package javax.tv.xlet. Other packages of the public API include<br />
1. javax.tv.graphics - provides a simple rendering canvas<br />
2. javax.tv.locator - provides a locator in the style of a URL for services and media, such as service:/SERV1<br />
3. javax.tv.service - defines a mechanism for service information (SI) databases and APIs representing the SI<br />
elements, such as the TV channels and media available for playback.<br />
Criticisms<br />
While the framework is general, Sun currently provides support only on Java ME. For some subjects, such as media<br />
locators, it is in effect superseded by other locator standards on platforms such as BD-J.<br />
A point of confusion is that in platforms supported as of 2008, examples such as the SvcDispXlet example from the<br />
introduction to the API, written circa 2001, are not deployable because it uses AWT widgets such as java.awt.Button<br />
[1] . Most iTV platforms, along with BD-J, implement Personal Basis Profile with no AWT widgets, as opposed to<br />
Personal Profile which includes the widgets. [2]<br />
Sun's reference implementation for Java TV attempts to limit its exposure to support issues to the full Java Media<br />
Framework by having its own small version of JMF that is internally referred to as "jmflite". As with the limitations<br />
of the MIDP emulators that Sun provides, the Java TV reference implementation provided by Sun has not been<br />
updated to make provisions for later JDK's such as removing calls to Thread.stop(). The Thread.stop() method was<br />
made a "final" method in Java 1.5 (meaning that classes which extend Thread and override stop() will fail at runtime<br />
under JRE 1.5 when the class is loaded). This implies that Sun has not yet committed to public plans or a roadmap<br />
for taking Java ME beyond JRE 1.3. If such an upgrade were to take place, it would require significant work on the<br />
[3] [4]<br />
part of all vendors of Java ME-enabled devices.
Java TV 165<br />
See also<br />
• Xlet<br />
External links<br />
• Java ME Technology - Java TV API [5] - includes Sun's Reference Implementation<br />
• Java TV API 1.1 (JSR-927) online Javadocs [6]<br />
• The JavaTV tutorial [7]<br />
References<br />
[1] http:/ / java. sun. com/ javase/ 6/ docs/ api/ java/ awt/ Button. html<br />
[2] Introduction to Digital TV Applications Programming (http:/ / java. sun. com/ developer/ technicalArticles/ javatv/ apiintro/ ) By Monica<br />
Pawlan, February 2001<br />
[3] JRE 1.5 Thread.stop() javadoc (http:/ / java. sun. com/ j2se/ 1. 5. 0/ docs/ api/ java/ lang/ Thread. html#stop())<br />
[4] Why Are Thread.stop, Thread.suspend, Thread.resume and Runtime.runFinalizersOnExit Deprecated? (http:/ / java. sun. com/ j2se/ 1. 5. 0/<br />
docs/ guide/ misc/ threadPrimitiveDeprecation. html)<br />
[5] http:/ / java. sun. com/ javame/ technology/ javatv/<br />
[6] http:/ / java. sun. com/ javame/ reference/ apis/ jsr927/<br />
[7] http:/ / www. mhp-interactive. org/ tutorials/ javatv/
Java Work Framework 166<br />
Java Work Framework<br />
Stable release 1.0.1 / February 18, 2009<br />
Operating<br />
system<br />
Cross-platform<br />
Type Java Network Framework<br />
License MIT license<br />
Website http:/ / javawork. org/<br />
Java Work Framework is a simple, but powerful Java framework providing Network(New I/O Socket), Database,<br />
Exception handling and System functionality. It is open source, object-oriented and event driven.<br />
History<br />
It was originally designed and implemented by Ivan Penev back in 2005 as a network layer capable to handle around<br />
10,000 socket connections. Then it gradually included the most common functionality a programmer may need -<br />
socket communication, simple database access, reading external resources as files, URLs, etc.<br />
Features<br />
Its main focus is to hide behind simple wrappers existing Java functionality and to provide general application<br />
exception handling mechanism. In short it supports:<br />
• Java NIO Socket Framework<br />
• 15,000+ socket connections. Sending/receiving 5000 java objects per second between 2 computers works great.<br />
• Multicast<br />
• Unicast(UDP) support<br />
• Pluggable protocols through in and out filters<br />
• Easy-to-use database layer<br />
• Custom JAR files loader<br />
Security<br />
• Securing socket communication through SSL<br />
• Exchanging data encrypted through XXTEA, XOR algorithms<br />
Code snippets<br />
Multicast:<br />
Multicast.listen( "230.0.0.1", 35098, new IEventListener() { public void onEvent( IEvent evt ) {<br />
} } );<br />
MulticastDataEvent dataEvt = (MulticastDataEvent)evt;<br />
System.out.println( "data-bytes:" + DebugUtil.toString(dataEvt.asByteArray()) );<br />
Multicast.send( "Lorem ipsum dolor ...", "230.0.0.1", 35098 );<br />
Database:
Java Work Framework 167<br />
Database db = Database.createInstance();<br />
db.setUrl("jdbc:postgresql://localhost/testdb");<br />
db.setUsername("testuser");<br />
db.setPassword("test123");<br />
SQLInsert insertOp = new SQLInsert("persons");<br />
insertOp.addData("person_fname", "Mike",<br />
"person_lname", "Johnson",<br />
"birthday", Convert.toDate("1971-08-01"),<br />
"country_id", "de",<br />
"single", true);<br />
int affectedRows = insertOp.execute();<br />
System.out.println("Affected rows = " + affectedRows);<br />
Requirements<br />
• JDK 1.6 (Mustang)<br />
External links<br />
• Official website [1]<br />
• Demo [2]<br />
References<br />
[1] http:/ / javawork. org/<br />
[2] http:/ / javawork. org/ examples/
Java annotation 168<br />
Java annotation<br />
An annotation, in the Java computer programming language, is a special form of syntactic metadata that can be<br />
added to Java source code. [1] Classes, methods, variables, parameters and packages may be annotated. Unlike<br />
Javadoc tags, Java annotations can be reflective in that they can be embedded in class files generated by the compiler<br />
and may be retained by the Java VM to be made retrievable at run-time. [2]<br />
Examples<br />
// @Twizzle is an annotation to method toggle().<br />
@Twizzle<br />
public void toggle() {<br />
}<br />
// Declares the annotation Twizzle.<br />
public @interface Twizzle {<br />
}<br />
Annotations may include an optional list of key-value pairs:<br />
// Same as: @Edible(value = true)<br />
@Edible(true)<br />
Item item = new Carrot();<br />
public @interface Edible {<br />
}<br />
boolean value() default false;<br />
@Author(first = "Oompah", last = "Loompah")<br />
Book book = new Book();<br />
public @interface Author {<br />
}<br />
String first();<br />
String last();<br />
Annotations themselves may be annotated to indicate where and when they can be used:<br />
@Retention(RetentionPolicy.RUNTIME) // Make this annotation<br />
accessible at runtime via reflection.<br />
@Target({ElementType.METHOD}) // This annotation can only be<br />
applied to class methods.<br />
public @interface Tweezable {<br />
}<br />
The compiler reserves a set of special annotations (including @Deprecated, @Override and<br />
@SuppressWarnings) for syntactic purposes.<br />
Annotations are often used by frameworks as a way of conveniently applying behaviours to user-defined classes and<br />
methods that must otherwise be declared in some external source (such as an XML configuration file) or
Java annotation 169<br />
programmatically (with API calls). The following, for example, is an annotated EJB 3.0 data class:<br />
@Entity // Declares this an<br />
entity bean<br />
@Table(name = "people") // Maps the bean to<br />
SQL table "people"<br />
class Person implements Serializable {<br />
@Id // Map this to the<br />
primary key column.<br />
@GeneratedValue(strategy = GenerationType.AUTO) // Database will<br />
generate new primary keys, not us.<br />
private Integer id;<br />
@Column(length = 32) // Truncate column<br />
values to 32 characters.<br />
}<br />
private String name;<br />
public Integer getId() {<br />
}<br />
return id;<br />
public void setId(Integer id) {<br />
}<br />
this.id = id;<br />
public String getName() {<br />
}<br />
return name;<br />
public void setName(String name) {<br />
}<br />
this.name = name;<br />
A complete example is given below:<br />
package com.annotation;<br />
import java.lang.annotation.Documented;<br />
import java.lang.annotation.ElementType;<br />
import java.lang.annotation.Inherited;<br />
import java.lang.annotation.Retention;<br />
import java.lang.annotation.RetentionPolicy;<br />
import java.lang.annotation.Target;<br />
@Documented<br />
@Retention(RetentionPolicy.RUNTIME)<br />
@Target({ElementType.TYPE,ElementType.METHOD,
Java annotation 170<br />
ElementType.CONSTRUCTOR,ElementType.ANNOTATION_TYPE,<br />
ElementType.PACKAGE,ElementType.FIELD,ElementType.LOCAL_VARIABLE})<br />
@Inherited<br />
public @interface Unfinished {<br />
}<br />
public enum Priority { LOW, MEDIUM, HIGH }<br />
String value();<br />
String[] changedBy() default "";<br />
String[] lastChangedBy() default "";<br />
Priority priority() default Priority.MEDIUM;<br />
String createdBy() default "prabir karmakar";<br />
String lastChanged() default "01/01/2009";<br />
package com.annotation;<br />
public @interface UnderConstruction {<br />
}<br />
String owner() default "PrabirK";<br />
String value() default "Object is Under Construction.";<br />
String createdBy() default "Prabir Karmakar";<br />
String lastChanged() default "01/01/2009";<br />
package com.validators;<br />
import javax.faces.application.FacesMessage;<br />
import javax.faces.component.UIComponent;<br />
import javax.faces.context.FacesContext;<br />
import javax.faces.validator.Validator;<br />
import javax.faces.validator.ValidatorException;<br />
import com.annotation.UnderConstruction;<br />
import com.annotation.Unfinished;<br />
import com.annotation.Unfinished.Priority;<br />
import com.util.Util;<br />
@UnderConstruction(owner="Prabir Karmakar")<br />
public class DateValidator implements Validator{<br />
public void validate(FacesContext context, UIComponent component,<br />
Object value)<br />
{<br />
throws ValidatorException<br />
String date = (String) value;<br />
String errorLabel = "Please enter a valid date.";<br />
if(!component.getAttributes().isEmpty())<br />
{<br />
errorLabel = (String)
Java annotation 171<br />
component.getAttributes().get("errordisplayval");<br />
}<br />
if(!Util.validateAGivenDate(date))<br />
{<br />
not, confirm"<br />
}<br />
}<br />
}<br />
@Unfinished(changedBy = "prabirk"<br />
)<br />
,value="whether to add message to context or<br />
,priority=Priority.HIGH<br />
FacesMessage message = new FacesMessage();<br />
message.setSeverity(FacesMessage.SEVERITY_ERROR);<br />
message.setSummary(errorLabel);<br />
message.setDetail(errorLabel);<br />
throw new ValidatorException(message);<br />
The annotations are not method calls and will not, by themselves, do anything. Rather, the class object is passed to<br />
the EJB implementation at run-time, which then extracts the annotations to generate an ORM.<br />
Processing<br />
When Java source code is compiled, annotations can be processed by compiler plug-ins called annotation processors.<br />
Processors can produce informational messages or create additional Java source files or resources, which in turn may<br />
be compiled and processed, but annotation processors cannot modify the annotated code itself. The Java compiler<br />
conditionally stores annotation metadata in the class files if the annotation has a RetentionPolicy of CLASS or<br />
RUNTIME. Later, the JVM or other programs can look for the metadata to determine how to interact with the<br />
program elements or change their behavior.<br />
History<br />
The Java platform has had various ad-hoc annotation mechanisms—for example, the transient modifier, or the<br />
@deprecated javadoc tag. The general purpose annotation (also known as metadata) facility was introduced to the<br />
Java Community Process as JSR-175 in 2002 and approved in September 2004. [3] Annotations became available in<br />
the language itself beginning with version 1.5 of the JDK. A provisional interface for compile-time annotation<br />
processing was provided by the apt tool in JDK version 1.5, and was formalized through JSR-269 and integrated into<br />
the javac compiler in version 1.6.
Java annotation 172<br />
See also<br />
• Java programming<br />
• Model-driven architecture<br />
• Java virtual machine<br />
• .NET Attributes<br />
External links<br />
• Introduction to Java 5.0 Annotations by Joy Christy [4]<br />
• Of Java Annotations by John Hunt [5]<br />
• An Introduction to Java Annotations by M. M. Islam Chisty [6]<br />
• Introduction to Java 6 Annotations at Sun Developer Network Site [7]<br />
References<br />
[1] "JDK 5.0 Developer's Guide: Annotations" (http:/ / java. sun. com/ j2se/ 1. 5. 0/ docs/ guide/ language/ annotations. html). Sun Microsystems.<br />
2007-12-18. . Retrieved 2008-03-05..<br />
[2] Sun Microsystems (2005). Java(TM) Language Specification (http:/ / java. sun. com/ docs/ books/ jls/ third_edition/ html/ j3TOC. html) (3rd<br />
ed.). Prentice Hall. ISBN 0321246780. .<br />
[3] Coward, Danny (2006-11-02). "JSR 175: A Metadata Facility for the JavaTM Programming Language" (http:/ / www. jcp. org/ en/ jsr/<br />
detail?id=175#2). Java Community Process. . Retrieved 2008-03-05.<br />
[4] http:/ / www. javabeat. net/ articles/ java-5-0/ 2007/ 08/ annotations/<br />
[5] http:/ / www. regdeveloper. co. uk/ 2006/ 02/ 24/ java_annotations/<br />
[6] http:/ / www. developer. com/ java/ other/ article. php/ 3556176<br />
[7] http:/ / java. sun. com/ javase/ 6/ docs/ technotes/ guides/ language/ annotations. html<br />
Java collections framework<br />
JCF redirects here and can also stand for Jordan canonical form in Linear Algebra or Juan Carlos Ferrero, the<br />
Spanish tennis player<br />
The Java collections framework is a coupled set of classes and interfaces that implement commonly reusable<br />
collection data structures. It was designed and developed primarily by Joshua Bloch.<br />
Although it is a framework, it works in a manner of a library.<br />
See also<br />
• Container (data structure)<br />
• Standard Template Library<br />
External links<br />
• 'The Java Tutorials - Collections' by Josh Bloch [1]<br />
• 'The Collections Framework' [2] (Sun Java SE 6 documentation)<br />
• Generic Types [3]<br />
• Java Generics and Collections [4]<br />
• Taming Tiger: The Collections Framework [5]<br />
• Collections Lessons [6]<br />
• CollectionSpy [7] — A profiler for Java's Collections Framework.<br />
• Java 6 Collection Tutorial [8] — By Jakob Jenkov, Kadafi Kamphulusa
Java collections framework 173<br />
References<br />
[1] http:/ / java. sun. com/ docs/ books/ tutorial/ collections/<br />
[2] http:/ / java. sun. com/ javase/ 6/ docs/ technotes/ guides/ collections/ index. html<br />
[3] http:/ / www. onjava. com/ pub/ a/ onjava/ excerpt/ javaian5_chap04/<br />
[4] http:/ / www. onjava. com/ pub/ a/ onjava/ excerpt/ javagenerics_chap05/<br />
[5] http:/ / www-128. ibm. com/ developerworks/ java/ library/ j-tiger07195/<br />
[6] http:/ / javalessons. com/ cgi-bin/ fun/ java-tutorials-main. cgi?sub=adv& ses=ao789<br />
[7] http:/ / www. collectionspy. com<br />
[8] http:/ / tutorials. jenkov. com/ java-collections/ index. html<br />
Java concurrency<br />
Java is a programming language (and API) which has been designed to support concurrent programming, and all<br />
execution in the language takes place in the context of a thread. It is important for a Java programmer to understand<br />
both the power and limitations of Java threads.<br />
In the JVM (Java Virtual Machine), objects and resources can be accessed by many separate threads; each thread has<br />
its own path of execution but can potentially access any object in the program. The programmer must ensure that<br />
threads do not interfere with each other, and that resources are properly coordinated (or "synchronized") during both<br />
read and write access. The Java language has built-in constructs to support this coordination.<br />
The Java Language Specification does not say how the JVM designer should implement the multithreading<br />
primitives specified, because there is so much variation among the various operating systems and hardware on which<br />
the JVM is expected to run.<br />
Monitor synchronization in Java<br />
The key synchronization concept in Java is the monitor. Every object in a JVM has a monitor associated with it.<br />
Such monitor-based concurrency was originally introduced with the Mesa programming language.<br />
Changes in Java 5<br />
Java 5 incorporated many additions and clarifications to the Java concurrency model. JSR 133 provided support for<br />
well-defined atomic operations in a multithreaded/multiprocessor environment, opening the door to JSR 166, a large<br />
battery of concurrent programming APIs.<br />
See also<br />
• Monitor (synchronization)<br />
• Concurrency (computer science)<br />
• Concurrency pattern<br />
• Doug Lea<br />
• Thread (computer science)
Java concurrency 174<br />
References<br />
• Goetz, Brian; Joshua Bloch, Joseph Bowbeer, Doug Lea, David Holmes, Tim Peierls (2006). Java Concurrency<br />
in Practice. Addison Wesley. ISBN 0-321-34960-1.<br />
• Lea, Doug (1999). Concurrent Programming in Java: Design Principles and Patterns. Addison Wesley.<br />
ISBN 0-201-31009-0.<br />
External links<br />
• JDK 5.0 concurrency utilities [1]<br />
• Podcast from JavaPolis - 'Concurrency Utilities in JDK 5.0 by Brian Goetz' [2]<br />
• JavaOne 2005 - Concurrency Utilities in Practice [3]<br />
• JavaOne 2005 - Brian Goetz - Simpler, Faster, Better: Concurrency Utilities in JDK Software Version 5.0 [4]<br />
• Podcast from JavaPosse - Interview with Brian Goetz on Concurrency in Java 5 [5]<br />
• William Pugh's Java Memory Model page [6]<br />
• Java Concurrency Tutorial by Jakob Jenkov [7]<br />
• Thread Safe Java Programming by Vadym Ustymenko [8]<br />
References<br />
[1] http:/ / java. sun. com/ j2se/ 1. 5. 0/ docs/ guide/ concurrency/ index. html<br />
[2] http:/ / www. javapolis. com/ confluence/ display/ JP05/ 2006/ 05/ 23/ Concurrency+ Utilities+ in+ JDK+ 5. 0+ talk+ by+ Brian+ Goetz<br />
[3] http:/ / developers. sun. com/ learning/ javaoneonline/ 2005/ coreplatform/ TS-3423. pdf<br />
[4] http:/ / developers. sun. com/ learning/ javaoneonline/ 2005/ coreplatform/ TS-5807. pdf<br />
[5] http:/ / javaposse. com/ index. php?post_id=95780<br />
[6] http:/ / www. cs. umd. edu/ ~pugh/ java/ memoryModel/<br />
[7] http:/ / tutorials. jenkov. com/ java-concurrency/ index. html<br />
[8] http:/ / javatip. com/ 2010/ 07/ core-java/ concurrency/ thread-safe-without-synchronization/
Java syntax 175<br />
Java syntax<br />
The syntax of the Java programming language<br />
is a set of rules which defines how a Java<br />
program is written and interpreted.<br />
The syntax is mostly derived from C and C++.<br />
Unlike C++, Java is almost exclusively an<br />
object-oriented language. There are no global<br />
functions or variables, all code belongs to<br />
classes and all values are objects. The only<br />
exception is the primitive types, which are not<br />
represented by a class instance due to<br />
performance reasons (though can be<br />
automatically converted to objects and<br />
vice-versa via autoboxing). Some features like<br />
operator overloading or unsigned integer types<br />
are omitted to simplify the language and to<br />
avoid possible programming mistakes.<br />
A snippet of Java code with keywords highlighted in blue and bold font<br />
Java syntax is constantly improved in major JDK releases. The last significant addition happened in J2SE 5.0,<br />
which introduced such features as generics and annotations.<br />
Basics<br />
Identifier<br />
An identifier is the name of an element in the code. There are certain standard naming conventions to follow when<br />
selecting names for elements. Identifiers in Java are case-sensitive.<br />
An identifier can contain:<br />
• Any Unicode character that is a letter (including numeric letters like Roman numerals) or digit.<br />
• Currency sign (such as $).<br />
• Connecting punctuation character (such as _).<br />
An identifier cannot:<br />
• start with a digit.<br />
• be equal to a reserved keyword, null literal or boolean literal.<br />
Keywords
Java syntax 176<br />
[1] Keyword was introduced in J2SE 1.4<br />
[2] Keyword is not used<br />
[3] Keyword was introduced in J2SE 5.0<br />
[4] Keyword was introduced in J2SE 1.2<br />
Literals<br />
abstract continue for new switch<br />
assert [1] default<br />
goto [2] package synchronized<br />
boolean do if private this<br />
break double implements protected throw<br />
byte else import public throws<br />
case<br />
enum [3] instanceof return transient<br />
catch extends int short try<br />
char final interface static void<br />
class finally long<br />
strictfp [4] volatile<br />
const [2] float native super while<br />
octal 0365, 0[0..7]*<br />
Integers<br />
hexadecimal 0xF5, 0x[0..9, A..F, a..f]*<br />
decimal 245, [1..9][0..9]*<br />
Floating-point values<br />
float 23.5F, 23.5f; 1.72E3F, 1.72E3f, 1.72e3F, 1.72e3f<br />
double 23.5, 23.5D, 23.5d; 1.72E3, 1.72E3D, ...<br />
Character literals<br />
char 'a', 'Z', '\u0231'<br />
boolean true, false<br />
null reference null<br />
String "Hello, world"<br />
Boolean literals<br />
null literal<br />
String literals<br />
Characters escapes in strings<br />
Unicode character \u followed by the hexadecimal unicode code point (up to \uFFFF)<br />
Octal escape Octal number not exceeding 377, preceded by backslash (e.g. \352)<br />
Line feed \n<br />
Carriage return \r<br />
Form feed \f<br />
Backslash \\<br />
Single quote \'
Java syntax 177<br />
Double quote \"<br />
Tab \t<br />
Backspace \b<br />
Integer literals are of int type by default unless long type is specified by appending L or l suffix to the literal, e.g.<br />
367L.<br />
Variables<br />
Variables are identifiers associated with values. They are declared by writing the variable's type and name, and are<br />
optionally initialized in the same statement by assigning a value.<br />
int myInt; /* Declaring an uninitialized variable called 'myInt',<br />
of type 'int' */<br />
myInt = 35; // Initializing the variable<br />
int myInt = 35; // Declaring and initializing the variable at the same time<br />
Multiple variables of the same type can be declared and initialized in one statement using comma as a delimiter.<br />
int a, b; // Declaring multiple variable of the same type<br />
int a = 2, b = 3; // Declaring and initializing multiple variables of the same type<br />
Code blocks<br />
The operators { ... } are used to signify a code block and a new scope. Class members and the body of a method are<br />
examples of what can live inside these braces in various contexts.<br />
Inside of method bodies you can use the braces to create new scopes like so:<br />
void doSomething() {<br />
}<br />
int a;<br />
{<br />
}<br />
a = 2;<br />
int b;<br />
a = 1;<br />
b = 3; // Will fail because the variable is declared in an inner scope.<br />
Comments<br />
Java has three kinds of comments: traditional comments, end-of-line comments and documentation comments.<br />
Traditional comments start with /* and end with */, they may span across multiple lines. This type of comments was<br />
derived from C and C++.<br />
/* This is a multi-line comment.<br />
It may occupy more than one line. */<br />
End-of-line comments start with // and extend to the end of the current line. This comment type is also present in<br />
C++ and in modern C.
Java syntax 178<br />
// This is an end-of-line comment<br />
Documentation comments are processed by Javadoc tool to generate documentation from source files. This type of<br />
comments is identical to traditional comments, except it starts with /** and follows conventions defined by the<br />
Javadoc tool. Technically these comments are a special kind of traditional comments and they are not specifically<br />
defined in the language specification.<br />
/**<br />
* This is a documentation comment.<br />
*<br />
* @author John Doe<br />
*/<br />
Program structure<br />
A Java application consists of classes and their members. Classes exist in packages but can also be nested inside<br />
other classes.<br />
main method<br />
Whether it is a console or a graphical interface application the program must have an entrypoint of some sort. The<br />
entrypoint of the Java application is the main method. There can be more than one class with main method, but the<br />
main class is always defined externally (e.g. in a manifest file). The method must be static and is passed<br />
command-line arguments as an array of strings. Unlike C++ or C# it never returns a value and must return void.<br />
public static void main(String[] args) {<br />
}<br />
Packages<br />
Packages are a part of a class name and they are used to group and/or distinguish named entities from other ones.<br />
Another purpose of packages is to govern code access together with access modifiers.<br />
java.lang.InputStream // InputStream is a class in java.lang package<br />
A package is declared at the start of the file like this:<br />
package myapplication.mylibrary;<br />
public class MyClass {<br />
}<br />
Classes must be placed in the files with the same name and java extension and put into nested folders<br />
corresponding to the package name. The above class myapplication.mylibrary.MyClass will have the following path:<br />
"myapplication/mylibrary/MyClass.java".
Java syntax 179<br />
import statement<br />
The import statement loads a specific class or classes from a referenced package. It must be placed at the top of a<br />
code file after the package declaration.<br />
import java.io.InputStream; /*Now it is allowed to use InputStream<br />
class without referencing its full name including the package*/<br />
import java.util.*; /*This is a star import which loads all<br />
classes contained in java.util package*/<br />
Since J2SE 5.0 it is allowed to do static imports, which allows to access members (fields and methods) defined in the<br />
imported class as public static without specifying the class name:<br />
import static java.lang.System.out;<br />
public class HelloWorld {<br />
}<br />
public static void main(String[] args) {<br />
}<br />
Operators<br />
out.println("Hello World!"); /*Without the static import it would<br />
be required to write "System.out" instead of just "out".*/<br />
Operators in Java are mostly similar to those in C++. There's no delete operator due to garbage collection<br />
mechanisms in Java and no operations on pointers since Java does not support them, another difference is that Java<br />
has unsigned right shift operator (>>>). Operators in Java cannot be overloaded.<br />
Precedence Operator Description Associativity<br />
1 () Method invocation Left-to-right<br />
[] Array access<br />
. Class member selection<br />
2 ++ -- Postfix increment and decrement<br />
3 ++ -- Prefix increment and decrement Right-to-left<br />
+ - Unary plus and minus<br />
! ~ Logical NOT and bitwise NOT<br />
(type) Type cast<br />
new Class instance or array creation
Java syntax 180<br />
Control structures<br />
4 * / % Multiplication, division, and modulus (remainder) Left-to-right<br />
5 + - Addition and subtraction<br />
+ String concatenation<br />
6 > >>> Bitwise left shift, signed right shift and unsigned right shift<br />
7 < >= Relational “greater than” and “greater than or equal to”<br />
instanceof Type comparison<br />
8 == != Relational “equal to” and “not equal to”<br />
9 & Bitwise and logical AND<br />
10 ^ Bitwise and logical XOR (exclusive or)<br />
11 | Bitwise and logical OR (inclusive or)<br />
12 && Logical conditional-AND<br />
13 || Logical conditional-OR<br />
14 c ? t : f Ternary conditional (see ?:) Right-to-left<br />
15 = Simple assignment<br />
Conditional statements<br />
if statement<br />
+= -= Assignment by sum and difference<br />
*= /= %= Assignment by product, quotient, and remainder<br />
= >>>= Assignment by bitwise left shift, signed right shift and unsigned right shift<br />
&= ^= |= Assignment by bitwise AND, XOR, and OR<br />
if statements in Java are similar to those in C and use the same syntax:<br />
if (i == 3) doSomething();<br />
if statement may include optional else block, in which case it becomes an if-then-else statement:<br />
if (i == 2)<br />
else<br />
doSomething();<br />
doSomethingElse();<br />
Like C, else-if construction does not involve any special keywords, it is formed as a sequence of separate if-then-else<br />
statements:<br />
if (i == 3) {<br />
doSomething();<br />
} else if (i == 2) {<br />
doSomethingElse();<br />
} else {<br />
}<br />
doSomethingDifferent();
Java syntax 181<br />
switch statement<br />
Switch statements in Java can use byte, short, char, and int primitive data types or their corresponding wrapper types.<br />
It is also possible to use enum types. Strings or other objects cannot be used in switch statements.<br />
Possible values are listed using case labels. These labels in Java may contain only constants (including enum<br />
constants). Execution will start after the label corresponding to the expression inside the brackets. An optional<br />
default label may be present to declare that the following it code will be executed if none of the case labels<br />
correspond to the expression.<br />
Code for each label ends with the break keyword. It is possible to omit it causing the execution to proceed to the next<br />
label, however, a warning will be usually reported during compilation.<br />
switch (ch) {<br />
}<br />
case 'A':<br />
doSomething(); // Triggered if ch == 'A'<br />
break;<br />
case 'B':<br />
case 'C':<br />
doSomethingElse(); // Triggered if ch == 'B' or ch == 'C'<br />
break;<br />
default:<br />
doSomethingDifferent(); // Triggered in any other case<br />
break;<br />
Iteration statements<br />
Iteration statements are statements that are repeatedly executed when a given condition is evaluated as true. Since<br />
J2SE 5.0 Java has four forms of such statements.<br />
while loop<br />
In the while loop the test is done before each iteration.<br />
while (i < 10) {<br />
}<br />
doSomething();<br />
do ... while loop<br />
In the do ... while loop the test is done after each iteration. Consequently, the code is always executed at least once.<br />
// doSomething() is called at least once<br />
do {<br />
doSomething();<br />
} while (i < 10);
Java syntax 182<br />
for loop<br />
for loops in Java include an initializer, a condition and a counter expression. It is possible to include several<br />
expressions of the same kind using comma as delimiter. However, unlike C, comma is just a delimiter and not an<br />
operator.<br />
for (int i = 0; i < 10; i++) {<br />
}<br />
doSomething();<br />
// A more complex loop using two variables<br />
for (int i = 0, j = 9; i < 10; i++, j -= 3) {<br />
}<br />
doSomething();<br />
Like C, all three expressions are optional, the following loop will be infinite:<br />
for (;;) {<br />
}<br />
doSomething();<br />
Enhanced for loop<br />
Enhanced for loops have been available since J2SE 5.0. This type of loop uses built-in iterators over arrays and<br />
collections to return each item in the given collection. Every element will be returned and reachable in the context of<br />
the code block. When the block has been executed the next item will be returned until there are no items remaining.<br />
Unlike C# this kind of loop does not involve a special keyword but instead uses a different notation style.<br />
for (int i : intArray) {<br />
}<br />
doSomething(i);<br />
Jump statements<br />
Labels<br />
Labels are given points in code used by break and continue statements. Despite the presence of the goto keyword, it<br />
cannot be used to jump to specific points in the code.<br />
start:<br />
someMethod();<br />
break statement<br />
The break statement breaks out of the closest loop or switch statement. Execution continues in the statement after the<br />
terminated statement, if any.<br />
for (int i = 0; i < 10; i++) {<br />
}<br />
while (true) {<br />
}<br />
break;<br />
// Will break to this point<br />
It is possible to break out of the outer loop using labels:
Java syntax 183<br />
outer:<br />
for (int i = 0; i < 10; i++) {<br />
}<br />
while (true) {<br />
}<br />
break outer;<br />
// Will break to this point<br />
continue statement<br />
The continue statement discontinues the current iteration of the current control statement and begins the next<br />
iteration. The following while loop in the code above reads characters by calling getChar(), skipping the statements<br />
in the body of the loop if the characters are spaces:<br />
int ch;<br />
while (ch = getChar()) {<br />
}<br />
if (ch == ' ')<br />
continue; // Skips the rest of the while-loop<br />
// Rest of the while-loop, will not be reached if ch == ' '<br />
doSomething();<br />
Labels can be specified in continue statements, as they can in break statements:<br />
outer:<br />
for (String str : stringsArr) {<br />
}<br />
char[] strChars = str.toCharArray();<br />
for (char ch : strChars) {<br />
}<br />
if (ch == ' ') {<br />
}<br />
return statement<br />
/* Continues the outer cycle and the next<br />
string is retrieved from stringsArr */<br />
continue outer;<br />
doSomething(ch);<br />
The return statement is used to end method execution and to return a value. A value returned by the method is<br />
written after the return keyword. If the method returns anything but void, it must use the return statement to return<br />
some value.<br />
void doSomething(boolean streamClosed) {<br />
}<br />
// If streamClosed is true, execution is stopped<br />
if (streamClosed) {<br />
}<br />
return;<br />
readFromStream();
Java syntax 184<br />
int calculateSum(int a, int b) {<br />
}<br />
int result = a + b;<br />
return result;<br />
return statement ends execution immediately, except for one case: if the statement is encountered within a try block<br />
and it is complemented by a finally, control is passed to the finally block.<br />
void doSomething(boolean streamClosed) {<br />
}<br />
try {<br />
if (streamClosed) {<br />
}<br />
return;<br />
readFromStream();<br />
} finally {<br />
}<br />
/* Will be called last even if<br />
readFromStream() was not called */<br />
freeResources();<br />
Exception handling statements<br />
try ... catch ... finally statements<br />
Exceptions are managed within try ... catch blocks.<br />
try {<br />
// Statements which may throw exceptions<br />
methodThrowingExceptions();<br />
} catch (Exception ex) {<br />
// Exception caught and handled here<br />
reportException(ex);<br />
} finally {<br />
}<br />
// Statements always executed after the try/catch blocks<br />
freeResources();<br />
The statements within the try block are executed, and if any of them throws an exception, execution of the block is<br />
discontinued and the exception is handled by the catch block. There may be multiple catch blocks, in which case the<br />
first block with an exception variable whose type matches the type of the thrown exception is executed.<br />
If no catch block matches the type of the thrown exception, the execution of the outer block (or method) containing<br />
the try ... catch statement is discontinued, and the exception is passed up and outside the containing block (or<br />
method). The exception is propagated upwards through the call stack until a matching catch block is found within<br />
one of the currently active methods. If the exception propagates all the way up to the top-most main method without<br />
a matching catch block being found, a textual description of the exception is written to the standard output stream.<br />
The statements within the finally block are always executed after the try and catch blocks, whether or not an<br />
exception was thrown and even if a return statement was reached. Such blocks are useful for providing clean-up code<br />
that is guaranteed to always be executed.
Java syntax 185<br />
The catch and finally blocks are optional, but at least one or the other must be present following the try block.<br />
throw statement<br />
throw statement is used to throw an exception and end method execution. Thrown exception instance is written after<br />
the throw statement.<br />
void methodThrowingExceptions(Object obj) {<br />
}<br />
if (obj == null) {<br />
}<br />
// Throws exception of NullPointerException type<br />
throw new NullPointerException();<br />
// Will not be called if obj was null<br />
doSomethingWithObject(obj);<br />
Thread concurrency control<br />
Unlike C++, Java has built-in tools for multi-thread programming. For the purposes of thread synchronization the<br />
synchronized statement is included in Java language.<br />
To make a code block synchronized, it is preceded by the synchronized keyword followed by the lock object inside<br />
the brackets. When the executing thread reaches the synchronized block, it acquires a mutual exclusion lock,<br />
executes the block, then releases the lock. No threads may enter this block until the lock is released. Any non-null<br />
reference type may be used as the lock.<br />
/* Acquires lock on someObject. It must be of<br />
a reference type and must be non-null */<br />
synchronized(someObject) {<br />
}<br />
// Synchronized statements<br />
assert statement<br />
assert statements have been available since J2SE 1.4. This type of statements is used to make assertions in the source<br />
code, which can be turned on and off during execution for specific classes or packages. To declare an assertion the<br />
assert keyword is used followed by a conditional expression. If it evaluates to false during when the statement is<br />
executed, an exception is thrown. This statement may include a colon followed by another expression, which will act<br />
as the exception's detail message.<br />
// If n equals 0, AssertionError is thrown<br />
assert n != 0;<br />
/* If n equals 0, AssertionError will be thrown<br />
with the message after the colon */<br />
assert n != 0 : "n was equal to zero";
Java syntax 186<br />
Primitive types<br />
Primitive types in Java include integer types, floating-point numbers, UTF-16 code units and a boolean type. There<br />
are no unsigned types in Java except char type, which is used to represent UTF-16 code units. The lack of unsigned<br />
types is offset by introducing unsigned right shift operation (>>>), which is not present in C++. Nevertheless,<br />
criticisms have been levelled about the lack of compatibility with C and C++ this causes. [1]<br />
Primitive Types<br />
Type Name Wrapper class Value Range Size Default<br />
byte java.lang.Byte integer −128 through +127 8-bit (1-byte) 0<br />
short java.lang.Short integer −32,768 through +32,767 16-bit<br />
int java.lang.Integer integer −2,147,483,648 through +2,147,483,647 32-bit<br />
long java.lang.Long integer −9,223,372,036,854,775,808 through<br />
+9,223,372,036,854,775,807<br />
float java.lang.Float floating point number ±1.401298E−45 through ±3.402823E+38 32-bit<br />
double java.lang.Double floating point number ±4.94065645841246E−324 through<br />
±1.79769313486232E+308<br />
(2-byte)<br />
(4-byte)<br />
64-bit<br />
(8-byte)<br />
(4-byte)<br />
64-bit<br />
(8-byte)<br />
boolean java.lang.Boolean Boolean true or false 8-bit (1-byte) false<br />
char java.lang.Character UTF-16 code unit (BMP<br />
character<br />
or a part of a surrogate pair)<br />
'\u0000' through '\uFFFF' 16-bit<br />
(2-byte)<br />
0<br />
0<br />
0<br />
0.0<br />
0.0<br />
Value<br />
'\u0000'<br />
char does not necessarily correspond to a single character. It may represent a part of a surrogate pair, in which case<br />
Unicode code point is represented by a sequence of two char values.<br />
Boxing and unboxing<br />
This language feature was introduced in J2SE 5.0. Boxing is the operation of converting a value of a primitive type<br />
into a value of a corresponding reference type, which serves as a wrapper for this particular primitive type. Unboxing<br />
is the reverse operation of converting a value of a reference type (previously boxed) into a value of a corresponding<br />
primitive type. Neither operation requires an explicit type cast.<br />
Example:<br />
int foo = 42; // Primitive type<br />
Integer bar = foo; /* foo is boxed to bar, bar is of Integer type,<br />
which serves as a wrapper for int */<br />
int foo2 = bar; // Unboxed back to primitive type
Java syntax 187<br />
Reference types<br />
Reference types include class types, interface types, and array types. When the constructor is called an object is<br />
created on the heap and a reference is assigned to the variable. When a variable of an object gets out of scope the<br />
reference is broken and when there are no references left the object gets marked as garbage. The garbage collector<br />
will then soon collect and destroy it.<br />
A reference variable is null when it does not reference any object.<br />
Arrays<br />
Arrays in Java are created at runtime, just like class instances. Array length is defined at creation and cannot be<br />
changed.<br />
int[] numbers = new int[5];<br />
numbers[0] = 2;<br />
numbers[1] = 5;<br />
int x = numbers[0];<br />
Initializers<br />
// Long syntax<br />
int[] numbers = new int[5] {20, 1, 42, 15, 34};<br />
// Short syntax<br />
int[] numbers2 = {20, 1, 42, 15, 34};<br />
Multi-dimensional arrays<br />
In Java multi-dimensional arrays are represented as arrays of arrays. Technically they are represented by arrays of<br />
references to another arrays.<br />
int[][] numbers = new int[3][3];<br />
number[1][2] = 2;<br />
int[][] numbers2 = {{2, 3, 2}, {1, 2, 6}, {2, 4, 5}};<br />
Due to the nature of the multi-dimensional arrays, sub-arrays may vary in length, so multi-dimensional arrays are not<br />
bound to be rectangular unlike C:<br />
int[][] numbers = new int[2][]; //Initialization of the first dimension<br />
only<br />
numbers[0] = new int[3];<br />
numbers[1] = new int[2];
Java syntax 188<br />
Classes<br />
Classes are fundamentals of an object-oriented language such as Java. They contain members that store and<br />
manipulate data in real-life-like way. Classes are divided into top-level and nested. Nested classes include member<br />
classes, local classes and anonymous classes.<br />
Declaration<br />
Top-level class class Foo {<br />
// Class members<br />
}<br />
Member class class Foo { // Top-level class<br />
Local class class Foo {<br />
}<br />
class Bar { // Nested class<br />
}<br />
void bar() {<br />
Anonymous class class Foo {<br />
Initialization<br />
}<br />
}<br />
}<br />
class Foobar {// Local class within a method<br />
}<br />
void bar() {<br />
}<br />
new Object() {// Creation of a new anonymous class extending Object<br />
};<br />
To use non-static members of the class it must be instantiated. It is done by using the new keyword and calling the<br />
class constructor.<br />
Foo foo = new Foo();<br />
Accessing members<br />
Members of both instances and static classes are accessed with the . operator.<br />
Accessing an instance member<br />
Instance members can be accessed through the name of a variable.<br />
String foo = "Hello";<br />
String bar = foo.toUpperCase();<br />
Accessing a static class member<br />
Static members are accessed by using the name of the class or any other type. This does not require the creation of a<br />
class instance. Static members are declared using the static modifier.<br />
public class Foo {<br />
}<br />
public static void doSomething() {<br />
}<br />
// Calling the static method
Java syntax 189<br />
Foo.doSomething();<br />
Modifiers<br />
Modifiers are keywords used to modify declarations of types and type members. Most notably there is a sub-group<br />
containing the access modifiers.<br />
• abstract - Specifies that a class only serves as a base class and cannot be instantiated.<br />
• static - Used only for member classes, specifies that the member class does not belong to a specific instance of<br />
the containing class.<br />
• final - Classes marked as final cannot be extended from and cannot have any subclasses.<br />
• strictfp - Specifies that all floating-point operations must be carried out conforming to IEEE 754 and forbids<br />
using enhanced precision to store intermediate results.<br />
Access modifiers<br />
The access modifiers, or inheritance modifiers, set the accessibility of classes, methods, and other members.<br />
Members marked as public can be reached from anywhere. If a class or its member does not have any modifiers,<br />
default access is assumed.<br />
public class Foo {<br />
}<br />
int do() {<br />
}<br />
return 0;<br />
private class Bar {<br />
}<br />
The following table shows whether code within a class has access to the class or method depending on the accessing<br />
class location and the modifier for the accessed class or class member:<br />
Modifier Same<br />
class<br />
Other class inside the same<br />
package<br />
Subclass inside another<br />
package<br />
Non-subclass inside another<br />
private yes no no no<br />
default (package<br />
private)<br />
package<br />
yes yes no no<br />
protected yes yes yes no<br />
public yes yes yes yes<br />
Constructors<br />
A constructor is a special method that is called when an object is initialized. Its purpose is to initialize the members<br />
of the object. The main differences between constructors and ordinary methods are that constructors are named after<br />
the class and never return anything. They may take parameters as any common method.<br />
class Foo {<br />
}<br />
Foo() {<br />
}<br />
//Initialization
Java syntax 190<br />
There are also static constructors, whose purpose is to initialize static fields when the class is initialized. They are<br />
declared using static keyword:<br />
class Foo {<br />
}<br />
static {<br />
}<br />
//Initialization<br />
Since Java has a garbage collection mechanism, there are no destructors. However, every object has a finalize()<br />
method called prior to garbage collection which could be overridden to implement finalization.<br />
Methods<br />
All the statements in Java must reside within methods. Methods are similar to functions except they belong to<br />
classes. A method has a return value, a name and usually some parameters initialized when it is called with some<br />
arguments. Similar to C++, methods which return nothing have return type declared as void. Unlike in C++, methods<br />
in Java are not allowed to have default argument values and methods are usually overloaded instead.<br />
class Foo {<br />
}<br />
int bar(int a, int b) {<br />
}<br />
return (a * 2) + b;<br />
int bar(int a) { /* Overloaded method with the same name but<br />
}<br />
return a * 2;<br />
different set of arguments */<br />
A method is called using . notation on a specific variable, or as in the case of static methods, the name of a type.<br />
Foo foo = new Foo();<br />
int result = foo.bar(7, 2); // Non-static method is called on foo<br />
int finalResult = Math.abs(result); // Static method call<br />
Methods throwing exceptions use throws keyword to indicate that. All checked exceptions are mandatory to be<br />
declared.<br />
void openStream() throws IOException { // Indicates that IOException may be thrown<br />
}
Java syntax 191<br />
Modifiers<br />
• abstract - Abstract methods can be present only in abstract classes, such methods have no body and must be<br />
overridden in a subclass unless it is abstract itself.<br />
• static - Makes the method static and accessible without creation of a class instance. However static methods<br />
cannot access non-static members in the same class.<br />
• final - Declares that the method cannot be overridden in a subclass.<br />
• native - Indicates that this method is implemented through JNI in platform-dependent code. Actual<br />
implementation happens outside Java code, and such methods have no body.<br />
• strictfp - Declares strict conformance to IEEE 754 in carrying out floating-point operations.<br />
• synchronized - Declares that a thread executing this method must acquire monitor. For synchronized methods the<br />
monitor is the class instance or java.lang.Class if the method is static.<br />
• Access modifiers - Identical to those used with classes.<br />
Varargs<br />
This language feature was introduced in J2SE 5.0. The last argument of the method may be declared as a variable<br />
arity parameter, in which case the method becomes a variable arity method (as opposed to fixed arity methods) or<br />
simply varargs method. This allows to pass a variable number of value of declared type to the method as parameters.<br />
These values will be available inside the method as an array.<br />
void printReport(String header, int... numbers) { //numbers represents varargs<br />
}<br />
System.out.println(header);<br />
for (int num : numbers) {<br />
}<br />
System.out.println(num);<br />
// Calling varargs method<br />
printReport("Report data", 74, 83, 25, 96);<br />
Fields<br />
Fields, or class variables, can be declared inside the class body to store data.<br />
class Foo {<br />
}<br />
double bar;<br />
Fields can be initialized directly when declared.<br />
class Foo {<br />
}<br />
double bar = 2.3;
Java syntax 192<br />
Modifiers<br />
• static - Makes the field a static member.<br />
• final - Allows the field to be initialized only once in a constructor.<br />
• transient - Indicates that this field will not be stored during serialization.<br />
• volatile - If a field is declared volatile, it is ensured that all threads see a consistent value for the variable.<br />
• Access modifiers - Identical to those used with classes<br />
Inheritance<br />
Classes in Java may only inherit from one class. A class may derive from any class that is not marked as final.<br />
Inheritance is declared using extends keyword. A class may reference itself using this keyword and its direct<br />
superclass using super keyword.<br />
class Foo {<br />
}<br />
class Foobar extends Foo {<br />
}<br />
If a class does not specify the superclass, it implicitly inherits from java.lang.Object class. Thus all classes in Java<br />
are subclasses of Object class.<br />
Overriding methods<br />
Unlike C++, all non-final methods in Java are virtual and can be overridden by the inheriting classes.<br />
class Operation {<br />
}<br />
public int do() {<br />
}<br />
return 0;<br />
class NewOperation extends Operation {<br />
}<br />
public int do() {<br />
}<br />
Abstract classes<br />
return 1;<br />
Abstract classes are classes that only serve as templates and cannot be instantiated. Otherwise it is just like an<br />
ordinary class.<br />
Only abstract classes are allowed to have abstract methods. Abstract methods do not have any implementation and<br />
must be overridden by a subclass unless it is not abstract itself.<br />
abstract class Mammal {<br />
}<br />
public abstract void walk();<br />
class Human extends Mammal {
Java syntax 193<br />
}<br />
public void walk() {<br />
}<br />
final classes<br />
The final modifier can be an optional modifier for classes to make them uninheritable.<br />
final class Foo { // This class cannot be extended by any other class<br />
}<br />
Enumerations<br />
This language feature was introduced in J2SE 5.0. Technically enumerations are a kind of class which contains enum<br />
constants in its body. Each enum constant defines an instance of the enum type. Enumeration classes cannot be<br />
instantiated anywhere except in the enumeration class itself.<br />
enum Season {<br />
}<br />
WINTER, SPRING, SUMMER, AUTUMN<br />
Enum constants are allowed to have constructors, which are called when the class is loaded:<br />
public enum Season {<br />
}<br />
WINTER("Cold"), SPRING("Warmer"), SUMMER("Hot"), AUTUMN("Cooler");<br />
Season(String description) {<br />
}<br />
this.description = description;<br />
private final String description;<br />
public String getDescription() {<br />
}<br />
return description;<br />
Enumerations can have class bodies, in which case they are treated like anonymous classes extending the enum<br />
class:<br />
public enum Season {<br />
WINTER {<br />
},<br />
String getDescription() {return "cold";}<br />
SPRING {<br />
},<br />
String getDescription() {return "warmer";}<br />
SUMMER {<br />
},<br />
String getDescription() {return "hot";}
Java syntax 194<br />
}<br />
AUTUMN {<br />
};<br />
Interfaces<br />
String getDescription() {return "cooler";}<br />
Interfaces are data structures that contain member definitions and not actual implementation. They are useful to<br />
define a contract between members in different types that have different implementations. Every interface is<br />
implicitly abstract. The only modifier allowed to use with interfaces apart from access modifiers is strictfp, which<br />
has the same effect as for classes.<br />
interface ActionListener {<br />
}<br />
int ACTION_ADD = 0;<br />
int ACTION_REMOVE = 1;<br />
void actionSelected(int action);<br />
Implementing an interface<br />
An interface is implemented by a class using the implements keyword. It is allowed to implement more than one<br />
interface, in which case they are written after implements keyword in a comma-separated list. Class implementing an<br />
interface must override all its methods, otherwise it must be declared as abstract.<br />
interface RequestListener {<br />
}<br />
int requestReceived();<br />
class ActionHandler implements ActionListener, RequestListener {<br />
}<br />
void actionSelected(int action) {<br />
}<br />
public int requestReceived() {<br />
}<br />
//Calling method defined by interface<br />
RequestListener listener = new ActionHandler(); /*ActionHandler can be<br />
represented as RequestListener...*/<br />
listener.requestReceived(); /*...and thus is known to implement<br />
requestReceived() method*/
Java syntax 195<br />
Inheritance<br />
Interfaces can inherit from other interfaces just like classes. Unlike classes it is allowed to inherit from multiple<br />
interfaces. However, it is possible that several interfaces have a field with the same name, in which case it becomes a<br />
single ambiguous member, which cannot be accessed.<br />
/* Class implementing this interface must implement methods of both<br />
ActionListener and RequestListener */<br />
interface EventListener extends ActionListener, RequestListener {<br />
}<br />
Annotations<br />
Annotations in Java are a way to embed metadata into code. This language feature was introduced in J2SE 5.0.<br />
Annotation types<br />
Java has a set of predefined annotation types, but it is allowed to define new ones. An annotation type declaration is<br />
a special type of an interface declaration. They are declared in the same way as the interfaces, except the interface<br />
keyword is preceded by the @ sign. All annotations are implicitly extended from java.lang.annotation.Annotation<br />
and cannot be extended from anything else.<br />
@interface BlockingOperations {<br />
}<br />
Annotations may have the same declarations in the body as the common interfaces, in addition they are allowed to<br />
include enums and annotations. The main difference is that abstract methods declarations must not have any<br />
parameters or throw any exceptions. Also they may have a default value, which is declared using the default<br />
keyword after the method name:<br />
@interface BlockingOperations {<br />
}<br />
boolean fileSystemOperations();<br />
boolean networkOperations() default false;<br />
Usage of annotations<br />
Annotations may be used in any kind of declaration, whether it is package, class (including enums), interface<br />
(including annotations), field, method, parameter, constructor, or local variable. Also they can be used with enum<br />
constants. Annotations are declared using the @ sign preceding annotation type name, after which element-value<br />
pairs are written inside brackets. All elements with no default value must be assigned a value.<br />
@BlockingOperations(/*mandatory*/ fileSystemOperations = true,<br />
/*optional*/ networkOperationsPresent = true)<br />
void openOutputStream() { //Annotated method<br />
}<br />
Besides the generic form, there are two other forms to declare an annotation, which are shorthands. Marker<br />
annotation is a short form, it is used when no values are assigned to elements:<br />
@Unused // Shorthand for @Unused()<br />
void travelToJupiter() {<br />
}
Java syntax 196<br />
The other short form is called single element annotation. It is used with annotations types containing only one<br />
element or in the case when multiple elements are present, but only one elements lacks a default value. In single<br />
element annotation form the element name is omitted and only value is written instead:<br />
/* Equivalent for @BlockingOperations(fileSystemOperations = true).<br />
networkOperations has a default value and<br />
does not have to be assigned a value */<br />
@BlockingOperations(true)<br />
void openOutputStream() {<br />
}<br />
Generics<br />
Generics, or parameterized types, or parametric polymorphism is one of the major features introduced in J2SE 5.0.<br />
Before generics were introduced, it was required to declare all the types explicitly. With generics it became possible<br />
to work in a similar manner with different types without declaring the exact types. The main purpose of generics is to<br />
ensure type safety and to detect runtime errors during compilation. Unlike C#, information on the used parameters is<br />
not available at runtime due to type erasure.<br />
Generic classes<br />
Classes can be parameterized by adding a type variable inside angle brackets (< and >) following the class name. It<br />
makes possible the use of this type variable in class members instead of actual types. There can be more than one<br />
type variable, in which case they are declared in a comma-separated list.<br />
It is possible to limit a type variable to a subtype of some specific class or declare an interface that must be<br />
implemented by the type. In this case the type variable is appended by the extends keyword followed by a name of<br />
the class or the interface. If the variable is constrained by both class and interface or if there are several interfaces,<br />
the class name is written first, followed by interface names with & sign used as the delimiter.<br />
/* This class has two type variables, T and V. T must be<br />
a subtype of ArrayList and implement Formattable interface */<br />
public class Mapper {<br />
}<br />
public void add(T array, V item) {<br />
}<br />
// array has add method because it is an ArrayList subclass<br />
array.add(item);<br />
When a variable of a parametrized type is declared or an instance is created, its type is written exactly in the same<br />
format as in the class header, except actual type is written in the place of the type variable declaration.<br />
/* Mapper is created for CustomList as T and Integer as V.<br />
CustomList must be a subclass of ArrayList and implement Formattable */<br />
Mapper mapper = new Mapper();<br />
When declaring a variable for a parametrized type, it is possible to use wildcards instead of explicit type names.<br />
Wildcards are expressed by writing ? sign instead of the actual type. It is possible to limit possible types to the<br />
subclasses or superclasses of some specific class by writing the extends keyword or the super keyword<br />
correspondingly followed by the class name.
Java syntax 197<br />
/* Any Mapper instance with CustomList as the first parameter<br />
may be used regardless of the second one.*/<br />
Mapper mapper;<br />
mapper = new Mapper();<br />
mapper = new Mapper();<br />
/* Will not accept types that use anything but<br />
a subclass of Number as the second parameter */<br />
void addMapper(Mapper
Java syntax 198<br />
}<br />
void addItem(Integer item) {<br />
}<br />
See also<br />
• Java Platform, Standard Edition<br />
References<br />
[1] Owens, Sean. "Java and unsigned int, unsigned short, unsigned byte, unsigned long, etc. (Or rather, the lack thereof)" (http:/ / darksleep. com/<br />
player/ JavaAndUnsignedTypes. html). .<br />
• Patrick Naughton, Herbert Schildt. Java 2: The Complete Reference, third edition. The McGraw-Hill Companies,<br />
1999. ISBN 0-07-211976-4<br />
• Vermeulen, Ambler, Bumgardner, Metz, Misfeldt, Shur, Thompson. The Elements of Java Style. Cambridge<br />
University Press, 2000. ISBN 0-521-77768-2<br />
• Gosling, James; Joy Bill; Steele, Guy; and Bracha, Gillad (2005). Java Language Specification (http:/ / java. sun.<br />
com/ docs/ books/ jls/ index. html) (3rd ed.). Addison-Wesley Professional. Retrieved 2008-12-03.<br />
External links<br />
• The Java Language Specification, Third edition (http:/ / java. sun. com/ docs/ books/ jls/ ) Authoritative<br />
description of the Java language<br />
• Java SE 6 API Javadocs<br />
Java: <strong>View</strong> Technologies and Frameworks<br />
Various Java Web frameworks have appeared in recent years. Some of them are in direct competition, while others<br />
are complementary technologies. It is therefore necessary to understand where exactly each technology/framework<br />
fits into the J2EE scheme of things. This page lists the <strong>View</strong> technologies. These are the frameworks which are used<br />
for defining the web pages and the server-side programs which handle the requests (clicks) generated by the web<br />
pages.<br />
At a glance<br />
HTTP Paradigm Component Paradigm Templating<br />
Struts Wicket Tiles<br />
Tapestry SiteMesh<br />
JSF Facelets<br />
• Struts is relatively easier to use for beginners because it contains the familiar HTTP paradigm of<br />
Request/Response. However, the Component based frameworks are architecturally superior, and usually<br />
recommended for creating more complex web applications.<br />
• Wicket, Tapestry and JSF are competing technologies.<br />
• Tiles is a templating framework which is designed to work with Struts.<br />
• SiteMesh can be used with any JSP.<br />
Click
Java: <strong>View</strong> Technologies and Frameworks 199<br />
• Facelets is designed to work with JSF.<br />
• Wicket and Tapestry have their own native templating.<br />
• Click uses HTML based velocity templates and plain old Java objects. JSP is optional.<br />
Servlet API<br />
• This is the foundation of almost all Java <strong>View</strong> technologies.<br />
• It provides the basic framework for writing Java classes, called 'Servlets' that can respond to HTTP Requests,<br />
JSP<br />
create Cookies and maintain Sessions.<br />
• Built on top of the Servlet API, JSP provides for a HTML centric Server programming model.<br />
• Java code is embedded in the JSP files and is executed when a request is received.<br />
Struts<br />
• Built on top of the Servlet API, Struts provides for decoupling between the Controller and the <strong>View</strong>.<br />
• Requests are received by a Java Class (Controller) which can decide which <strong>View</strong> to display.<br />
• The actual <strong>View</strong> is written as a JSP page.<br />
• An XML configuration file is used to specify the "Page Navigation", i.e. the flow of the request to the appropriate<br />
Controller, and which <strong>View</strong> to display based on the outcome of the Controller.<br />
• Competitor: Though Struts does not have any direct competitor in its league, Component <strong>View</strong> Technologies<br />
(like Wicket, Tapestry) are generally accepted as superior.<br />
Tiles<br />
• This is a HTML templating framework based on the "Composite" model.<br />
• It allows for the HTML page to be broken up into multiple pagelets, called Templates, Definitions and<br />
Composing pages.<br />
• At run time the pagelets are stitched together to generate the final HTML. Pages are written in JSP.<br />
• Competitor: SiteMesh<br />
SiteMesh<br />
• SiteMesh is a HTML templating framework based on the "Decoration" model.<br />
• It allows for the creation of a 'decoration' template which is then applied to any other HTML to generate a new<br />
HTML.<br />
• The newly generated HTML contains elements from the original HTML blended into the template.<br />
• This allows for the original HTML to be very simple and devoid of any formatting or layout specification. The<br />
template, in turn, is devoid of any actual information.<br />
• Blending the two allows for a consistent look and feel for all web pages.<br />
• Competitor: Tiles
Java: <strong>View</strong> Technologies and Frameworks 200<br />
Wicket<br />
• Wicket provides a 'Component' view technology - meaning the Request-Response Stateless paradigm of HTTP is<br />
abstracted away to give rise to an Object Oriented Stateful paradigm.<br />
• Pages now directly interact with Stateful Java Components on the server.<br />
• Components and their State are managed by the Wicket framework, freeing the application developer from having<br />
to use HttpSession directly to manage state themselves.<br />
• Further, Wicket provides for a clear separation of HTML markup from code, and there are no XML configuration<br />
files to manage.<br />
• Web page components are 'pushed' into the HTML markup from the code.<br />
• Competitor: Tapestry, JSF<br />
Tapestry<br />
• Tapestry provides a 'Component' view technology.<br />
• Classes are written as POJOs and Annotations are used to configure them as Tapestry components.<br />
• HTML components can directly refer to the component methods and attributes.<br />
• Competitor: Wicket, JSF<br />
References<br />
• Java Servlet Technology (http:/ / java. sun. com/ products/ servlet/ )<br />
• JavaServer Pages Technology (http:/ / java. sun. com/ products/ jsp/ )<br />
• Apache Struts 2 Documentation (http:/ / struts. apache. org/ 2. 1. 6/ docs/ home. html)<br />
• Apache Struts Tiles (http:/ / struts. apache. org/ 1. x/ struts-tiles/ )<br />
• Click Framework Project Documentation (http:/ / incubator. apache. org/ click/ )
JavaBeans Activation Framework 201<br />
JavaBeans Activation Framework<br />
JavaBeans Activation Framework, or JAF, enables developers to: [1]<br />
determine the type of an arbitrary piece of data; encapsulate access to it; discover the operations available on<br />
it; and instantiate the appropriate bean to perform the operation(s).<br />
It also enables you to dynamically register types of arbitrary data and actions associated with particular kinds of data.<br />
Additionally, it enables a program to dynamically provide or retrieve JavaBeans that implement actions associated<br />
with some kind of data.<br />
External links<br />
• Java Technologies [2]<br />
References<br />
[1] JavaBeans Activation Framework (http:/ / java. sun. com/ javase/ technologies/ desktop/ javabeans/ jaf/ ). Retrieved 2010-07-06.<br />
[2] http:/ / java. sun. com/ javase/ technologies/ desktop/ javabeans/ jaf/ downloads/ index. html<br />
JavaThreads<br />
Simply put, a thread is a program's path of execution. Most programs written today run as a single thread, causing<br />
problems when multiple events or actions need to occur at the same time. Let's say, for example, a program is not<br />
capable of drawing pictures while reading keystrokes. The program must give its full attention to the keyboard input<br />
lacking the ability to handle more than one event at a time. The ideal solution to this problem is the seamless<br />
execution of two or more sections of a program at the same time. Threads allows us to do this.<br />
Multithreaded applications deliver their potent power by running many threads concurrently within a single program.<br />
From a logical point of view, multithreading means multiple lines of a single program can be executed at the same<br />
time, however, it is not the same as starting a program twice and saying that there are multiple lines of a program<br />
being executed at the same time. In this case, the operating system is treating the programs as two separate and<br />
distinct processes. Under Unix, forking a process creates a child process with a different address space for both code<br />
and data. However, fork() creates a lot of overhead for the operating system, making it a very CPU-intensive<br />
operation. By starting a thread instead, an efficient path of execution is created while still sharing the original data<br />
area from the parent. The idea of sharing the data area is very beneficial, but brings up some areas of concern that<br />
we'll discuss later.<br />
Creating threads<br />
Java's creators have graciously designed two ways of creating threads: implementing an interface and extending a<br />
class. Extending a class is the way Java inherits methods and variables from a parent class. In this case, one can only<br />
extend or inherit from a single parent class. This limitation within Java can be overcome by implementing interfaces,<br />
which is the most common way to create threads. (Note that the act of inheriting merely allows the class to be run as<br />
a thread. It is up to the class to start() execution, etc.)<br />
Interfaces provide a way for programmers to lay the groundwork of a class. They are used to design the requirements<br />
for a set of classes to implement. The interface sets everything up, and the class or classes that implement the<br />
interface do all the work. The different set of classes that implement the interface have to follow the same rules.<br />
There are a few differences between a class and an interface. First, an interface can only contain abstract methods<br />
and/or static final variables (constants). Classes, on the other hand, can implement methods and contain variables
JavaThreads 202<br />
that are not constants. Second, an interface cannot implement any methods. A class that implements an interface<br />
must implement all methods defined in that interface. An interface has the ability to extend from other interfaces,<br />
and (unlike classes) can extend from multiple interfaces. Furthermore, an interface cannot be instantiated with the<br />
new operator; for example, Runnable a=new Runnable(); is not allowed.<br />
javac<br />
Developer(s) Sun Microsystems<br />
Stable release 1.6.0_14 / May 28, 2009<br />
Operating<br />
system<br />
Cross-platform<br />
Type Compiler<br />
License GNU General Public License<br />
Website [1]<br />
javac (pronounced "java-see") is the primary Java compiler, included in the Java Development Kit (JDK) from Sun<br />
Microsystems.<br />
The compiler accepts source code conforming to the Java language specification (JLS) and produces bytecode<br />
conforming to the Java Virtual Machine Specification (JVMS).<br />
javac is itself written in Java. The compiler can also be invoked programmatically. [2]<br />
History<br />
On 13 November 2006, Sun's Java Virtual Machine (JVM) and Java Development Kit (JDK) were made available [3]<br />
under the GPL license (see Sun's OpenJDK Hotspot page [4] ).<br />
Since version 0.95, GNU Classpath, a free implementation of the standard class library for Java, supports compiling<br />
and running javac using the Classpath runtime (GIJ) and compiler (GCJ), and also allows one to compile the GNU<br />
Classpath class library, tools and examples with javac itself [5] .<br />
See also<br />
• Java compiler for a general presentation of Java compilers, and a list of other existing alternative compilers.<br />
• Java (programming language)<br />
• Java Platform<br />
• OpenJDK<br />
External links<br />
• Sun's OpenJDK javac page [6]<br />
• The Java Virtual Machine Specification [7]<br />
• JSR 199 [5] Java Compiler API Java Specification Request for invoking the Java compiler from a Java program
javac 203<br />
References<br />
[1] http:/ / java. sun. com/ javase/ downloads/ index. jsp<br />
[2] "[...]an application can access javac programmatically." Shawn Silverman (2002-08-30). JavaWorld - Java tip 131 "Java Tip 131: Make a<br />
statement with javac!" (http:/ / www. javaworld. com/ javatips/ jw-javatip131. html?page=1). JavaWorld.com. JavaWorld - Java tip 131.<br />
Retrieved 2008-08-09.<br />
[3] Sun opens Java (feature story) (http:/ / www. sun. com/ 2006-1113/ feature/ story. jsp)<br />
[4] https:/ / openjdk. dev. java. net/ hotspot/<br />
[5] "This release supports compiling and running the GPL OpenJDK javac compiler lala kamina[...]" "GNU Classpath 0.95 Announcement"<br />
(http:/ / www. gnu. org/ software/ classpath/ announce/ 20070423. html). .<br />
[6] https:/ / openjdk. dev. java. net/ compiler/<br />
[7] http:/ / java. sun. com/ docs/ books/ vmspec/
JavaFX 204<br />
JavaFX<br />
Developer(s) Sun Microsystems<br />
Stable release 1.3 / April 22, 2010<br />
Operating<br />
system<br />
Java Runtime Environment<br />
Platform Cross-platform<br />
Available in JavaFX Script<br />
Type Rich Internet applications<br />
License EULA<br />
Website http:/ / javafx. com/<br />
JavaFX is a Java platform for creating and delivering rich Internet applications that can run across a wide variety of<br />
connected devices. The current release (JavaFX 1.3, April 2010) enables building applications for desktop, browser<br />
and mobile phones. TV set-top boxes, gaming consoles, Blu-ray players and other platforms are planned.<br />
JavaFX builds on Java technology. To build JavaFX apps developers use a statically typed, declarative language<br />
called JavaFX Script; Java code can be integrated into JavaFX programs. JavaFX is compiled to Java bytecode, so<br />
JavaFX applications run on any desktop and browser that runs the Java Runtime Environment (JRE) and on top of<br />
mobile phones running Java ME.<br />
On desktop, the current release supports Windows XP, Windows Vista and Mac OS X operating systems. Beginning<br />
with JavaFX 1.2 Sun has released beta-releases for Linux and OpenSolaris. [1]<br />
On mobile, JavaFX is capable of running on multiple mobile operating systems, including Symbian OS, Windows<br />
Mobile, and proprietary real-time operating systems.<br />
Current release of JavaFX platform includes the following components:<br />
1. The JavaFX SDK: JavaFX compiler and runtime tools. Graphics, media web services, and rich text libraries<br />
2. NetBeans IDE for JavaFX: NetBeans with drag-and-drop palette to add objects with transformations, effects and<br />
animations plus set of samples and best practices. For Eclipse users there is a community-supported plugin hosted<br />
on Project Kenai<br />
3. Tools and plugins for creative tools (a.k.a. Production Suite): Plugins for Adobe Photoshop and Adobe Illustrator<br />
that can export graphics assets to JavaFX Script code, tools to convert SVG graphics into JavaFX Script code and<br />
preview assets converted to JavaFX from other tools<br />
Commentators have speculated JavaFX will compete on the desktop with Adobe Flash Player, Adobe AIR,<br />
OpenLaszlo, and Microsoft Silverlight.<br />
Technical highlights<br />
Common profile. JavaFX is based on the concept of a “Common profile” that is intended to span across all devices<br />
supported by JavaFX. This approach makes it possible for developers to use a common programming model while<br />
building an application targeted for both desktop and mobile devices and to share much of the code, graphics assets<br />
and content between desktop and mobile versions. To address the need for tuning applications on a specific class of<br />
devices, the JavaFX 1.1 platform includes APIs that are desktop or mobile-specific. For example JavaFX Desktop
JavaFX 205<br />
profile includes Swing and advanced visual effects.<br />
Drag-to-Install. From the point of view of the end user “Drag-to-Install” allows them to drag a JavaFX widget (or<br />
application residing in a website and is visible within the browser window) and drop it onto their desktop. The<br />
application will not lose its state or context even after the browser is closed. An application can also be re-launched<br />
by clicking on a shortcut that gets created automatically on the user's desktop. This behavior is enabled<br />
out-of-the-box by the Java applet mechanism and is leveraged by JavaFX from the underlying Java layer. Sun touts<br />
“Drag-to-Install” as opening up of a new distribution model and allowing developers to “break away from the<br />
browser”.<br />
Integrating graphics created with third-party tools. JavaFX includes a set of plug-ins for Adobe Photoshop and<br />
Illustrator that enable advanced graphics to be integrated directly into JavaFX applications. The plug-ins generate<br />
JavaFX Script code that preserves layers and structure of the graphics. Developers can then easily add animation or<br />
effects to the static graphics imported. There is also an SVG graphics converter tool (a.k.a. Media Factory) that<br />
allows for importing graphics and previewing assets after the conversion to JavaFX format.<br />
History<br />
JavaFX Script, the scripting component of JavaFX, began life as a project by Chris Oliver called F3. [2]<br />
Sun Microsystems first announced JavaFX at the JavaOne Worldwide Java Developer conference on May 2007.<br />
In May 2008 Sun Microsystems announced plans to deliver JavaFX for the browser and desktop by the third quarter<br />
of 2008, and JavaFX for mobile devices in the second quarter of 2009. Sun also announced a multi-year agreement<br />
with On2 Technologies to bring comprehensive video capabilities to the JavaFX product family using the company's<br />
TrueMotion Video codec.<br />
Since end of July 2008, developers could download a preview of the JavaFX SDK for Windows and Macintosh, as<br />
well as the JavaFX plugin for NetBeans 6.1. On December 4, 2008 Sun released JavaFX 1.0.<br />
JavaFX 1.1<br />
JavaFX for mobile development was finally made available as part of the JavaFX 1.1 release announced officially on<br />
February 12, 2009.<br />
JavaFX 1.2<br />
JavaFX 1.2 was released at JavaOne on June 2, 2009. This release introduced: [3]<br />
• Beta support for Linux and Solaris,<br />
• Built-in controls and layouts,<br />
• Skinnable CSS controls,<br />
• Built-in chart widgets,<br />
• JavaFX I/O management, masking differences between desktop and mobile devices,<br />
• Speed improvements.
JavaFX 206<br />
JavaFX 1.3<br />
JavaFX 1.3 was released on April 22, 2010. This release introduces [4] :<br />
• Performance improvements<br />
• Support of additional platforms<br />
• Improved support for user interface controls<br />
License<br />
There are currently various licenses for the modules that compose the JavaFX runtime:<br />
• The core JavaFX runtime is still proprietary software and its code has not yet been released to the public, [5]<br />
• The JavaFX compiler [6] and an older version of the 2D Scene graph [7] are released under a GPL v2 license,<br />
• The NetBeans plugin for JavaFX is dual licensed under GPL v2 and CDDL. [5]<br />
During development, Sun explained they will roll out their strategy for the JavaFX licensing model for JavaFX first<br />
release. [8] After the release, Jeet Kaul, Sun's Vice president for Client Software, explained that they will soon publish<br />
a specification for JavaFX and its associated file formats, and will continue to open source the JavaFX runtime, and<br />
decouple this core from the proprietary parts licensed by external parties. [9]<br />
See also<br />
• JavaFX Script<br />
• JavaFX Mobile<br />
• Lobo Web Browser, with JavaFX support<br />
• Curl RIA platform, a declarative programming language for web applications<br />
• UltraLightClient, a Java based approach for Rich Internet Applications<br />
Bibliography<br />
• Weaver, James L.; Gao, Weiqi; Chin, Stephen; Iverson, Dean (January 11, 2010). Pro JavaFX 2 Platform: A<br />
Definitive Guide to Script, Desktop, and Mobile RIA with Java Technology [10] . Apress. pp. 500.<br />
ISBN 1430268727.<br />
• Jordan, Lucas (December 17, 2009). JavaFX Special Effects: Taking Java RIA to the Extreme with Animation,<br />
Multimedia, and Game Elements [11] . Apress. pp. 300. ISBN 1430226234.<br />
• Morris, Simon (November 23, 2009). JavaFX in Action [12] . Manning. pp. 375. ISBN 1933988991.<br />
• Topley, Kim (October 12, 2009). JavaFX Developer's Guide [13] . Addison-Wesley Professional. pp. 640.<br />
ISBN 0321601653.<br />
• Weaver, James L.; Gao, Weiqi; Chin, Stephen; Iverson, Dean (June 22, 2009). Pro JavaFX Platform: Script,<br />
Desktop and Mobile RIA with Java Technology [14] . Apress. pp. 500. ISBN 1430218754.<br />
• Clarke, Jim; Connors, Jim; J. Bruno, Eric (June 15, 2009). JavaFX: Developing Rich Internet Applications [15] .<br />
Prentice Hall. pp. 384. ISBN 013701287X.<br />
• Anderson, Gail; Anderson, Paul (June 15, 2009). Essential JavaFX [16] . Prentice Hall. pp. 360.<br />
ISBN 0137042795.<br />
• Weaver, James L. (May 4, 2009). JavaFX Script: Dynamic Java Scripting for Rich Internet/Client-side<br />
Applications [17] . Apress. pp. 200. ISBN 1590599454.
JavaFX 207<br />
External links<br />
• Official website [18]<br />
• Official JavaFX blog website [19]<br />
• java.sun.com website [20]<br />
• Sun.com - JavaFX [21]<br />
• OpenJFX website [22]<br />
• Sun.com - Learning JavaFX Script: An Introduction for Java Programmers [23]<br />
• Crash Course in Next-Gen RIA: AIR, Silverlight, and JavaFX [24]<br />
• Ellison at JavaOne: Myths About JavaFX, Android, and J2ME [25]<br />
• James Weaver's JavaFX blog [26]<br />
• A JavaOne 2009 talk about JavaFx + Groovy [27]<br />
• fxexperience.com - A blog on JavaFX with insights from core engineers on the JavaFX team and weekly news<br />
posts [28]<br />
• javaontop.com - JavaFx code examples [29]<br />
References<br />
[1] "Software and System Requirements for JavaFX Technology" (http:/ / java. sun. com/ javafx/ 1/ reference/ system-requirements-1-2.<br />
html#javafxsdk). .<br />
[2] Project name F3 (http:/ / blogs. sun. com/ chrisoliver/ entry/ f3)<br />
[3] Marinacci, Joshua (2009-06-09). "Top 5 Most Important Features in JavaFX 1.2" (http:/ / weblogs. java. net/ blog/ joshy/ archive/ 2009/ 06/<br />
top_5_most_impo. html). . Retrieved 2009-06-12.<br />
[4] "JavaFX 1.3 Released, Improves User Experiences" (http:/ / blogs. sun. com/ javafx/ entry/ javafx_1_3_released_delivers). 2010-04-22. .<br />
Retrieved 2010-04-25.<br />
[5] "JavaFX Downloads" (https:/ / openjfx. dev. java. net/ downloads. html). . Retrieved 2008-06-07.<br />
[6] "OpenJFX Compiler Project" (https:/ / openjfx-compiler. dev. java. net/ ). . Retrieved 2008-06-07.<br />
[7] "Project Scene Graph home" (https:/ / scenegraph. dev. java. net/ ). . Retrieved 2008-06-07.<br />
[8] "Will JavaFX technology be released in open source?" (http:/ / java. sun. com/ javafx/ faqs. jsp#2). . Retrieved 2008-06-07. "Sun will continue<br />
to engage the OpenJFX community as we release JavaFX products. This fall we will be rolling out our open source strategy for JavaFX<br />
technology concurrent with the release of version 1 of JavaFX Desktop"<br />
[9] Kaul, Jeet (2008-12-16). "JavaFX - the road ahead" (http:/ / blogs. sun. com/ meetjeet/ entry/ javafx_the_road_ahead). . Retrieved<br />
2009-01-03. "Sun is committed to open standards and open source, and specifications are coming soon(...)There are some dependencies on<br />
licensed code that cannot be open sourced. We are working towards decoupling the dependencies so that the non-proprietary portions can be<br />
open sourced. Currently the JavaFX compiler, Netbeans JavaFX plugin and Eclipse JavaFX plugin are already being developed in the open<br />
source. The scene graph is out in the open. We will put the core runtime out in the open over time."<br />
[10] http:/ / www. apress. com/ book/ view/ 1430268727<br />
[11] http:/ / www. apress. com/ book/ view/ 9781430226239<br />
[12] http:/ / www. manning. com/ morris<br />
[13] http:/ / www. informit. com/ store/ product. aspx?isbn=0321648978<br />
[14] http:/ / www. apress. com/ book/ view/ 1430218754<br />
[15] http:/ / www. informit. com/ store/ product. aspx?isbn=0137013531<br />
[16] http:/ / www. informit. com/ store/ product. aspx?isbn=0137042795<br />
[17] http:/ / www. apress. com/ book/ view/ 1590599454<br />
[18] http:/ / www. javafx. com/<br />
[19] http:/ / blogs. sun. com/ javafx<br />
[20] http:/ / java. sun. com/ javafx/ index. jsp<br />
[21] http:/ / www. sun. com/ software/ javafx/<br />
[22] https:/ / openjfx. dev. java. net/<br />
[23] http:/ / java. sun. com/ developer/ technicalArticles/ scripting/ javafxpart1/<br />
[24] http:/ / www. devx. com/ RichInternetApps/ Article/ 35208/ 1954?pf=true<br />
[25] http:/ / java. sys-con. com/ node/ 994363<br />
[26] http:/ / learnjavafx. typepad. com/<br />
[27] http:/ / canoo. com/ blog/ 2009/ 06/ 04/ dierks-talk-at-j1-javafx-groovy-beauty-productivity/<br />
[28] http:/ / fxexperience. com/<br />
[29] http:/ / www. javaontop. com/ index. php?option=com_content& view=article& id=66& Itemid=17/
Jawin 208<br />
Jawin<br />
Jawin is the abbreviation for the Java/Win32 integration project. It is a free, open source architecture for<br />
interoperation between Java and components exposed through Microsoft's Component Object Model (COM) or<br />
through Win32 Dynamic Link Libraries (DLLs).<br />
Jawin includes a code generator, Jawin Type Browser, supporting generation of stub code for scriptable as well as<br />
non-scriptable COM components. The code generator reads one or more type libraries, and automatically emits the<br />
Java stubs needed to call the component(s). The Jawin Type Browser is not (yet) able to generate code for DLL entry<br />
points, and not all parameter types are supported for COM components.
JExamples 209<br />
JExamples<br />
Industry Computer<br />
software<br />
Headquarters Oakland, CA<br />
Key people Pete Eakle<br />
Chris Webster<br />
Website<br />
jexamples.com [1]<br />
JExamples is a web-based, source code search engine for the Java language. It provides the ability to search the<br />
JExamples database for Java examples. The JExamples database contains the source code of Java open source<br />
projects. The search engine understands the semantics of Java, so the search yields more accurate results than a text<br />
search. JExamples also provides the ability to rate examples and the highest rated examples are shown first.<br />
Available since March, 2005, JExamples was the first public web site to allow searching of open source code.<br />
Products & services<br />
In addition to the web-based search engine, JExamples provides a plug-in for the firefox web browser.<br />
References<br />
• List of search engines<br />
• The JExamples About [2] page describes other advantages of JExamples compared to other source code search<br />
engines.<br />
External links<br />
• JExamples.com [3]<br />
References<br />
[1] http:/ / jexamples. com/<br />
[2] http:/ / www. jexamples. com/ about. html<br />
[3] http:/ / www. jexamples. com
Jfig 210<br />
Jfig<br />
Developer(s) The jfig Team<br />
Operating<br />
system<br />
Cross-platform<br />
Type Vector graphics<br />
editor<br />
License shareware<br />
Website [1]<br />
Jfig is a 2D graphics and diagram editor based on the FIG file format. The user-interface of jfig is based on xfig, a<br />
popular graphics editor for the X11 window system.<br />
The jfig software is written in the Java programming language and can be used on notebooks, PCs, and workstations<br />
running Windows 2000/XP, Mac OS X, OS/2, and most versions of Linux and Unix. Due to the support of<br />
LaTeX-formatted text objects, jfig and xfig are often used to create diagrams for LaTeX and pdflatex documents.<br />
See also<br />
• List of vector graphics editors<br />
• Comparison of vector graphics editors<br />
• xfig<br />
External links<br />
• JFig homepage [1]<br />
• Fig file format [2]<br />
References<br />
[1] http:/ / tams-www. informatik. uni-hamburg. de/ applets/ jfig/<br />
[2] http:/ / epb. lbl. gov/ xfig/ fig-format. html
Jikes 211<br />
Jikes<br />
Developer(s) IBM<br />
Stable release 1.22 / October 3, 2004<br />
Development status Unmaintained<br />
Operating system Cross-platform<br />
Type Java compiler<br />
License IBM Public License<br />
Website http:/ / jikes. sourceforge.<br />
net<br />
Jikes is an open source Java compiler written in C++. It is no longer being updated.<br />
The original version was developed by David L. "Dave" Shields and Philippe Charles at IBM but was quickly<br />
transformed into an open source project contributed to by an active community of developers. Initially hosted by<br />
IBM, the project has subsequently been transferred to SourceForge. Among its accomplishments, it was much faster<br />
in compiling small projects than Sun's own compiler, and provided more helpful warnings and errors.<br />
While the free software community needed free Java implementations, the GNU Compiler for Java became the most<br />
commonly used compiler.<br />
Project Status<br />
As of 2010 the project is no longer being actively developed [1] . The last 1.22 version was released in October 2004<br />
and partially supports Java 5.0 (with respect to new classes, but not new language features) [2] [3] . As no further<br />
versions were released since, Java SE 6 is not supported.<br />
See also<br />
• JikesRVM<br />
• Free Java implementations<br />
• Java compiler<br />
External links<br />
• Jikes Homepage [4]<br />
• Jikes RVM Homepage [4]<br />
• Jikes Archives, hosted by David Shields [5]<br />
References<br />
[1] No project CVS writes for the last 12 months (http:/ / sourceforge. net/ project/ stats/ detail. php?group_id=128803& ugn=jikes& type=cvs&<br />
mode=12months)<br />
[2] http:/ / sourceforge. net/ forum/ forum. php?forum_id=446830<br />
[3] http:/ / sourceforge. net/ project/ showfiles. php?group_id=128803<br />
[4] http:/ / jikesrvm. sourceforge. net/<br />
[5] http:/ / daveshields. wordpress. com/ jikes-archives/
jnSynch 212<br />
jnSynch<br />
jnSynch is a light-weight file synchronization engine written in Java, and released as open source through GPL<br />
license.<br />
jnSynch was inspired in rsync and aims to provide an easy way to perform incremental/differential backups that are<br />
gentle to computer resources such as CPU usage, memory footprint and network bandwidth usage.<br />
As in PGP (Pretty Good Privacy) toolset, jnSynch can be thought as a Pretty Good Incremental File Sychronization<br />
Solution.<br />
It recursively synchronizes a source folder to a target folder. For that, it uses a very simple algorithm of comparing<br />
file's "last change date" attribute, between source and target folders, when the attribute is different between source<br />
and target, the engine replaces the target file with a fresh copy from the source and updates its "last changed date"<br />
attribute to exactly that of the source file.<br />
It was first released to public on September 6, 2008. It is actively hosted in SourceForge.net and code.google.com. It<br />
was later scheduled for deletion in code.google.com, so that it is centralized hosted in Sourceforge.Net.<br />
External links<br />
• jnSynch @ Sourceforge.Net [1]<br />
References<br />
[1] http:/ / sourceforge. net/ projects/ jnsynch/<br />
Michael Kölling<br />
Michael Kölling is a professor and software developer currently with the Department of Computer Science at the<br />
University of Kent. Originally from Bremen, Germany, he is also a key member of the team that developed the BlueJ<br />
and Greenfoot Java learning environments. BlueJ is used in over 780 institutions world wide. [1] Kölling was also<br />
involved in the development of the Blue programming language [2] which was an object-oriented programming<br />
language that was developed especially for teaching. This lead on to what is now BlueJ. [3] BlueJ is currently being<br />
maintained by a joint team at the University of Kent at Canterbury and Deakin University in Melbourne, Australia.<br />
Launched in 2006, Greenfoot is an environment created for teaching programming and computer science concepts<br />
and is targeted for a demographic of 15 years old and up. The software is available in both English and German.<br />
Kölling co-wrote Objects First with Java (4th edition), with David J. Barnes, which has been translated into six<br />
languages, including German, Italian, French and Dutch. BlueJ is available in over a dozen languages.<br />
At the Association of Computing Machinery (ACM) Special Interest Group of Computer Science Education<br />
(SIGCSE) 2010 conference, held in Milwaukee, WI, his work was referenced as one of the most influential tools in<br />
the history of computer science education. This paper described Kölling's work on the Blue programming language,<br />
which preceded BlueJ. [4]
Michael Kölling 213<br />
Microsoft Patent issue<br />
On the 22nd May 2005 Kölling made an entry to the BlueJ website [5] in response to a post on Dan Fernandez's blog<br />
(Lead Product Manager - Visual Studio Express). Fernandez described a new feature of Visual Studio 2005 that<br />
"helps you understand objects at Design Time, rather than runtime." [6] This feature had striking similarities to the<br />
way the object test bench functions within BlueJ.<br />
Kölling did not act on the discovery. However, on May 11, 2006 Microsoft attempted to patent [7] the idea. As the<br />
object test bench is essential to the way it functions, had Microsoft's patent been granted, it was likely that BlueJ<br />
would have had to have been discontinued.<br />
Kölling spoke to Microsoft, namely Jane Prey, and eventually the patent was dropped. [8]<br />
Fernandez posted a response on his blog where he says "the patent application was a mistake and one that should not<br />
have happened. To fix this, Microsoft will be removing the patent application in question. Our sincere apologies to<br />
Michael Kölling and the BlueJ community." [9]<br />
Miscellany<br />
• Kölling received a "Best PhD Thesis Award" in 2000 from The Computing Research and Education Association<br />
of Australasia [10]<br />
• Kölling was awarded the first Victorian Pearcey Award for his development of BlueJ. [11]<br />
• Kölling holds an honorary research position at Deakin University.<br />
• Kölling took part in a debate titled "Resolved: Objects First has failed" at SIGCSE in 2005. He believes that<br />
"Objects First has not failed. We have failed to do it". [12]<br />
Books<br />
• Michael Kölling, Introduction to Programming with Greenfoot: Object-Oriented Programming in Java with<br />
Games and Simulations, Pearson Education, August 2009, ISBN 978-0-13-603753-8.<br />
• David J. Barnes & Michael Kölling, Objects First with Java: A Practical Introduction using BlueJ, Prentice Hall /<br />
Pearson Education, 2008, ISBN 0-13-606086-2.<br />
• Bennedsen, Jens; Caspersen, Michael E.; Kölling, Michael (Eds.), Reflections on the Teaching of Programming<br />
Series: Lecture Notes in Computer Science , Vol. 4821. Springer, 2008, ISBN 978-3-540-77933-9.<br />
See also<br />
• BlueJ<br />
• Greenfoot<br />
• Blue programming language<br />
External links<br />
• Michael Kölling Professor of Computer Science [13] University of Kent<br />
References<br />
[1] "List of BlueJ users" (http:/ / www. bluej. org/ about/ users. html). .<br />
[2] "Blue website" (http:/ / www. cs. kent. ac. uk/ people/ staff/ mik/ blue/ ). .<br />
[3] "Blue status page (19 March 1999)" (http:/ / www. cs. kent. ac. uk/ people/ staff/ mik/ blue/ status. html). .<br />
[4] "SIGCSE2010 Influential Papers website" (http:/ / www. ics. uci. edu/ ~kay/ SIGCSE/ influential/ / ). .<br />
[5] "Comparison between VS and BlueJ's implementation of the object bench concept" (http:/ / www. bluej. org/ vs/ vs-bj. html). .<br />
[6] "Fernandez blog entry on the VS object test bench" (http:/ / blogs. msdn. com/ danielfe/ archive/ 2005/ 01/ 26/ 361375. aspx). .
Michael Kölling 214<br />
[7] "Microsoft patent request" (http:/ / appft1. uspto. gov/ netacgi/ nph-Parser?Sect1=PTO2& Sect2=HITOFF& p=1& u=/ netahtml/ PTO/<br />
search-bool. html& r=1& f=G& l=50& co1=AND& d=PG01& s1=20060101406. PGNR. & OS=DN/ 20060101406& RS=DN/<br />
20060101406). .<br />
[8] "Blog article on Microsoft retraction of the patent" (http:/ / www. bluej. org/ mrt/ ?p=23). .<br />
[9] "Fernandez blog apology" (http:/ / blogs. msdn. com/ danielfe/ archive/ 2007/ 01/ 28/ update-response-to-bluej-patent-issues. aspx). .<br />
[10] "Best PhD Thesis Award" (http:/ / www. core. edu. au/ awards/ Prize Winners. html). .<br />
[11] "Victorian Pearcey Award" (http:/ / www. pearcey. org. au/ index. php/ 1999_Winner_Michael_Kolling). .<br />
[12] "Position summary from SIGCSE debate" (http:/ / www. cs. kent. ac. uk/ people/ staff/ mik/ presentations/<br />
2005-SIGCSE-debate-position-summary. pdf) (PDF). .<br />
[13] http:/ / www. cs. kent. ac. uk/ people/ staff/ mik/<br />
List of Java keywords<br />
In the Java programming language, a keyword is one of 50 reserved<br />
words [1] which have a predefined meaning in the language; because of<br />
this, programmers cannot use keywords as names for variables,<br />
methods, classes, or as any other identifier [2] . Due to their special<br />
functions in the language, most integrated development environments<br />
for Java use syntax highlighting to display keywords in a different<br />
color for easy identification.<br />
List<br />
The following is a list of the keywords in Java, along with brief<br />
descriptions of their functions: [2]<br />
abstract<br />
assert<br />
boolean<br />
break<br />
byte<br />
A snippet of Java code with keywords<br />
highlighted in blue and bold font<br />
The abstract keyword is used to declare a class or method to be abstract [3] . An abstract method has no<br />
implementation; all classes containing abstract methods must themselves be abstract, although not all abstract<br />
classes have abstract methods. Objects of a class which is abstract cannot be instantiated, but can be extended<br />
by other classes. All subclasses of an abstract class must either provide implementations for all abstract<br />
methods, or must also be abstract [4] .<br />
The assert keyword, which was added in J2SE 1.4 [2] [1] , is used to make an assertion—a statement which the<br />
programmer believes is always true at that point in the program. If assertions are enabled when the program is<br />
run and it turns out that an assertion is false, an AssertionError is thrown and the program terminates. This<br />
keyword is intended to aid in debugging [5] [6] .<br />
The boolean keyword is used to declare a field that can store a boolean value; that is, either true or false [7] [8] .<br />
This keyword is also used to declare that a method returns a value of type boolean [9] [3] .<br />
Used to resume program execution at the statement immediately following the current enclosing block or<br />
statement. If followed by a label, the program resumes execution at the statement immediately following the<br />
enclosing labeled statement or block.<br />
The byte keyword is used to declare a field that can store an 8-bit signed two's complement integer. [7] [8] This<br />
keyword is also used to declare that a method returns a value of type byte [9] [3] .
List of Java keywords 215<br />
case<br />
catch<br />
char<br />
class<br />
const<br />
continue<br />
default<br />
do<br />
double<br />
else<br />
The case keyword is used to create individual cases in a switch statement; see switch [10] [11] .<br />
Defines an exception handler—a group of statements that are executed if an exception is thrown in the block<br />
defined by a preceding try keyword. The code is executed only if the class of the thrown exception is<br />
assignment compatible with the exception class declared by the catch clause.<br />
The char keyword is used to declare a field that can store a 16-bit Unicode character [7] [8] . This keyword is<br />
also used to declare that a method returns a value of type char [9] [3] .<br />
A type that defines the implementation of a particular kind of object. A class definition defines instance and<br />
class fields, methods, and inner classes as well as specifying the interfaces the class implements and the<br />
immediate superclass of the class. If the superclass is not explicitly specified, the superclass is implicitly<br />
Object.<br />
Although reserved as a keyword in Java, const is not used and has no function [2] [1] .<br />
Used to resume program execution at the end of the current loop body. If followed by a label, continue<br />
resumes execution at the end of the enclosing labeled loop body.<br />
The default can optionally be used in a switch statement to label a block of statements to be executed if no<br />
case matches the specified value; see switch [10] [11] .<br />
The do keyword is used in conjunction with while to create a do-while loop, which executes a block of<br />
statements associated with the loop and then tests a boolean expression associated with the while. If the<br />
expression evaluates to true, the block is executed again; this continues until the expression evaluates to<br />
false [12] [13] .<br />
The double keyword is used to declare a field that can hold a 64-bit double precision IEEE 754 floating-point<br />
number. [7] [8] This keyword is also used to declare that a method returns a value of type double [9] [3] .<br />
The else keyword is used in conjunction with if to create an if-else statement, which tests a boolean<br />
expression; if the expression evaluates to true, the block of statements associated with the if are evaluated; if it<br />
evaluates to false, the block of statements associated with the else are evaluated [14] [15] .<br />
enum (as of J2SE 5.0)<br />
extends<br />
A Java keyword used to declare an enumerated type. Enumerations extend the base class Enum.<br />
Used in a class declaration to specify the superclass; used in an interface declaration to specify one or more<br />
superinterfaces. Class X extends class Y to add functionality, either by adding fields or methods to class Y, or<br />
by overriding methods of class Y. An interface Z extends one or more interfaces by adding methods. Class X<br />
is said to be a subclass of class Y; Interface Z is said to be a subinterface of the interfaces it extends.<br />
Also used to specify an upper bound on a type parameter in Generics.
List of Java keywords 216<br />
final<br />
finally<br />
float<br />
for<br />
goto<br />
if<br />
implements<br />
import<br />
instanceof<br />
int<br />
interface<br />
Define an entity once that cannot be changed nor derived from later. More specifically: a final class cannot be<br />
subclassed, a final method cannot be overridden, and a final variable can occur at most once as a left-hand<br />
expression. All methods in a final class are implicitly final.<br />
Used to define a block of statements for a block defined previously by the try keyword. The finally block is<br />
executed after execution exits the try block and any associated catch clauses regardless of whether an<br />
exception was thrown or caught, or execution left method in the middle of the try or catch blocks using the<br />
return keyword.<br />
The float keyword is used to declare a field that can hold a 32-bit single precision IEEE 754 floating-point<br />
number. [7] [8] This keyword is also used to declare that a method returns a value of type float [9] [3] .<br />
The for keyword is used to create a for loop, which specifies a variable initialization, a boolean expression,<br />
and an incrementation. The variable initialization is performed first, and then the boolean expression is<br />
evaluated. If the expression evaluates to true, the block of statements associated with the loop are executed,<br />
and then the incrementation is performed. The boolean expression is then evaluated again; this continues until<br />
the expression evaluates to false [16] .<br />
As of J2SE 5.0, the for keyword can also be used to create a so-called "enhanced for loop" [17] , which specifies<br />
an array or Iterable object; each iteration of the loop executes the associated block of statements using a<br />
different element in the array or Iterable [16] .<br />
Although reserved as a keyword in Java, goto is not used and has no function [2] [1] .<br />
The if keyword is used to create an if statement, which tests a boolean expression; if the expression evaluates<br />
to true, the block of statements associated with the if statement is executed. This keyword can also be used to<br />
create an if-else statement; see else [14] [15] .<br />
Included in a class declaration to specify one or more interfaces that are implemented by the current class. A<br />
class inherits the types and abstract methods declared by the interfaces.<br />
Used at the beginning of a source file to specify classes or entire Java packages to be referred to later without<br />
including their package names in the reference. Since J2SE 5.0, import statements can import static members<br />
of a class.<br />
A binary operator that takes an object reference as its first operand and a class or interface as its second<br />
operand and produces a boolean result. The instanceof operator evaluates to true if and only if the runtime type<br />
of the object is assignment compatible with the class or interface.<br />
The int keyword is used to declare a field that can hold a 32-bit signed two's complement integer [7] [8] . This<br />
keyword is also used to declare that a method returns a value of type int [9] [3] .
List of Java keywords 217<br />
long<br />
native<br />
new<br />
package<br />
private<br />
protected<br />
public<br />
return<br />
short<br />
static<br />
Used to declare a special type of class that only contains abstract methods, constant (static final) fields and<br />
static interfaces. It can later be implemented by classes that declare the interface with the implements<br />
keyword.<br />
The long keyword is used to declare a field that can hold a 64-bit signed two's complement integer [7] [8] . This<br />
keyword is also used to declare that a method returns a value of type long [9] [3] .<br />
Used in method declarations to specify that the method is not implemented in the same Java source file, but<br />
rather in another language [3] .<br />
Used to create an instance of a class or array.<br />
A group of types. Packages are declared with the package keyword.<br />
The private keyword is used in the declaration of a method, field, or inner class; private members can only be<br />
accessed by other members of their own class [18] .<br />
The protected keyword is used in the declaration of a method, field, or inner class; protected members can<br />
only be accessed by members of their own class, that class's subclasses or classes from the same package [18] .<br />
The public keyword is used in the declaration of a class, method, or field; public classes, methods, and fields<br />
can be accessed by the members of any class [18] .<br />
Used to finish the execution of a method. It can be followed by a value required by the method definition that<br />
is returned to the caller.<br />
The short keyword is used to declare a field that can hold a 16-bit signed two's complement integer [7] [8] . This<br />
keyword is also used to declare that a method returns a value of type short [9] [3] .<br />
Used to declare a field, method or inner class as a class field. Classes maintain one copy of class fields<br />
regardless of how many instances exist of that class. static also is used to define a method as a class method.<br />
Class methods are bound to the class instead of to a specific instance, and can only operate on class fields.<br />
(Classes and interfaces declared as static members of another class or interface are actually top-level classes<br />
and are not inner classes.)<br />
strictfp (as of J2SE 1.2)<br />
super<br />
A Java keyword used to restrict the precision and rounding of floating point calculations to ensure<br />
portability [3] .<br />
Used to access members of a class inherited by the class in which it appears. Allows a subclass to access<br />
overridden methods and hidden members of its superclass. The super keyword is also used to forward a call<br />
from a constructor to a constructor in the superclass.<br />
Also used to specify a lower bound on a type parameter in Generics.
List of Java keywords 218<br />
switch<br />
The switch keyword is used in conjunction with case and default to create a switch statement, which evaluates<br />
a variable, matches its value to a specific case, and executes the block of statements associated with that case.<br />
If no case matches the value, the optional block labelled by default is executed, if included [10] [11] .<br />
synchronized<br />
this<br />
throw<br />
throws<br />
transient<br />
try<br />
void<br />
volatile<br />
while<br />
Used in the declaration of a method or code block to acquire the mutex lock for an object while the current<br />
thread executes the code [3] . For static methods, the object locked is the class' Class. Guarantees that at most<br />
one thread at a time operating on the same object executes that code. The mutex lock is automatically released<br />
when execution exits the synchronized code. Fields, classes and interfaces cannot be declared as synchronized.<br />
Used to represent an instance of the class in which it appears. this can be used to access class members and as<br />
a reference to the current instance. The this keyword is also used to forward a call from one constructor in a<br />
class to another constructor in the same class.<br />
Causes the declared exception instance to be thrown. This causes execution to continue with the first enclosing<br />
exception handler declared by the catch keyword to handle an assignment compatible exception type. If no<br />
such exception handler is found in the current method, then the method returns and the process is repeated in<br />
the calling method. If no exception handler is found in any method call on the stack, then the exception is<br />
passed to the thread's uncaught exception handler.<br />
Used in method declarations to specify which exceptions are not handled within the method but rather passed<br />
to the next higher level of the program. All uncaught exceptions in a method that are not instances of<br />
RuntimeException must be declared using the throws keyword.<br />
Declares that an instance field is not part of the default serialized form of an object. When an object is<br />
serialized, only the values of its non-transient instance fields are included in the default serial representation.<br />
When an object is deserialized, transient fields are initialized only to their default value.<br />
Defines a block of statements that have exception handling. If an exception is thrown inside the try block, an<br />
optional catch block can handle declared exception types. Also, an optional finally block can be declared that<br />
will be executed when execution exits the try block and catch clauses, regardless of whether an exception is<br />
thrown or not. A try block must have at least one catch clause or a finally block.<br />
The void keyword is used to declare that a method does not return any value [9] .<br />
Used in field declarations to specify that the variable is modified asynchronously by concurrently running<br />
threads. Methods, classes and interfaces thus cannot be declared volatile.<br />
The while keyword is used to create a while loop, which tests a boolean expression and executes the block of<br />
statements associated with the loop if the expression evaluates to true; this continues until the expression<br />
evaluates to false. This keyword can also be used to create a do-while loop; see do [12] [13] .
List of Java keywords 219<br />
Reserved words for literal values<br />
false<br />
null<br />
true<br />
See also<br />
A boolean literal value.<br />
A reference literal value.<br />
A boolean literal value.<br />
• Java annotation<br />
References<br />
• Gosling, James; Joy, Bill; Steele, Guy; and Bracha, Gillad (June 2005). Java Language Specification [47] (Third<br />
ed.). Addison-Wesley Professional. ISBN 978-0321246783. Retrieved 2008-12-03.<br />
• Flanagan, David (March 2005). Java in a Nutshell [19] (Fifth ed.). O'Reilly Media. ISBN 978-0-596-00773-7.<br />
Retrieved 2010-03-03.<br />
References<br />
[1] Flanagan 2005, p. 20.<br />
[2] "Java Language Keywords" (http:/ / java. sun. com/ docs/ books/ tutorial/ java/ nutsandbolts/ _keywords. html). The Java Tutorials. Sun<br />
Microsystems, Inc.. February 14, 2008. . Retrieved 2008-12-02.<br />
[3] Flanagan 2005, pp. 66-67.<br />
[4] "Abstract Methods and Classes" (http:/ / java. sun. com/ docs/ books/ tutorial/ java/ IandI/ abstract. html). The Java Tutorials. Sun<br />
Microsystems, Inc.. February 14, 2008. . Retrieved 2008-12-06.<br />
[5] "Programming With Assertions" (http:/ / java. sun. com/ j2se/ 1. 4. 2/ docs/ guide/ lang/ assert. html). Java 2 SDK, Standard Edition<br />
Documentation. Sun Microsystems, Inc.. 2002. . Retrieved 2008-12-06.<br />
[6] Flanagan 2005, pp. 60-64.<br />
[7] "Primitive Data Types" (http:/ / java. sun. com/ docs/ books/ tutorial/ java/ nutsandbolts/ datatypes. html). The Java Tutorials. Sun<br />
Microsystems, Inc.. February 14, 2008. . Retrieved 2008-12-03.<br />
[8] Flanagan 2005, p. 22.<br />
[9] "Returning a Value from a Method" (http:/ / java. sun. com/ docs/ books/ tutorial/ java/ javaOO/ returnvalue. html). The Java Tutorials. Sun<br />
Microsystems, Inc.. February 14, 2008. . Retrieved 2008-12-03.<br />
[10] "The switch Statement" (http:/ / java. sun. com/ docs/ books/ tutorial/ java/ nutsandbolts/ switch. html). The Java Tutorials. Sun<br />
Microsystems, Inc.. February 14, 2008. . Retrieved 2008-12-03.<br />
[11] Flanagan 2005, pp. 46-48.<br />
[12] "The while and do-while Statements" (http:/ / java. sun. com/ docs/ books/ tutorial/ java/ nutsandbolts/ while. html). The Java Tutorials. Sun<br />
Microsystems, Inc.. February 14, 2008. . Retrieved 2008-12-03.<br />
[13] Flanagan 2005, pp. 48-49.<br />
[14] "The if-then and if-then-else Statements" (http:/ / java. sun. com/ docs/ books/ tutorial/ java/ nutsandbolts/ if. html). The Java Tutorials. Sun<br />
Microsystems, Inc.. February 14, 2008. . Retrieved 2008-12-03.<br />
[15] Flanagan 2005, pp. 44-46.<br />
[16] "The for Statement" (http:/ / java. sun. com/ docs/ books/ tutorial/ java/ nutsandbolts/ for. html). The Java Tutorials. Sun Microsystems, Inc..<br />
February 14, 2008. . Retrieved 2008-12-03.<br />
[17] Flanagan 2005, pp. 50-54.<br />
[18] "Controlling Access to Members of a Class" (http:/ / java. sun. com/ docs/ books/ tutorial/ java/ javaOO/ accesscontrol. html). The Java<br />
Tutorials. Sun Microsystems, Inc.. February 14, 2008. . Retrieved 2008-12-03.<br />
[19] http:/ / oreilly. com/ catalog/ 9780596007737
Marker interface pattern 220<br />
Marker interface pattern<br />
The marker interface pattern is a design pattern in computer science, used with languages that provide run-time<br />
type information about objects. It provides a means to associate metadata with a class where the language does not<br />
have explicit support for such metadata.<br />
To use this pattern, a class implements a marker interface, and methods that interact with instances of that class test<br />
for the existence of the interface. Whereas a typical interface specifies functionality (in the form of method<br />
declarations) that an implementing class must support, a marker interface need not do so. The mere presence of such<br />
an interface indicates specific behavior on the part of the implementing class. Hybrid interfaces, which both act as<br />
markers and specify required methods, are possible but may prove confusing if improperly used.<br />
An example of the application of marker interfaces from the Java programming language is the Serializable<br />
interface. A class implements this interface to indicate that its non-transient data members can be written to an<br />
ObjectOutputStream. The ObjectOutputStream private method writeObject() contains a series of instanceof tests to<br />
determine writeability, one of which looks for the Serializable interface. If none of these tests pass, the method<br />
throws a NotSerializableException.<br />
Critique<br />
A major problem with marker interfaces is that an interface defines a contract for implementing classes, and that<br />
contract is inherited by all subclasses. This means that you cannot "unimplement" a marker. In the example given, if<br />
you create a subclass that you do not want to serialize (perhaps because it depends on transient state), you must<br />
resort to explicitly throwing NotSerializableException (per ObjectOutputStream docs).<br />
A better solution is for the language to support metadata directly:<br />
• Both the .NET framework and Java (as of Java 5 (1.5)) provide support for such metadata. In .NET, they are<br />
called "custom attributes", in Java they are called "annotations". Despite the different name, they are conceptually<br />
the same thing. They can be defined on classes, member variables, methods, and method parameters and may be<br />
accessed using reflection.<br />
• In Python, the term "marker interface" is common in Zope and Plone. Interfaces are declared as metadata and<br />
subclasses can use implementsOnly to declare they do not implement everything from their super classes.<br />
See also<br />
• Design markers for an expansion of this pattern.
Name mangling 221<br />
Name mangling<br />
In software compiler engineering, name mangling (sometimes called name decoration) is a technique used to solve<br />
various problems caused by the need to resolve unique names for programming entities in many modern<br />
programming languages.<br />
It provides a way of encoding additional information in the name of a function, structure, class or another datatype in<br />
order to pass more semantic information from the compilers to linkers.<br />
The need arises where the language allows different entities to be named with the same identifier as long as they<br />
occupy a different namespace (where a namespace is typically defined by a module, class, or explicit namespace<br />
directive).<br />
Any object code produced by compilers is usually linked with other pieces of object code (produced by the same or<br />
another compiler) by a type of program called a linker. The linker needs a great deal of information on each program<br />
entity. For example, to correctly link a function it needs its name, the number of arguments and their types, and so<br />
on.<br />
C name decoration in Microsoft Windows<br />
Although name mangling is not generally required or used by languages that do not support function overloading<br />
(such as C and classic Pascal), they use it in some cases to provide additional information about a function. For<br />
example, compilers targeted at Microsoft Windows platforms support a variety of calling conventions, which<br />
determine the manner in which parameters are sent to subroutines and results returned. Because the different calling<br />
conventions are not compatible with one another, compilers mangle symbols with codes detailing which convention<br />
should be used.<br />
The mangling scheme was established by Microsoft, and has been informally followed by other compilers including<br />
Digital Mars, Borland, and GNU gcc, when compiling code for the Windows platforms. The scheme even applies to<br />
other languages, such as Pascal, D, Delphi, Fortran, and C#. This allows subroutines written in those languages to<br />
call, or be called by, existing Windows libraries using a calling convention different from their default.<br />
When compiling the following C examples:<br />
int _cdecl f (int x) { return 0; }<br />
int _stdcall g (int y) { return 0; }<br />
int _fastcall h (int z) { return 0; }<br />
32 bit compilers emit, respectively:<br />
_f<br />
_g@4<br />
@h@4<br />
In the stdcall and fastcall mangling schemes, the function is encoded as _name@X and @name@X<br />
respectively, where X is the number of bytes, in decimal, of the argument(s) in the parameter list (including those<br />
passed in registers, for fastcall). In the case of cdecl, the function name is merely prefixed by an underscore.
Name mangling 222<br />
Name mangling in C++<br />
C++ compilers are the most widespread and yet least standard users of name mangling. The first C++ compilers<br />
were implemented as translators to C source code, which would then be compiled by a C compiler to object code;<br />
because of this, symbol names had to conform to C identifier rules. Even later, with the emergence of compilers<br />
which produced machine code or assembly directly, the system's linker generally did not support C++ symbols, and<br />
mangling was still required.<br />
The C++ language does not define a standard decoration scheme, so each compiler uses its own. C++ also has<br />
complex language features, such as classes, templates, namespaces, and operator overloading, that alter the meaning<br />
of specific symbols based on context or usage. Meta-data about these features can be disambiguated by mangling<br />
(decorating) the name of a symbol. Because the name-mangling systems for such features are not standardized across<br />
compilers, few linkers can link object code that was produced by different compilers.<br />
Simple example<br />
Consider the following two definitions of f() in a C++ program:<br />
int f (void) { return 1; }<br />
int f (int) { return 0; }<br />
void g (void) { int i = f(), j = f(0); }<br />
These are distinct functions, with no relation to each other apart from the name. If they were natively translated into<br />
C with no changes, the result would be an error — C does not permit two functions with the same name. The C++<br />
compiler therefore will encode the type information in the symbol name, the result being something resembling:<br />
int __f_v (void) { return 1; }<br />
int __f_i (int) { return 0; }<br />
void __g_v (void) { int i = __f_v(), j = __f_i(0); }<br />
Notice that g() is mangled even though there is no conflict; name mangling applies to all symbols.<br />
Complex example<br />
For a more complex example, we'll consider an example of a real-world name mangling implementation: that used<br />
by GNU GCC 3.x, and how it mangles the following example class. The mangled symbol is shown below the<br />
respective identifier name.<br />
namespace wikipedia<br />
{<br />
class article<br />
{<br />
public:<br />
std::string format (void);<br />
/* = _ZN9wikipedia7article6formatEv */<br />
bool print_to (std::ostream&);<br />
/* = _ZN9wikipedia7article8print_toERSo */<br />
class wikilink<br />
{<br />
public:<br />
wikilink (std::string const& name);
Name mangling 223<br />
}<br />
};<br />
};<br />
/* = _ZN9wikipedia7article8wikilinkC1ERKSs */<br />
All mangled symbols begin with _Z (note that an underscore followed by a capital is a reserved identifier in C and<br />
C++, so conflict with user identifiers is avoided); for nested names (including both namespaces and classes), this is<br />
followed by N, then a series of pairs (the length being the length of the next identifier), and finally E.<br />
For example, wikipedia::article::format becomes<br />
_ZN·9wikipedia·7article·6format·E<br />
For functions, this is then followed by the type information; as format() is a void function, this is simply v;<br />
hence:<br />
_ZN·9wikipedia·7article·6format·E·v<br />
For print_to, a standard type std::ostream (or more properly std::basic_ostream) is used, which has the special alias So; a reference to this type is therefore RSo, with<br />
the complete name for the function being:<br />
_ZN·9wikipedia·7article·8print_to·E·RSo<br />
How different compilers mangle the same functions<br />
There isn't a standard scheme by which even trivial C++ identifiers are mangled, and consequently different<br />
compiler vendors (or even different versions of the same compiler, or the same compiler on different platforms)<br />
mangle public symbols in radically different (and thus totally incompatible) ways. Consider how different C++<br />
compilers mangle the same functions:<br />
Notes:<br />
Compiler void h(int) void h(int, char) void h(void)<br />
Intel C++ 8.0 for Linux _Z1hi _Z1hic _Z1hv<br />
HP aC++ A.05.55 IA-64 _Z1hi _Z1hic _Z1hv<br />
GNU GCC 3.x and 4.x _Z1hi _Z1hic _Z1hv<br />
HP aC++ A.03.45 PA-RISC h__Fi h__Fic h__Fv<br />
GNU GCC 2.9x h__Fi h__Fic h__Fv<br />
Microsoft VC++ v6/v7 ?h@@YAXH@Z ?h@@YAXHD@Z ?h@@YAXXZ<br />
Digital Mars C++ ?h@@YAXH@Z ?h@@YAXHD@Z ?h@@YAXXZ<br />
Borland C++ v3.1 @h$qi @h$qizc @h$qv<br />
OpenVMS C++ V6.5 (ARM mode) H__XI H__XIC H__XV<br />
OpenVMS C++ V6.5 (ANSI<br />
mode)<br />
CXX$__7H__FI0ARG51T CXX$__7H__FIC26CDH77 CXX$__7H__FV2CB06E8<br />
OpenVMS C++ X7.1 IA-64 CXX$_Z1HI2DSQ26A CXX$_Z1HIC2NP3LI4 CXX$_Z1HV0BCA19V<br />
SunPro CC __1cBh6Fi_v_ __1cBh6Fic_v_ __1cBh6F_v_<br />
Tru64 C++ V6.5 (ARM mode) h__Xi h__Xic h__Xv<br />
Tru64 C++ V6.5 (ANSI mode) __7h__Fi __7h__Fic __7h__Fv<br />
Watcom C++ 10.6 W?h$n(i)v W?h$n(ia)v W?h$n()v
Name mangling 224<br />
• The Compaq C++ compiler on OpenVMS VAX and Alpha (but not IA-64) and Tru64 has two name mangling<br />
schemes. The original, pre-standard scheme is known as ARM model, and is based on the name mangling<br />
described in the C++ Annotated Reference Manual (ARM). With the advent of new features in standard C++,<br />
particularly templates, the ARM scheme became more and more unsuitable — it could not encode certain<br />
function types, or produced identical mangled names for different functions. It was therefore replaced by the<br />
newer "ANSI" model, which supported all ANSI template features, but was not backwards compatible.<br />
• On IA-64, a standard ABI exists (see external links), which defines (among other things) a standard<br />
name-mangling scheme, and which is used by all the IA-64 compilers. GNU GCC 3.x, in addition, has adopted<br />
the name mangling scheme defined in this standard for use on other, non-Intel platforms.<br />
Handling of C symbols when linking from C++<br />
The job of the common C++ idiom:<br />
#ifdef __cplusplus<br />
extern "C" {<br />
#endif<br />
/* ... */<br />
#ifdef __cplusplus<br />
}<br />
#endif<br />
is to ensure that the symbols following are "unmangled" – that the compiler emits a binary file with their names<br />
undecorated, as a C compiler would do. As C language definitions are unmangled, the C++ compiler needs to avoid<br />
mangling references to these identifiers.<br />
For example, the standard strings library, usually contains something resembling:<br />
#ifdef __cplusplus<br />
extern "C" {<br />
#endif<br />
void *memset (void *, int, size_t);<br />
char *strcat (char *, const char *);<br />
int strcmp (const char *, const char *);<br />
char *strcpy (char *, const char *);<br />
#ifdef __cplusplus<br />
}<br />
#endif<br />
Thus, code such as:<br />
if (strcmp(argv[1], "-x") == 0)<br />
else<br />
strcpy(a, argv[2]);<br />
memset (a, 0, sizeof(a));<br />
uses the correct, unmangled strcmp and memset. If the extern had not been used, the (SunPro) C++ compiler<br />
would produce code equivalent to:
Name mangling 225<br />
if (__1cGstrcmp6Fpkc1_i_(argv[1], "-x") == 0)<br />
else<br />
__1cGstrcpy6Fpcpkc_0_(a, argv[2]);<br />
__1cGmemset6FpviI_0_ (a, 0, sizeof(a));<br />
Since those symbols do not exist in the C runtime library (e.g. libc), link errors would result.<br />
Standardised name mangling in C++<br />
While it is a relatively common belief that standardised name mangling in the C++ language would lead to greater<br />
interoperability between implementations, this is not really the case. Name mangling is only one of several<br />
application binary interface issues in a C++ implementation. Other ABI issues like exception handling, virtual table<br />
layout, structure padding, etc. cause differing C++ implementations to be incompatible. Further, requiring a<br />
particular form of mangling would cause issues for systems where implementation limits (e.g. length of symbols)<br />
dictate a particular mangling scheme. A standardised requirement for name mangling would also prevent an<br />
implementation where mangling was not required at all — for example, a linker which understood the C++<br />
language.<br />
The C++ standard therefore does not attempt to standardise name mangling. On the contrary, the Annotated C++<br />
Reference Manual (also known as ARM, ISBN 0-201-51459-1, section 7.2.1c) actively encourages the use of<br />
different mangling schemes to prevent linking when other aspects of the ABI, such as exception handling and virtual<br />
table layout, are incompatible.<br />
Real-world effects of C++ name mangling<br />
Because C++ symbols are routinely exported from DLL and shared object files, the name mangling scheme is not<br />
merely a compiler-internal matter. Different compilers (or different versions of the same compiler, in many cases)<br />
produce such binaries under different name decoration schemes, meaning that symbols are frequently unresolved if<br />
the compilers used to create the library and the program using it employed different schemes. For example, if a<br />
system with multiple C++ compilers installed (e.g. GNU GCC and the OS vendor's compiler) wished to install the<br />
Boost library, it would have to be compiled twice — once for the vendor compiler and once for GCC.<br />
It is good for safety purposes that compilers producing incompatible object codes (codes based on different ABIs,<br />
regarding e.g. classes and exceptions) use different name mangling schemes. This guarantees that these<br />
incompatibilities are detected at the linking phase, not when executing the software.<br />
For this reason name decoration is an important aspect of any C++-related ABI.<br />
Name mangling in Java<br />
The language, compiler, and .class file format were all designed together (and had object-orientation in mind from<br />
the start), so the primary problem solved by name mangling doesn't exist in implementations of the Java runtime.<br />
There are, however, cases where an analogous transformation and qualification of names is necessary.<br />
Creating unique names for inner and anonymous classes<br />
The scope of anonymous classes is confined to their parent class, so the compiler must produce a "qualified" public<br />
name for the inner class, to avoid conflict where other classes (inner or not) exist in the same namespace. Similarly,<br />
anonymous classes must have "fake" public names generated for them (as the concept of anonymous classes exists<br />
only in the compiler, not the runtime). So, compiling the following java program<br />
public class foo {<br />
class bar {
Name mangling 226<br />
}<br />
}<br />
public int x;<br />
public void zark () {<br />
}<br />
Object f = new Object () {<br />
};<br />
will produce three .class files:<br />
public String toString() {<br />
}<br />
return "hello";<br />
• foo.class, containing the main (outer) class foo<br />
• foo$bar.class, containing the named inner class foo.bar<br />
• foo$1.class, containing the anonymous inner class (local to method foo.zark)<br />
All of these class names are valid (as $ symbols are permitted in the JVM specification) and these names are "safe"<br />
for the compiler to generate, as the Java language definition prohibits $ symbols in normal java class definitions.<br />
Name resolution in Java is further complicated at runtime, as fully qualified class names are unique only inside a<br />
specific classloader instance. Classloaders are ordered hierarchically and each Thread in the JVM has a so called<br />
context class loader, so in cases where two different classloader instances contain classes with the same name, the<br />
system first tries to load the class using the root (or system) classloader and then goes down the hierarchy to the<br />
context class loader.<br />
Handling issues with the java to native interface<br />
Java's native method support allows java language programs to call out to programs written in another language<br />
(generally either C or C++). There are two name-resolution concerns here, neither of which is implemented in a<br />
particularly standard manner.<br />
Name mangling in Python<br />
A Python programmer can explicitly designate that an identifier is a "private name" (its scope is confined to the<br />
class) by setting the first two characters of the identifier to be underscores. Mangling will not be performed if the<br />
identifier ends with more than one underscore, for example, __thing will be mangled, as will ___thing and __thing_,<br />
but __thing__ and __thing___ will not. On encountering these, the Python compiler or interpreter turns these private<br />
names into global symbols by prepending a string consisting of a single underscore and the name of the enclosing<br />
class.<br />
So, for example,<br />
class Test:<br />
def __private_symbol(self):<br />
pass<br />
def normal_symbol(self):<br />
pass<br />
print dir(Test)<br />
will output:
Name mangling 227<br />
['_Test__private_symbol',<br />
'__doc__',<br />
'__module__',<br />
'normal_symbol']<br />
Name mangling in Borland's Turbo Pascal / Delphi range<br />
To avoid name mangling in Pascal, use:<br />
exports<br />
myFunc name 'myFunc', myProc name 'myProc';<br />
Name mangling in Objective-C<br />
Essentially two forms of method exist in Objective-C, the class ("static") method, and the instance method. A<br />
method declaration in Objective-C is of the following form<br />
+ method name: argument name 1 :parameter 1 ...<br />
- method name: argument name 1 :parameter 1 ...<br />
Class methods are signified by +, instance methods use -. A typical class method declaration may then look like:<br />
+ (id) initWithX: (int) number andY: (int) number;<br />
+ (id) new;<br />
with instance methods looking like<br />
- (id) value;<br />
- (id) setValue: (id) new_value;<br />
Each of these method declarations have a specific internal representation. When compiled, each method is named<br />
according to the following scheme for class methods:<br />
_c_Class_methodname_name 1 _name 2 _ ...<br />
and this for instance methods:<br />
_i_Class_methodname_name 1 _name 2 _ ...<br />
The colons in the Objective-C syntax are translated to underscores. So, the Objective-C class method + (id)<br />
initWithX: (int) number andY: (int) number;, if belonging to the Point class would translate as<br />
_c_Point_initWithX_andY_, and the instance method (belonging to the same class) - (id) value;<br />
would translate to _i_Point_value.<br />
Each of the methods of a class are labeled in this way. However, in order to look up a method that a class may<br />
respond to would be tedious if all methods are represented in this fashion. Each of the methods is assigned a unique<br />
symbol (such as an integer). Such a symbol is known as a selector. In Objective-C, one can manage selectors directly<br />
— they have a specific type in Objective-C — SEL.<br />
During compilation, a table is built that maps the textual representation (such as _i_Point_value) to selectors<br />
(which are given a type SEL). Managing selectors is more efficient than manipulating the textual representation of a<br />
method. Note that a selector only matches a method's name, not the class it belongs to — different classes can have<br />
different implementations of a method with the same name. Because of this, implementations of a method are given<br />
a specific identifier too — these are known as implementation pointers, and are given a type also, IMP.
Name mangling 228<br />
Message sends are encoded by the compiler as calls to the id objc_msgSend (id receiver, SEL<br />
selector, ...) function, or one of its cousins, where receiver is the receiver of the message, and SEL<br />
determines the method to call. Each class has its own table that maps selectors to their implementations — the<br />
implementation pointer specifies where in memory the actual implementation of the method resides. There are<br />
separate tables for class and instance methods. Apart from being stored in the SEL to IMP lookup tables, the<br />
functions are essentially anonymous.<br />
The SEL value for a selector does not vary between classes. This enables polymorphism.<br />
The Objective-C runtime maintains information about the argument and return types of methods. However, this<br />
information is not part of the name of the method, and can vary from class to class.<br />
Since Objective-C does not support namespaces, there is no need for mangling of class names (that do appear as<br />
symbols in generated binaries).<br />
Name mangling in Fortran<br />
Name mangling is also necessary in Fortran compilers, originally because the language is case insensitive. Further<br />
mangling requirements were imposed later in the evolution of the language because of the addition of modules and<br />
other features in the Fortran 90 standard. The case mangling, especially, is a common issue that must be dealt with in<br />
order to call Fortran libraries (such as LAPACK) from other languages (such as C).<br />
Because of the case insensitivity, the name of a subroutine or function "FOO" must be converted to a canonical case<br />
and format by the Fortran compiler so that it will be linked in the same way regardless of case. Different compilers<br />
have implemented this in various ways, and no standardization has occurred. The AIX and HP-UX Fortran compilers<br />
convert all identifiers to lower case ("foo"), while the Cray Unicos Fortran compilers converted identifiers all upper<br />
case ("FOO"). The GNU g77 compiler converts identifiers to lower case plus an underscore ("foo_"), except that<br />
identifiers already containing an underscore ("FOO_BAR") have two underscores appended ("foo_bar__"),<br />
following a convention established by f2c. Many other compilers, including SGI's IRIX compilers, gfortran, and<br />
Intel's Fortran compiler, convert all identifiers to lower case plus an underscore ("foo_" and "foo_bar_").<br />
Identifiers in Fortran 90 modules must be further mangled, because the same subroutine name may apply to different<br />
routines in different modules.<br />
See also<br />
• Language binding<br />
• Foreign function interface<br />
• Calling convention<br />
• Application programming interface - API<br />
• Application Binary Interface - ABI<br />
• Comparison of application virtual machines<br />
• Java Native Interface<br />
• SWIG - opensource interfaces bindings generator from many languages to many languages
Name mangling 229<br />
External links<br />
• Linux Itanium ABI for C++ [1] , including name mangling scheme.<br />
• c++filt [2] — filter to demangle encoded C++ symbols<br />
• undname [3] — msvc tool to demangle names.<br />
• The Objective-C Runtime System [4] — From Apple's The Objective-C Programming Language 1.0 [5]<br />
• C++ Name Mangling/Demangling [6] Quite detailed explanation of Visual C++ compiler name mangling scheme<br />
• PHP UnDecorateSymbolName [7] a php script that demangles Microsoft Visual C's function names.<br />
• Calling conventions for different C++ compilers [8] contains detailed description of name mangling schemes for<br />
various x86 C++ compilers<br />
• Macintosh C/C++ ABI Standard Specification [9]<br />
• Mixing C and C++ Code [10]<br />
• Symbol management – 'Linkers and Loaders' by John R. Levine [11]<br />
References<br />
[1] http:/ / www. codesourcery. com/ cxx-abi/ abi. html#mangling<br />
[2] http:/ / sources. redhat. com/ binutils/ docs-2. 15/ binutils/ c--filt. html<br />
[3] http:/ / msdn2. microsoft. com/ en-us/ library/ 5x49w699. aspx<br />
[4] http:/ / developer. apple. com/ legacy/ mac/ library/ documentation/ Cocoa/ Conceptual/ OOPandObjC1/ Articles/ ocRuntimeSystem. html#/ /<br />
apple_ref/ doc/ uid/ TP40005191-CH9-CJBBBCHG<br />
[5] http:/ / developer. apple. com/ legacy/ mac/ library/ documentation/ Cocoa/ Conceptual/ OOPandObjC1/ Introduction/ introObjectiveC. html<br />
[6] http:/ / www. kegel. com/ mangle. html#operators<br />
[7] http:/ / sourceforge. net/ projects/ php-ms-demangle/<br />
[8] http:/ / www. agner. org/ optimize/ calling_conventions. pdf<br />
[9] http:/ / developer. apple. com/ tools/ mpw-tools/ compilers/ docs/ abi_spec. pdf<br />
[10] http:/ / www. parashift. com/ c+ + -faq-lite/ mixing-c-and-cpp. html<br />
[11] http:/ / www. iecc. com/ linker/ linker05. html
Patrick Naughton 230<br />
Patrick Naughton<br />
Patrick Naughton (born in 1965) is an American software developer, best known as being one of the original<br />
creators of the Java programming language.<br />
Career<br />
Working for Sun<br />
As a Sun engineer, Patrick Naughton had become increasingly frustrated with the state of Sun's C++ and C APIs<br />
(application programming interfaces) and tools. While considering moving to NeXT, Naughton was offered a chance<br />
to work on new technology and thus the Stealth Project was started.<br />
The Stealth Project was soon renamed to the Green Project with James Gosling and Mike Sheridan joining<br />
Naughton. Together with other engineers, they began work in a small office on Sand Hill Road in Menlo Park,<br />
California. They were attempting to develop a new technology for programming next generation smart appliances,<br />
[1] [2]<br />
which Sun expected to be a major new opportunity.<br />
In June and July 1994, after three days of brainstorming with John Gage, the Director of Science for Sun, James<br />
Gosling, Bill Joy, Naughton, Wayne Rosing, and Eric Schmidt, the team re-targeted the platform for the World Wide<br />
Web. They felt that with the advent of the first graphical web browser, Mosaic, the Internet was on its way to<br />
evolving into the same highly interactive medium that they had envisioned for cable TV. As a prototype, Naughton<br />
wrote a small browser, WebRunner, later renamed HotJava. [3]<br />
After Sun<br />
In 1994, Naughton quit Sun for Starwave (then a property of Paul Allen) to develop server Java applications for high<br />
profile web sites (in times when J2EE frameworks did not exist yet) [3] . They developed ESPN.com,<br />
ABCNEWS.com, Outside Online, and Mr. Showbiz.com among other groundbreaking sites, setting the standard for<br />
much of the commercial Internet explosion of the late 1990s.<br />
In 1998, Walt Disney Internet Group acquired Starwave and amalgamated it with Infoseek in the Go Network<br />
company. As a result, Naughton became executive vice president of Infoseek.<br />
After his arrest in 1999, Naughton was fired from Infoseek. [4] He is currently employed by the Seattle hedge fund L1<br />
Partners.<br />
Arrest for sex crimes<br />
Patrick Naughton was arrested by the FBI on 16 September 1999 and was prosecuted for traveling in interstate<br />
commerce with the intent to have sex with a minor, in violation of 18 U.S.C. §2423(b). [4] [5] [6] After the trial ended<br />
in a hung jury, the government moved for a new trial, then struck a plea agreement where he took a reduced<br />
sentence, serving no prison time, in exchange for working for the FBI for free for a year. [7] [8] His line of defense<br />
was that he claimed he was persuaded to participate online in a ritualized sexual role-playing exercise, dealing with a<br />
mature woman acting as a girl. [8]
Patrick Naughton 231<br />
See also<br />
• History of Java<br />
• Online identity<br />
References<br />
[1] Patrick Naughton. "Java Was Strongly Influenced by Objective-C" (http:/ / cs. gmu. edu/ ~sean/ stuff/ java-objc. html). . Retrieved<br />
2009-08-02.<br />
[2] "Java Technology: The Early Years" (http:/ / java. sun. com/ features/ 1998/ 05/ birthday. html). Sun Microsystems. . Retrieved 2009-08-02.<br />
[3] "Le cadre, le piège et la loi" (http:/ / www. cyberie. qc. ca/ chronik/ 990928. html#b) (in French). cyberie.qc.ca. . Retrieved 2009-08-02.<br />
[4] "Patrick Doesn't Work Here Anymore" (http:/ / www. wired. com/ wired/ archive/ 7. 12/ mustread. html?pg=5). Wired News. December<br />
1999. . Retrieved 2009-08-02.<br />
[5] "CEO: Naughton said 'I did it'" (http:/ / news. zdnet. co. uk/ security/ 0,1000000189,2075734,00. htm). zdnet.co.uk. 1999-12-09. . Retrieved<br />
2009-08-02.<br />
[6] "The Fantasy Defense" (http:/ / www. cbsnews. com/ stories/ 2000/ 05/ 24/ eveningnews/ main199192. shtml). CBS News. 2000-05-31. .<br />
Retrieved 2009-08-02.<br />
[7] "Patrick Naughton faces retrial" (http:/ / www. zdnet. com. au/ news/ soa/ Patrick-Naughton-faces-retrial-/ 0,139023165,120104206,00. htm).<br />
zdnet.co.uk. 2000-10-13. . Retrieved 2009-08-02.<br />
[8] "Paper 2: Legal Treatment Of Online Identity" (http:/ / emoglen. law. columbia. edu/ CPC/ discuss/ 383. html). emoglen.law.columbia.edu.<br />
2006-04-29. . Retrieved 2009-08-02. "At his criminal trial, Naughton employed what has come to be known as the "fantasy defense": citing his<br />
technical sophistication and the adult tone of his interlocutor's conversation, he claimed that he believed her to be an adult woman playing the<br />
role of a teenage girl; which, indeed, she was, although for different reasons from those Naughton claimed to have believed."<br />
New I/O<br />
New I/O or Non-blocking I/O, usually called NIO, is a collection of Java programming language APIs that offer<br />
features for intensive I/O operations. It was introduced with the J2SE 1.4 release of Java by Sun Microsystems to<br />
complement an existing standard I/O. NIO was developed under the Java Community Process as JSR 51. [1] As of<br />
2006, an extension to NIO, called NIO2, is being developed under JSR 203; JSR 203 is scheduled to be included in<br />
Java SE 7 ("Dolphin"). [2]<br />
Features and organization.<br />
The APIs of NIO were designed to provide access to the low-level I/O operations of modern operating systems.<br />
Although the APIs are themselves relatively high-level, the intent is to facilitate an implementation that can directly<br />
use the most efficient operations of the underlying platform.<br />
The Java NIO APIs are provided in the java.nio package and its subpackages. The documentation by Sun<br />
Microsystems identifies these features.<br />
• Buffers for data of primitive types<br />
• Character set encoders and decoders<br />
• A pattern-matching facility based on Perl-style regular expressions (in package java.util.regex)<br />
• Channels, a new primitive I/O abstraction<br />
• A file interface that supports locks and memory mapping of files up to Integer.MAX_VALUE bytes (2 GiB)<br />
• A multiplexed, non-blocking I/O facility for writing scalable servers
New I/O 232<br />
NIO buffers<br />
NIO data transfer is based on buffers (java.nio.Buffer and related classes). These classes represent a contiguous<br />
extent of memory, together with a small number of data transfer operations. Although theoretically these are<br />
general-purpose data structures, the implementation may select memory for alignment or paging characteristics,<br />
which are not otherwise accessible in Java. Typically, this would be used to allow the buffer contents to occupy the<br />
same physical memory used by the underlying operating system for its native I/O operations, thus allowing the most<br />
direct transfer mechanism, and eliminating the need for any additional copying. In most operating systems, provided<br />
the particular area of memory has the right properties, transfer can take place without using the CPU at all. The NIO<br />
buffer is intentionally limited in features in order to support these goals.<br />
There are buffer classes for all of Java's primitive types except boolean, which can share memory with byte buffers<br />
and allow arbitrary interpretation of the underlying bytes.<br />
Usage<br />
NIO buffers maintain several pointers that dictate the function of its accessor methods. The NIO buffer<br />
implementation contains a rich set of methods for modifying these pointers:<br />
• The flip() method, rather than performing a "flip" or paging function in the canonical sense, moves the position<br />
pointer to the origin of the underlying array (if any) and the limit pointer to the former position of the position<br />
pointer.<br />
• Three get() methods are supplied for transferring data out of a NIO buffer. The bulk implementation, rather than<br />
performing a "get" in the traditional sense, "puts" the data into a specified array. The "offset" argument supplied<br />
to this method refers not to the offset from within the buffer from which to read, nor an offset from the position<br />
pointer, but rather the offset from 0 within the target array.<br />
• Unless using the absolute get() and put() methods, any get() or put() is conducted from the position pointer.<br />
Should one need to read from a different position within the underlying array, whilst not adjusting the writing<br />
position, the mark() and reset() methods have been supplied.<br />
• The mark() method effectively stores the position of the position pointer by setting the mark pointer to the<br />
position of the position pointer. The reset() method causes the position pointer to move to the mark pointer's<br />
position.<br />
• Upon invocation of the clear() method or the flip() method the mark pointer is discarded.<br />
• The clear() method does not ensure zero-ing of the buffer, but does return the limit pointer to the upper boundary<br />
of the underlying array, and the position pointer to zero.<br />
• put() and get() operations for NIO buffers are not thread safe.<br />
• You can only map() a java.nio.MappedByteBuffer from a java.nio.channels.FileChannel up to<br />
Integer.MAX_VALUE in size (2GiB); regions beyond this limit can be accessed using an offset greater than zero.<br />
Channels<br />
Channels (classes implementing the interface java.nio.channels.Channel) are designed to provide for bulk data<br />
transfers to and from NIO buffers. This is a low-level data transfer mechanism that exists in parallel with the classes<br />
of the higher-level I/O library (packages java.io and java.net). A channel implementation can be obtained from a<br />
high-level data transfer class such as java.io.File, java.net.ServerSocket, or java.net.Socket, and vice versa. Channels<br />
are analogous to "file descriptors" found in Unix-like operating systems.<br />
File channels (java.nio.channels.FileChannel) can use arbitrary buffers but can also establish a buffer directly<br />
mapped to file contents using memory-mapped I/O. They can also interact with file system locks. Similarly, socket<br />
channels (java.nio.channels.SocketChannel and java.nio.channels.ServerSocketChannel) allow for data transfer<br />
between sockets and NIO buffers.
New I/O 233<br />
FileChannel can be used to do a file copy, which is potentially far more efficient than using old read/write with a<br />
byte array. The typical code for this is:<br />
// Getting file channels<br />
FileChannel in = new FileInputStream(source).getChannel();<br />
FileChannel out = new FileOutputStream(target).getChannel();<br />
// JavaVM does its best to do this as native I/O operations.<br />
in.transferTo (0, in.size(), out);<br />
// Closing file channels will close corresponding stream objects as<br />
well.<br />
out.close();<br />
in.close();<br />
Selectors<br />
A selector (java.nio.channels.Selector and subclasses) provides a mechanism for waiting on channels and<br />
recognizing when one or more become available for data transfer. When a number of channels are registered with the<br />
selector, it enables blocking of the program flow until at least one channel is ready for use, or until an interruption<br />
condition occurs.<br />
Although this multiplexing behavior could be implemented with Java threads, the selector can provide a significantly<br />
more efficient implementation using native platform threads or, more likely, even lower-level operating system<br />
constructs. A POSIX-compliant operating system, for example, would have direct representations of these concepts,<br />
select(). A notable application of this design would be the common paradigm in server software which involves<br />
simultaneously waiting for responses on a number of sessions.<br />
Character sets<br />
In Java, a character set is a mapping between Unicode characters (or a subset of them) and bytes. The<br />
java.nio.charset package of NIO provides facilities for identifying character sets and providing encoding and<br />
decoding algorithms for new mappings.<br />
Regular expressions<br />
The regular expression library in the java.util.regex package provides a powerful search facility for character data<br />
based on regular expression matching.<br />
The following example was adopted from the NIO API guide examples [3] , where there are more examples.<br />
/*<br />
* @(#)Grep.java 1.3 01/12/13<br />
* Search a list of files for lines that match a given<br />
regular-expression<br />
* pattern. Demonstrates NIO mapped byte buffers, charsets, and<br />
regular<br />
* expressions.<br />
*<br />
* Copyright 2001-2002 Sun Microsystems, Inc. All Rights Reserved.<br />
*<br />
* Redistribution and use in source and binary forms, with or
New I/O 234<br />
* without modification, are permitted provided that the following<br />
* conditions are met:<br />
*<br />
* -Redistributions of source code must retain the above copyright<br />
* notice, this list of conditions and the following disclaimer.<br />
*<br />
* -Redistribution in binary form must reproduct the above copyright<br />
* notice, this list of conditions and the following disclaimer in<br />
* the documentation and/or other materials provided with the<br />
* distribution.<br />
*<br />
* Neither the name of Sun Microsystems, Inc. or the names of<br />
* contributors may be used to endorse or promote products derived<br />
* from this software without specific prior written permission.<br />
*<br />
* This software is provided "AS IS," without a warranty of any<br />
* kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND<br />
* WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,<br />
* FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY<br />
* EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY<br />
* DAMAGES OR LIABILITIES SUFFERED BY LICENSEE AS A RESULT OF OR<br />
* RELATING TO USE, MODIFICATION OR DISTRIBUTION OF THE SOFTWARE OR<br />
* ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE<br />
* FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT,<br />
* SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER<br />
* CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF<br />
* THE USE OF OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN<br />
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.<br />
*<br />
* You acknowledge that Software is not designed, licensed or<br />
* intended for use in the design, construction, operation or<br />
* maintenance of any nuclear facility.<br />
*/<br />
import java.io.*;<br />
import java.nio.*;<br />
import java.nio.channels.*;<br />
import java.nio.charset.*;<br />
import java.util.regex.*;<br />
public class Grep {<br />
// Charset and decoder for ISO-8859-15<br />
private static Charset charset = Charset.forName("ISO-8859-15");<br />
private static CharsetDecoder decoder = charset.newDecoder();
New I/O 235<br />
// Pattern used to parse lines<br />
private static Pattern linePattern = Pattern.compile(".*\r?\n");<br />
// The input pattern that we're looking for<br />
private static Pattern pattern;<br />
// Compile the pattern from the command line<br />
private static void compile(String pat) {<br />
}<br />
applying<br />
try {<br />
pattern = Pattern.compile(pat);<br />
} catch (PatternSyntaxException x) {<br />
}<br />
System.err.println(x.getMessage());<br />
System.exit(1);<br />
// Use the linePattern to break the given CharBuffer into lines,<br />
// the input pattern to each line to see if we have a match<br />
private static void grep(File f, CharBuffer cb) {<br />
}<br />
Matcher lm = linePattern.matcher(cb); // Line matcher<br />
Matcher pm = null; // Pattern matcher<br />
int lines = 0;<br />
while (lm.find()) {<br />
}<br />
lines++;<br />
CharSequence cs = lm.group(); // The current line<br />
if (pm == null)<br />
else<br />
pm = pattern.matcher(cs);<br />
pm.reset(cs);<br />
if (pm.find())<br />
System.out.print(f + ":" + lines + ":" + cs);<br />
if (lm.end() == cb.limit())<br />
break;<br />
// Search for occurrences of the input pattern in the given file<br />
private static void grep(File f) throws IOException {<br />
// Open the file and then get a channel from the stream<br />
FileInputStream fis = new FileInputStream(f);<br />
FileChannel fc = fis.getChannel();<br />
// Get the file's size and then map it into memory<br />
int sz = (int)fc.size();<br />
MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0,
New I/O 236<br />
sz);<br />
}<br />
}<br />
// Decode the file into a char buffer<br />
CharBuffer cb = decoder.decode(bb);<br />
// Perform the search<br />
grep(f, cb);<br />
// Close the channel and the stream<br />
fc.close();<br />
public static void main(String[] args) {<br />
}<br />
if (args.length < 2) {<br />
}<br />
System.err.println("Usage: java Grep pattern file...");<br />
return;<br />
compile(args[0]);<br />
for (int i = 1; i < args.length; i++) {<br />
}<br />
File f = new File(args[i]);<br />
try {<br />
grep(f);<br />
} catch (IOException x) {<br />
}<br />
JDK 7 and NIO.2<br />
System.err.println(f + ": " + x);<br />
JDK 7 includes a java.nio.file package which, with the java.io.file.Path class (also new to JDK 7), among other<br />
features, provides extended capabilities for filesystem tasks, e.g. can work with symbolic/hard links and dump big<br />
directory listings into buffers more quickly than the old File class does.<br />
External links<br />
• Java SE 6 API Javadocs<br />
• JDK 5.0 New I/O-related APIs & Developer Guides [4] - description of New I/O by Sun Microsystems<br />
• JSR 51 [5] (NIO)<br />
• JSR 203 [6] (NIO2)<br />
• Architecture of a Highly Scalable NIO-Based Server [7] - discussion on Java NIO and patterns of usage
New I/O 237<br />
References<br />
[1] "JSR 51: New I/O APIs for the JavaTM Platform" (http:/ / www. jcp. org/ en/ jsr/ detail?id=51). The Java Community Process(SM) Program<br />
- JSRs: Java Specification Requests. . Retrieved 2009-05-23.<br />
[2] "This JSR will be delivered as part of Java SE 7 "Dolphin"." "JSR 203: More New I/O APIs for the JavaTM Platform ("NIO.2")" (http:/ /<br />
www. jcp. org/ en/ jsr/ detail?id=203). The Java Community Process(SM) Program - JSRs: Java Specification Requests. 2006-01-30. .<br />
Retrieved 2009-05-23.<br />
[3] http:/ / java. sun. com/ j2se/ 1. 4. 2/ docs/ guide/ nio/ example/ index. html<br />
[4] http:/ / java. sun. com/ j2se/ 1. 5. 0/ docs/ guide/ nio/ index. html<br />
[5] http:/ / www. jcp. org/ en/ jsr/ detail?id=51<br />
[6] http:/ / www. jcp. org/ en/ jsr/ detail?id=203<br />
[7] http:/ / today. java. net/ pub/ a/ today/ 2007/ 02/ 13/ architecture-of-highly-scalable-nio-server. html<br />
Object type (object-oriented programming)<br />
In computer science, an object type (a.k.a. wrapping object) is a datatype which is used in object-oriented<br />
programming to wrap a non-object type to make it look like a dynamic object.<br />
Some object-oriented programming languages make a distinction between reference and value types, often referred<br />
to as objects and non-objects on platforms where complex value types don't exist, for reasons such as runtime<br />
efficiency and syntax or semantic issues. For example, Java has primitive wrapper classes corresponding to each<br />
primitive type: Integer and int, Character and char, Float and float, etc. Languages like C++ have little or no notion<br />
of reference type; thus, the use of object type is of little interest.<br />
Boxing<br />
Boxing is the process of placing a primitive type within an object so that the primitive can be used as a reference<br />
object. For example, lists may have certain methods which arrays might not, but the list might also require that all of<br />
its members be dynamic objects. In this case, the added functionality of the list might be unavailable to a simple<br />
array of numbers. For a more concrete example, in Java, a LinkedList can change its size, but an array must have a<br />
fixed size. One might desire to have a LinkedList of ints, but the LinkedList class only lists references to dynamic<br />
objects — it cannot list primitive types, which are value types.<br />
To get around this, ints can be boxed into Integers, which are dynamic objects, and then added to a LinkedList of<br />
Integers. (Using generic parameterized types introduced in J2SE 5.0, this type is represented as<br />
LinkedList.) On the other hand, C# has no primitive wrapper classes, but allows boxing of any value type,<br />
returning a generic Object reference.<br />
The boxed object is always a copy of the value object, and is usually immutable. Unboxing the object also returns a<br />
copy of the stored value. Note that repeated boxing and unboxing of objects can have a severe performance impact,<br />
since it dynamically allocates new objects and then makes them eligible for Garbage collection.<br />
Autoboxing<br />
Autoboxing is the term for treating a value type as a reference type without any extra source code. The compiler<br />
automatically supplies the extra code needed to perform the type conversion.<br />
For example, J2SE 5.0 allows the programmer to create a LinkedList of ints. This does not contradict what was said<br />
above: the LinkedList still only lists references to dynamic objects, and it cannot list primitive types. But now, when<br />
Java expects a reference but receives a primitive type, it immediately converts that primitive type to a dynamic<br />
object. Note that the declaration List is illegal in Java, but List is not, and autoboxing will allow<br />
adding of primitive ints to the collection.<br />
For example, in versions of Java prior to J2SE 5.0, the following code did not compile:
Object type (object-oriented programming) 238<br />
Integer i = new Integer(9);<br />
Integer j = new Integer(13);<br />
int k = 9 + 13; // always OK<br />
Integer l = i + j; // error in versions prior to 5.0!<br />
Compilers prior to 5.0 would not accept the last line. Integers are reference objects, on the surface no different from<br />
List, Object, and so forth; mathematical operators such as + were not meaningfully defined for references. As of<br />
J2SE 5.0, the Integers i and j are unboxed into ints, the two are added, and then the sum is autoboxed into a new<br />
Integer. [1]<br />
Unboxing<br />
Unboxing refers to a boxed value type which has been broken down and the value type retrieved for a process of<br />
some kind such as a mathematical operation.<br />
For example, in versions of Java prior to J2SE 5.0, the following code did not compile:<br />
int i = 4;<br />
int j = 5;<br />
Integer k = new Integer(i + j); // always OK<br />
Integer l = i + j; // would have been an error, but okay now -<br />
equivalent to previous line<br />
C# does not support automatic unboxing. A boxed object must be explicitly unboxed with a typecasting operator:<br />
int i = 42;<br />
object o = i; //box<br />
int j = (int)o; //unbox<br />
Console.Writeline(j); //outputs "42"<br />
References<br />
[1] java.sun.com Java language guide entry on autoboxing (http:/ / java. sun. com/ j2se/ 1. 5. 0/ docs/ guide/ language/ autoboxing. html)
Omniscient Debugger 239<br />
Omniscient Debugger<br />
The Omniscient Debugger, or ODB for short, is a Java programming language debugger which lets users step<br />
backwards in time. It allows this by keeping track of all changes to objects and variables made as a program runs. [1]<br />
It is free open source software, released under the GPL license.<br />
[1] Lewis, Bil (2003), "Debugging Backwards in Time" (http:/ / www. citebase. org/ abstract?id=oai:arXiv. org:cs/ 0310016), in Ronsse, M.; De<br />
Bosschere, K., Proceedings of the Fifth International Workshop on Automated Debugging (AADEBUG 2003) (http:/ / arxiv. org/ abs/ cs. SE/<br />
0309027), Ghent, September 2003,<br />
External links<br />
• ODB home page (http:/ / www. lambdacs. com/ debugger/ )<br />
• Debugging Backwards in Time (http:/ / video. google. com/ videoplay?docid=3897010229726822034) video,<br />
hosted by Google Video<br />
• Dr. Dobb's Journal article about ODB (http:/ / www. ddj. com/ article/ printableArticle.<br />
jhtml?articleID=184406101& dept_url=/ dept/ debug/ )<br />
OpenJDK<br />
Developer(s) Sun Microsystems<br />
Initial release<br />
Stable release<br />
Written in C++ and Java<br />
Operating<br />
system<br />
Type Library<br />
openJDK6 Build b05 February 12, 2008 [1]<br />
OpenJDK6 Build b20 [2] / June 21, 2010<br />
Cross-platform<br />
License GPL+linking exception<br />
Website [3]<br />
Developer(s) Sun Microsystems<br />
Preview release<br />
Written in C++ and Java<br />
Operating<br />
system<br />
Type Library<br />
OpenJDK7 Build b105 [4] / August 13,<br />
2010<br />
Cross-platform<br />
License GPL+linking exception<br />
Website [5]<br />
OpenJDK (aka Open Java Development Kit) is a Free and open source implementation of the Java programming<br />
language. It is the result of an effort Sun Microsystems began in 2006. The implementation is licensed under the<br />
GNU General Public License (GPL) with a linking exception, which exempts components of the Java class library<br />
from the GPL licensing terms.
OpenJDK 240<br />
History<br />
Sun's promise and initial release<br />
Sun announced in JavaOne 2006 that Java would become open source software, [6] [7] and on October 25, 2006, at<br />
the Oracle OpenWorld conference, Jonathan Schwartz said that the company was set to announce the open-sourcing<br />
of the core Java Platform within 30 to 60 days.<br />
Sun released the Java HotSpot virtual machine and compiler as free software under the GNU General Public License<br />
on 13 November 2006, with a promise that the rest of the JDK (which includes the Java Runtime Environment)<br />
would be placed under the GPL by March 2007, "except for a few components that Sun does not have the right to<br />
publish in source form under the GPL". [8] According to computer scientist and Free software advocate Richard<br />
Stallman, this would end the "Java trap", the Vendor lock-in that he argues applies to Java and programs written in<br />
Java. [9] Software entrepreneur Mark Shuttleworth called the initial press announcement "A real milestone for the free<br />
software community". [10]<br />
Release of the class library<br />
Following their promise to release a Java Development Kit (JDK) based almost completely on Free and open source<br />
code in the first half of 2007 [11], Sun released the complete source code of the Java Class Library under the GPL on<br />
May 8, 2007, except for some limited parts that some third parties licensed to Sun that rejected the terms of the<br />
GPL. [12] Included in the list of encumbered parts were several major components of the Java Graphical User<br />
Interface (GUI). Sun stated that it planned to replace the remaining proprietary and closed source components with<br />
alternative implementations and to make the class library completely Free. [13]<br />
Community improvements<br />
On 2007-11-05, Red Hat announced an agreement with Sun, signing Sun's broad contributor agreement (which<br />
covers participation in all Sun-led free and open source software projects by all Red Hat engineers) and Sun's<br />
OpenJDK Community TCK License Agreement (which gives the company access to the test suite that determines<br />
whether a project based on openJDK complies with the Java SE 6 specification). [14]<br />
Also on November 2007, the porters group was created on OpenJDK [15] to aid in efforts to port OpenJDK to<br />
different processor architectures and operating systems. The BSD porting projects [16], led by Kurt Miller and Greg<br />
Lewis and the Mac OS X porting project (based on the BSD one) SoyLatte [17] led by Landon Fuller [18] have<br />
expressed interest in joining OpenJDK via the porters group and as of January 2008 are part of the mailing list<br />
discussions. Another project pending formalization on the porters group is the Haiku Java Team, led by Bryan<br />
Varner. [19]<br />
On December 2007, Sun moved the revision control of OpenJDK from TeamWare to Mercurial, as part of the<br />
[20] [21]<br />
process of releasing it to open source communities.<br />
OpenJDK has comparatively strict procedures of accepting code contributions: every proposed contribution must be<br />
reviewed by two of Sun's engineers and have the automatic test demonstrating that feature has been fixed. [22]<br />
However, although initially the fixes proposed by the community were committed by Sun in the codebase,<br />
September 2008 saw the first (significant) patches directly committed by a non-Sun or ex-Sun employee. [23]
OpenJDK 241<br />
Inclusion in software distributions<br />
As of May 2008, the Fedora 9 [24] [25] and Ubuntu 8.04 [26] distributions were released with OpenJDK, based<br />
completely on free and open source code. [27]<br />
In June 2008, it was announced that IcedTea 6 (as the packaged version of OpenJDK on Fedora 9) has passed the<br />
Technology Compatibility Kit tests and can claim to be a fully compatible Java 6 implementation. [28]<br />
On July 12, 2008, Debian accepted OpenJDK-6 in unstable [29] [30] , and it is now in stable [31] . OpenJDK is also<br />
available on openSUSE [32] , and also Red Hat Enterprise Linux and its derivatives such as CentOS [33] .<br />
Since August 2008, OpenJDK 7 is runnable on Mac OS X and other BSD distributions. [34]<br />
In July 2009, OpenJDK binary build for Ubuntu 9.04 passed all of the compatibility tests in the Java SE 6 JCK. [35]<br />
Status<br />
Supported JDK versions<br />
OpenJDK was initially based only on the JDK 7.0 version of the Java platform. [36]<br />
Since February 15, 2008, there are two separate OpenJDK projects:<br />
• The main OpenJDK [9] project, which is based on the JDK 7.0 version of the Java platform,<br />
• The JDK 6 [3] project, which provides an Open-source version of Java 6.0. [37]<br />
Compiler and Virtual Machine<br />
Sun's Java compiler, javac, and HotSpot (the virtual machine), are now under a GPL license.<br />
Class library<br />
As of May 2008, the only part of the Class library that remains proprietary and closed-source (4% as of May 2007<br />
for OpenJDK 7 [38] , and less than 1% as of May 2008 and OpenJDK 6 [24] ) is [39] [40] the SNMP implementation [40] .<br />
Since the first May 2007 release, Sun Microsystems, with the help of the community, has released as free and<br />
open-source software or replaced with free and open-source alternatives almost all the encumbered code:<br />
• All the audio engine code, including the software synthesizer, has been released as Open-source. [40] [41] The<br />
closed-source software synthesizer has been replaced by a new synthesizer developed specifically for OpenJDK<br />
called Gervill [42] ,<br />
• All cryptography classes used in the Class library have been released as Open-source [43] ,<br />
[44] [45] [46]<br />
• The code that scales and rasterizes fonts has been replaced by FreeType<br />
• The native color management system has been replaced by LittleCMS. [45] There is a pluggable layer in the JDK,<br />
so that the commercial version can use the old color management system and OpenJDK can use LittleCMS.<br />
• The anti-aliasing graphics rasterizer code has been replaced by the Open-sourced Pisces renderer used in the<br />
phoneME project. [45] [47] [48] This code is fully functional, but still needs some performance enhancements [49] ,<br />
• The JavaScript plugin has been open-sourced (the Rhino JavaScript engine itself was open-sourced from the<br />
beginning). [50]
OpenJDK 242<br />
IcedTea<br />
Because of the encumbered components in the Class library, it was not possible to build OpenJDK only with free<br />
software components. In order to be able to do this before the whole class library is made free, and to be able to<br />
bundle OpenJDK in Fedora and other free Linux distributions, a project called IcedTea has been started by Red Hat.<br />
It is basically an OpenJDK/GNU Classpath hybrid that can be used to bootstrap OpenJDK using only free<br />
[51] [52]<br />
software.<br />
IcedTea is a software development and integration project launched by Red Hat in June 2007. [53] The goal is to make<br />
the OpenJDK software which Sun Microsystems released as free software in 2007 usable without requiring any other<br />
software that is not free software. For Red Hat, this would make it possible to add OpenJDK to the Fedora Linux<br />
distribution, as well as other distributions.<br />
On November 5, 2007, Red Hat has signed both the Sun Contributor Agreement and the OpenJDK Community TCK<br />
License. [54] One of the first benefits of this agreement is tighter alignment with the IcedTea project, which brings<br />
together Fedora, the Linux distribution, and JBoss, the application server, technologies in a Linux environment.<br />
IcedTea is providing free software alternatives for the few remaining proprietary sections in the OpenJDK project.<br />
Fedora 9 was the first version to ship with IcedTea6, based on the OpenJDK6 sources from Sun rather than<br />
OpenJDK7. It was also the first to use OpenJDK for the package name (via the OpenJDK trademark agreement [55] )<br />
instead of IcedTea. [24]<br />
Ubuntu also first packaged IcedTea7 [56] before later moving to IcedTea6. Packages for IcedTea6 were also created<br />
for Debian and included in lenny.<br />
See also<br />
• javac, Sun's java compiler, now under a GPL license<br />
• HotSpot, Sun's Virtual Machine, now under a GPL license<br />
• Java Class Library<br />
• Free Java implementations<br />
• Java Platform, Standard Edition<br />
• Apache Harmony<br />
External links<br />
• Main site [9]<br />
• OpenJDK FAQ [57]<br />
• OpenJDK - The First Year [58] by Mark Reinhold<br />
References<br />
[1] http:/ / download. java. net/ openjdk/ jdk6/ promoted/ b05/<br />
[2] http:/ / download. java. net/ openjdk/ jdk6/<br />
[3] http:/ / openjdk. java. net/ projects/ jdk6/<br />
[4] http:/ / download. java. net/ openjdk/ jdk7/<br />
[5] http:/ / openjdk. java. net/ projects/ jdk7/<br />
[6] Schwartz, Jonathan (23 May 2006). "Busy Week..." (http:/ / blogs. sun. com/ roller/ page/ jonathan/ 200605#busy_week1). Sun<br />
Microsystems. . Retrieved 2007-05-09.<br />
[7] "Sun Opens Java" (http:/ / mediacast. sun. com/ share/ tmarble/ Sun_Opens_Java. ogg) (OGG Theora). Sun Microsystems. .<br />
[8] "Sun Opens Java" (http:/ / www. sun. com/ 2006-1113/ feature/ index. jsp). Sun Microsystems. 13 November 2006. . Retrieved 2007-05-09.<br />
[9] Stallman, Richard. "Free But Shackled—The Java Trap" (http:/ / www. gnu. org/ philosophy/ java-trap. html). . Retrieved 2007-12-04.<br />
[10] "Sun 'releases' Java to the world" (http:/ / news. bbc. co. uk/ 1/ hi/ technology/ 6144748. stm). BBC News. 13 November 2006. . Retrieved<br />
2007-05-09.<br />
[11] http:/ / www. sun. com/ software/ opensource/ java/ faq. jsp#b4
OpenJDK 243<br />
[12] "Open JDK is here!" (http:/ / mail. openjdk. java. net/ pipermail/ announce/ 2007-May. txt). Sun Microsystems. 8 May 2007. . Retrieved<br />
2007-05-09.<br />
[13] Some encumbered code remains in the JDK; Sun stated that it will continue to use such code in commercial releases until fully functional<br />
free and open source alternatives replace it.<br />
[14] Broad contributor agreement and TCK License pave way for a fully compatible, free and open source Java Development Kit for Red Hat<br />
Enterprise Linux (http:/ / www. businesswire. com/ portal/ site/ google/ index. jsp?ndm<strong>View</strong>Id=news_view& newsId=20071105005882&<br />
newsLang=en)<br />
[15] Porters Group (http:/ / openjdk. java. net/ groups/ porters/ )<br />
[16] http:/ / www. eyesbeyond. com/ freebsddom/ java/ jdk16. html<br />
[17] http:/ / landonf. bikemonkey. org/ static/ soylatte<br />
[18] http:/ / landonf. bikemonkey. org/ code/ macosx/<br />
[19] New java for haiku team formed (http:/ / haiku-os. org/ news/ 2008-01-03/ new_java_for_haiku_team_formed)<br />
[20] James Gosling. Interview with Robert Eckstein. James Gosling on Open Sourcing Sun's Java Platform Implementations, Part 1 (http:/ / java.<br />
sun. com/ developer/ technicalArticles/ Interviews/ gosling_os1_qa. html). October 2006.<br />
[21] O'Hair, Kelly (2007-12-12). "Mercurial OpenJDK Questions" (http:/ / blogs. sun. com/ kto/ entry/ mercurial_openjdk_questions). .<br />
[22] Tripp, Andy (2007-07-16). "Classpath hackers frustrated with slow OpenJDK process" (http:/ / www. javalobby. org/ java/ forums/ t98834.<br />
html). . Retrieved 2008-04-20.<br />
[23] Kennke, Roman (2008-09-29). "A small step for me" (http:/ / kennke. org/ blog/ 2008/ 09/ 29/ a-small-step-for-me/ ). . Retrieved<br />
2008-10-19.<br />
[24] Wade, Karsten (2008-03-13). "OpenJDK in Fedora 9!" (http:/ / developer. redhatmagazine. com/ 2008/ 03/ 12/<br />
openjdk-to-replace-icedtea-in-fedora-9/ ). redhatmagazine.com. . Retrieved 2008-04-05. "Thomas Fitzsimmons updated the Fedora 9 release<br />
notes source pages to reflect that Fedora 9 would ship with OpenJDK 6 instead of the IcedTea implementation of OpenJDK 7. Fedora 9<br />
(Sulphur) is due to release in May 2008."<br />
[25] "Open Source Java Technology Debuts In GNU/Linux Distributions" (http:/ / www. sun. com/ aboutsun/ pr/ 2008-04/ sunflash. 20080430.<br />
1. xml). Sun Microsystems. . Retrieved 2008-05-02.<br />
[26] "openjdk-6 in Ubuntu" (https:/ / launchpad. net/ ubuntu/ + source/ openjdk-6). . Retrieved 2008-04-19.<br />
[27] Reinhold, Mark (2008-04-24). "There’s not a moment to lose!" (http:/ / blogs. sun. com/ mr/ entry/ in_hardy_heron). . Retrieved 2008-04-19.<br />
[28] Sharples, Rich (2008-06-19). "Java is finally Free and Open" (http:/ / blog. softwhere. org/ archives/ 196). .<br />
[29] Topic, Dalibor (2008-07-14). "QotD: Debian Overview of openjdk-6 source package" (http:/ / robilad. livejournal. com/ 33750. html). .<br />
Retrieved 2008-07-15.<br />
[30] "Overview of openjdk-6 source package" (http:/ / packages. qa. debian. org/ o/ openjdk-6. html). debian.org. . Retrieved 2008-07-15.<br />
[31] "Package: openjdk-6-jdk" (http:/ / packages. debian. org/ stable/ openjdk-6-jdk). debian.org. 2009-02-14. . Retrieved 2009-02-16.<br />
[32] "Package: OpenJDK" (http:/ / en. opensuse. org/ OpenJDK). opensuse.org. . Retrieved 2009-06-01.<br />
[33] "How to download and install prebuilt OpenJDK packages" (http:/ / openjdk. java. net/ install/ #epel). . Retrieved 2010-03-03.<br />
[34] Fuller, Landon (2008-08-19). "SoyLatte, Meet OpenJDK: OpenJDK 7 for Mac OS X" (http:/ / landonf. bikemonkey. org/ code/ java/<br />
SoyLatte_Meets_OpenJDK. 20080819. html). . Retrieved 2008-08-22.<br />
[35] Announcing OpenJDK 6 Certification for Ubuntu 9.04 (jaunty) (https:/ / lists. ubuntu. com/ archives/ ubuntu-devel-announce/ 2009-July/<br />
000587. html)<br />
[36] "Didn't you promise to open source both JDK 6 and JDK 7 last November? What happened to JDK 6?" (http:/ / www. sun. com/ software/<br />
opensource/ java/ faq. jsp#b10). Sun Microsystems. . Retrieved 2007-10-14. "Sun did make that promise, and we plan to keep it. But in the six<br />
months since the November 2006 announcement, it has become clear that doing this is far more complex than just changing the license and<br />
publishing the source code."<br />
[37] Darcy, Joe (2008-02-11). "The code is coming! The code is coming!" (http:/ / mail. openjdk. java. net/ pipermail/ jdk6-dev/ 2008-February/<br />
000001. html). . Retrieved 2008-02-16. "At Sun we're making final preparations for the first source release for the OpenJDK 6 project. We<br />
plan to release a tarball of the source, along with matching binary plugs, by February 15, 2008."<br />
[38] Fitzsimmons, Thomas (2007-05-18). "Plans for OpenJDK" (http:/ / fitzsim. org/ blog/ ?p=17). . Retrieved 2007-05-22.<br />
[39] Herron, David (2007-10-04). "Plans for OpenJDK" (http:/ / weblogs. java. net/ blog/ robogeek/ archive/ 2007/ 10/ openjdk_encumbr. html). .<br />
Retrieved 2007-10-09.<br />
[40] "OpenJDK 6 b10 source posted" (http:/ / mail. openjdk. java. net/ pipermail/ jdk6-dev/ 2008-May/ 000058. html). 2008-05-30. . Retrieved<br />
2008-06-01.<br />
[41] audio-engine project page (http:/ / openjdk. java. net/ projects/ audio-engine/ )<br />
[42] "Gervill - Software Synthesizer" (https:/ / gervill. dev. java. net/ ). . Retrieved 2008-06-01.<br />
[43] "Crypto has been added to OpenJDK" (http:/ / mail. openjdk. java. net/ pipermail/ security-dev/ 2007-September/ 000015. html).<br />
2007-09-27. . Retrieved 2007-10-07.<br />
[44] font-scaler projectpage (http:/ / openjdk. java. net/ projects/ font-scaler/ )<br />
[45] Java2D project page (http:/ / openjdk. java. net/ groups/ 2d/ )<br />
[46] "Freetype font rasteriser" (http:/ / mail. openjdk. java. net/ pipermail/ font-scaler-dev/ 2007-August/ 000011. html). 2007-08-07. . Retrieved<br />
2007-11-24.<br />
[47] phoneme.dev.java.net/ (https:/ / phoneme. dev. java. net/ )
OpenJDK 244<br />
[48] graphics-rasterizer project page (http:/ / openjdk. java. net/ projects/ graphics-rasterizer/ )<br />
[49] Graham, Jim (2007-10-03). "Open Source rasterizer" (http:/ / mail. openjdk. java. net/ pipermail/ 2d-dev/ 2007-October/ 000078. html). Sun<br />
Microsystems. . Retrieved 2007-05-09.<br />
[50] "Javascript is encumbered and there is no javascript plugin support." (http:/ / icedtea. classpath. org/ bugzilla/ show_bug. cgi?id=85).<br />
IcedTea. 2008-03-11. . Retrieved 2008-06-01. "Changing Summary. JavaScript is no longer encumbered, but we still need liveconnect<br />
support."<br />
[51] Andrew, Haley (2007-06-07). "Experimental Build Repository at icedtea.classpath.org" (http:/ / article. gmane. org/ gmane. comp. java.<br />
openjdk. distro-packaging. devel/ 5). . Retrieved 2007-06-09.<br />
[52] Mark, Wielaard (2007-06-07). "Experimental Build Repository at icedtea.classpath.org" (http:/ / developer. classpath. org/ pipermail/<br />
classpath/ 2007-June/ 002109. html). . Retrieved 2007-06-09.<br />
[53] Fitzsimmons, Thomas (2007-06-08). "Credits" (http:/ / mail. openjdk. java. net/ pipermail/ distro-pkg-dev/ 2007-June/ 000032. html). .<br />
Retrieved 2007-06-08.<br />
[54] "Red Hat and Sun Collaborate to Advance Open Source Java Technology" (http:/ / home. businesswire. com/ portal/ site/ google/ index.<br />
jsp?ndm<strong>View</strong>Id=news_view& newsId=20071105005882& newsLang=en). Red Hat. 2007-11-05. . Retrieved 2007-11-06.<br />
[55] http:/ / openjdk. java. net/ legal/ openjdk-trademark-notice. html<br />
[56] "icedtea-java7 in Ubuntu" (https:/ / launchpad. net/ ubuntu/ + source/ icedtea-java7). . Retrieved 2008-04-19.<br />
[57] http:/ / www. sun. com/ software/ opensource/ java/ faq. jsp<br />
[58] http:/ / parleys. com/ display/ PARLEYS/ OpenJDK+ -+ The+ First+ Year?showComments=true<br />
PHP/Java Bridge<br />
There are three well known implementations of the PHP scripting language:<br />
• The original implementation of PHP and the de facto standard is the open source PHP distribution.<br />
• Project Zero has a PHP runtime written in Java. It also distributes extensions from the open source<br />
implementation of PHP.<br />
• Quercus is an open-source pure Java implementation of the PHP scripting language.<br />
To bridge between PHP scripts and Java libraries all three implementations provide a PHP/Java bridge.<br />
The de facto implementation of PHP has a PHP/Java Bridge separately available from SourceForge. This uses a dual<br />
process model where the Java libraries are run in a separate process from the PHP runtime. Interactions with Java<br />
objects are marshalled across to the Java process using an XML [1] protocol.<br />
Quercus and Project Zero implement PHP on top of the Java Virtual Machine and so can run the Java libraries in the<br />
same process as the PHP runtime. This reduces the overhead of interacting with Java libraries when compared with<br />
the dual process model.<br />
See also<br />
• Quercus (software)<br />
External links<br />
• Open source PHP homepage [2]<br />
• SourceForge PHP/Java Bridge homepage [3]<br />
• Project Zero homepage [4]<br />
• Quercus homepage [5]
PHP/Java Bridge 245<br />
References<br />
[1] http:/ / php-java-bridge. sourceforge. net/ pjb/ PROTOCOL. TXT<br />
[2] http:/ / www. php. net/<br />
[3] http:/ / php-java-bridge. sourceforge. net/<br />
[4] http:/ / www. projectzero. org/ documentation/<br />
[5] http:/ / quercus. caucho. com/<br />
Java package<br />
A Java package is a mechanism for organizing Java classes into namespaces similar to the modules of Modula. Java<br />
packages can be stored in compressed files called JAR files, allowing classes to download faster as a group rather<br />
than one at a time. Programmers also typically use packages to organize classes belonging to the same category or<br />
providing similar functionality.<br />
• A package provides a unique namespace for the types it contains.<br />
• Classes in the same package can access each other's package-access members.<br />
Overview<br />
In general, a package can contain the following kinds of types.<br />
• Classes<br />
• Interfaces<br />
• Enumerated types<br />
• Annotations<br />
Using packages<br />
In a Java source file, the package that this file's class or classes belong to is specified with the package keyword. This<br />
keyword is usually the first keyword in source file. [1]<br />
package java.awt.event;<br />
To use a package's classes inside a Java source file, it is convenient to import the classes from the package with an<br />
import declaration. The following declaration<br />
import java.awt.event.*;<br />
imports all classes from the java.awt.event package, while the next declaration<br />
import java.awt.event.ActionEvent;<br />
imports only the ActionEvent class from the package. After either of these import declarations, the ActionEvent<br />
class can be referenced using its simple class name:<br />
ActionEvent myEvent = new ActionEvent();<br />
Classes can also be used directly without an import declaration by using the fully-qualified name of the class. For<br />
example,<br />
java.awt.event.ActionEvent myEvent = new java.awt.event.ActionEvent();<br />
does not require a preceding import declaration.<br />
[2] [3]<br />
Note that if you do not use a package declaration, your class ends up in an unnamed package.
Java package 246<br />
Package access protection<br />
Classes within a package can access classes and members declared with default access and class members declared<br />
with the protected access modifier. Default access is enforced when neither the public, protected nor private access<br />
modifier is specified in the declaration. By contrast, classes in other packages cannot access classes and members<br />
declared with default access. Class members declared as protected can be accessed from the classes in the same<br />
package as well as classes in other packages that are subclasses of the declaring class.<br />
Creation of JAR files<br />
JAR Files are created with the jar command-line utility. The command<br />
jar cf myPackage.jar *.class<br />
compresses all .class files into the JAR file myPackage.jar. The ' c ' option on the command line tells the jar<br />
command to "create new archive." The ' f ' option tells it to create a file. The file's name comes next before the<br />
contents of the JAR file.<br />
Package naming conventions<br />
Packages are usually defined using a hierarchical naming pattern, with levels in the hierarchy separated by periods (.)<br />
(pronounced "dot"). Although packages lower in the naming hierarchy are often referred to as "subpackages" of the<br />
corresponding packages higher in the hierarchy, there is no semantic relationship between packages. The Java<br />
Language Specification establishes package naming conventions to avoid the possibility of two published packages<br />
having the same name. The naming conventions describe how to create unique package names, so that packages that<br />
are widely distributed will have unique namespaces. This allows packages to be separately, easily and automatically<br />
installed and catalogued.<br />
In general, a package name begins with the top level domain name of the organization and then the organization's<br />
domain and then any subdomains listed in reverse order. The organization can then choose a specific name for their<br />
package. Package names should be all lowercase characters whenever possible.<br />
For example, if an organization in Canada called MySoft creates a package to deal with fractions, naming the<br />
package ca.mysoft.fractions distinguishes the fractions package from another similar package created by<br />
another company. If a US company named MySoft also creates a fractions package, but names it<br />
us.mysoft.fractions, then the classes in these two packages are defined in a unique and separate namespace.<br />
Complete conventions for disambiguating package names and rules for naming packages when the Internet domain<br />
name cannot be directly used as a package name are described in section 7.7 of the Java Language Specification.<br />
Core packages in Java SE 6
Java package 247<br />
External links<br />
java.lang — basic language functionality and fundamental types<br />
java.util — collection data structure classes<br />
java.io — file operations<br />
java.math — multiprecision arithmetics<br />
java.nio — the New I/O framework for Java<br />
java.net — networking operations, sockets, DNS lookups, ...<br />
java.security — key generation, encryption and decryption<br />
java.sql — Java Database Connectivity (JDBC) to access databases<br />
java.awt — basic hierarchy of packages for native GUI components<br />
javax.swing — hierarchy of packages for platform-independent rich GUI components<br />
java.applet — classes for creating and implementing applets<br />
• Java SE 6 API Javadocs<br />
• Java Language Specification, 3rd Edition, Chapter 7: Packages [4]<br />
• Code Conventions for the Java Programming Language, Chapter 9: Naming conventions [5] (mentions packages)<br />
• Sun's "Java Tutorials" Lesson: Packages [6]<br />
References<br />
[1] http:/ / java. sun. com/ docs/ books/ tutorial/ java/ package/ managingfiles. html<br />
[2] http:/ / java. sun. com/ docs/ books/ tutorial/ java/ package/ createpkgs. html<br />
[3] http:/ / java. sun. com/ docs/ books/ jls/ second_edition/ html/ packages. doc. html#26639<br />
[4] http:/ / java. sun. com/ docs/ books/ jls/ third_edition/ html/ packages. html<br />
[5] http:/ / java. sun. com/ docs/ codeconv/ html/ CodeConventions. doc8. html<br />
[6] http:/ / java. sun. com/ docs/ books/ tutorial/ java/ package/ index. html
Parboiled (Java) 248<br />
Parboiled (Java)<br />
Developer(s) Mathias Doenitz<br />
Initial release November 12, 2009<br />
Development status Active<br />
Written in Java<br />
Operating system Cross-platform<br />
License Apache License 2.0<br />
Website http:/ / www. parboiled. org/<br />
parboiled is an open-source Java library released under an Apache License. It provides support for defining PEG<br />
parsers directly in Java source code.<br />
parboiled is commonly used as an alternative for regular expressions or parser generators (like ANTLR or JavaCC),<br />
especially for smaller and medium-size applications.<br />
Apart from providing the constructs for grammar definition parboiled implements a complete recursive descent<br />
parser with support for abstract syntax tree construction, parse error reporting and parse error recovery.<br />
Example<br />
Since parsing with parboiled does not require a separate lexing phase and there is no special syntax to learn for<br />
grammar definition parboiled makes it comparatively easy to build custom parsers quickly.<br />
Consider this the following classic “calculator” example, with these rules in a simple pseudo notation<br />
Expression ← Term ((‘+’ / ‘-’) Term)*<br />
Term ← Factor (('*' / '/') Factor)*<br />
Factor ← Number / '(' Expression ')'<br />
Number ← [0-9]+<br />
With parboiled this rule description can be translated directly into the following Java code:<br />
import org.parboiled.BaseParser;<br />
public class CalculatorParser extends BaseParser {<br />
public Rule expression() {<br />
}<br />
return sequence(<br />
);<br />
term(),<br />
zeroOrMore(<br />
public Rule term() {<br />
)<br />
sequence(<br />
)<br />
firstOf('+', '-'),<br />
term()
Parboiled (Java) 249<br />
}<br />
}<br />
return sequence(<br />
);<br />
factor(),<br />
zeroOrMore(<br />
public Rule factor() {<br />
}<br />
)<br />
return firstOf(<br />
);<br />
sequence(<br />
)<br />
number(),<br />
public Rule number() {<br />
}<br />
firstOf('*', '/'),<br />
factor()<br />
sequence('(', expression(), ')')<br />
return oneOrMore(charRange('0', '9'));<br />
The class defines the parser rules for the language (yet without any actions), which could be used to parse actual<br />
input with code such as this:<br />
String input = "1+2";<br />
CalculatorParser parser =<br />
Parboiled.createParser(CalculatorParser.class);<br />
ParsingResult result = ReportingParseRunner.run(parser.expression(),<br />
input);<br />
String parseTreePrintOut = ParseTreeUtils.printNodeTree(result);<br />
System.out.println(parseTreePrintOut);<br />
See also<br />
• Parsing expression grammars<br />
• Regular expressions<br />
• ANTLR<br />
• JavaCC<br />
External links<br />
• Official parboiled web site [1]<br />
• Example of a complete Java 5 parser written with parboiled [2]
Parboiled (Java) 250<br />
References<br />
[1] http:/ / www. parboiled. org/<br />
[2] http:/ / github. com/ sirthias/ parboiled/ blob/ master/ examples/ org/ parboiled/ examples/ java/ JavaParser. java<br />
Plain Old Java Object<br />
In computing software, POJO is an acronym for Plain Old Java Object. The name is used to emphasize that a<br />
given object is an ordinary Java Object, not a special object, and in particular not an Enterprise JavaBean. The term<br />
was coined by Martin Fowler, Rebecca Parsons and Josh MacKenzie in September 2000:<br />
"We wondered why people were so against using regular objects in their systems and concluded that it<br />
was because simple objects lacked a fancy name. So we gave them one, and it's caught on very<br />
nicely." [1]<br />
The term "POJO" is mainly used to denote a Java object which does not follow any of the major Java object models,<br />
conventions, or frameworks such as EJB. The term continues the pattern of older terms for technologies that do not<br />
use fancy new features, such as POTS (Plain Old Telephone Service) in telephony, and PODS (Plain Old Data<br />
Structures) that are defined in C++ but use only C language features, and POD (Plain Old Documentation) in Perl.<br />
The equivalent to POJO on the .NET framework is Plain Old CLR Object.<br />
Contextual variations<br />
The POJO phenomenon has most likely gained widespread acceptance because of the need for a common and easily<br />
understood term that contrasts with complicated object frameworks. A JavaBean is a POJO that is serializable, has a<br />
no-argument constructor, and allows access to properties using getter and setter methods. An Enterprise JavaBean is<br />
not a single class but an entire component model (again, EJB 3 reduces the complexity of Enterprise JavaBeans). As<br />
designs using POJOs have become more commonly-used, systems have arisen that give POJOs some of the<br />
functionality used in frameworks and more choice about which areas of functionality are actually needed. Hibernate<br />
and Spring are examples.<br />
Ideally speaking, a POJO is a Java object not bound by any restriction other than those forced by the Java Language<br />
Specification. I.e., a POJO should not have to<br />
1. Extend prespecified classes, as in<br />
public class Foo extends javax.servlet.http.HttpServlet { ...<br />
2. Implement prespecified interfaces, as in<br />
public class Bar implements javax.ejb.EntityBean { ...<br />
3. Contain prespecified annotations, as in<br />
@javax.ejb.Entity public class Baz{ ...<br />
However, due to technical difficulties and other reasons, many software products or frameworks described as<br />
POJO-compliant actually still require the use of prespecified annotations for features such as persistence to work<br />
properly.
Plain Old Java Object 251<br />
POJO generation projects<br />
Prevayler [2]<br />
an open source system prevalence layer that transparently persists POJOs.<br />
BeanExaminer [3]<br />
framework to present any java objects in an interactive surface to browse and edit them. A generator is<br />
included to create the desired pojo's through a given db connection.<br />
Roma Meta Framework [4]<br />
DDD centric framework. The innovative holistic approach lets the designer/developer to view anything as a<br />
POJO: GUI, I18N, Persistence, etc.<br />
OpenXava [5]<br />
Framework to develop J2EE business applications rapidly and easily. It's based in business components<br />
defined with XML. Feature rich and flexible since it's used for years to create business applications. Generates<br />
POJO Hibernate EJB2 and EJB3 JPA ...<br />
PlainXML [6]<br />
PAT [7]<br />
Generating POJO by DTD; XML-POJO mapping via Java5 annotations or DTD; XML manipulations using<br />
POJO without SAX/DOM; Preprocessing of XML documents using expression language; Binary XML; RMI<br />
friendly XML; Exporting to JSON; XML marshall/unmarshall ...<br />
AOP (JBossAOP) persistence library (aspect library). Provides persistence layer with underlying Prevayler<br />
(1.02). Allows users to write their code without worrying about persistence code (POJO). Uses annotations.<br />
Java O/RM [8]<br />
This is a Java Object Relational mapping tool that is very simple to use. It works with all major databases and<br />
requires only minimal coding effort. JOR strictly follows the POJO / POJI (Plain Old Java Objects / Plain Old<br />
Java Interfaces) model.<br />
AutoPersistJ [9]<br />
This project aims to assist developers in developing java EE persistence layer for existing database tables. It<br />
gets metadata of selected database tables and generates classes for them. it uses and extends the ideas of<br />
DbGen project to EJB 3.0 POJO.<br />
PojoGen [10]<br />
Pojodbc [11]<br />
It is a small tool to generate Java Code (a POJO) for an APPFUSE-based project from a DDL file, which is<br />
created from an ER diagram by Microsoft VISIO. It makes an APPFUSE-based project more easy to use.<br />
An easy-to-use Java Object Relation mapping library without configurations file or annotations. Built on top<br />
of JDBC, you still use your optimized native SQL and get POJOs.<br />
Apache Felix iPOJO [12]<br />
A new type of dynamic service-oriented component runtime that runs pure POJO applications on the top of<br />
OSGi platforms. Non-functional (extra-functional) services can be added and removed at runtime.<br />
JBoss Microcontainer [13]<br />
The JBoss Microcontainer is a refactoring of JBoss's JMX Microkernel to support direct POJO deployment<br />
and standalone use outside the JBoss application server.<br />
Naked Objects [14]
Plain Old Java Object 252<br />
An open source framework that auto-creates an object-oriented user interface from POJOs using the naked<br />
objects pattern.<br />
Metawidget [15]<br />
A 'smart User Interface widget' that populates itself, at runtime, with UI components to match the properties of<br />
POJOs.<br />
fbDaoGenerator [16]<br />
Fbdaogenerator connects to a Firebird Database, reads the metadata of the Database by querying the<br />
system-tables, and generates POJOs and Data Access Objects.<br />
Pojo Testing Projects<br />
• OpenPojo [17] a pluggable testing framework<br />
See also<br />
• Data Transfer Object<br />
• Anemic Domain Model<br />
References<br />
[1] MF Bliki: POJO (http:/ / www. martinfowler. com/ bliki/ POJO. html) from MartinFowler.com<br />
[2] http:/ / prevayler. org<br />
[3] https:/ / sourceforge. net/ projects/ beanexaminer<br />
[4] http:/ / www. romaframework. org<br />
[5] http:/ / sourceforge. net/ projects/ openxava<br />
[6] http:/ / sourceforge. net/ projects/ plainxml<br />
[7] http:/ / sourceforge. net/ projects/ patsystem<br />
[8] http:/ / sourceforge. net/ projects/ jor<br />
[9] http:/ / sourceforge. net/ projects/ auto-persist-j<br />
[10] http:/ / sourceforge. net/ projects/ pojogen<br />
[11] http:/ / sourceforge. net/ projects/ pojodbc<br />
[12] http:/ / cwiki. apache. org/ FELIX/ ipojo. html<br />
[13] http:/ / labs. jboss. com/ jbossmc/<br />
[14] http:/ / www. nakedobjects. org/ home/ index. shtml<br />
[15] http:/ / www. metawidget. org<br />
[16] http:/ / code. google. com/ p/ fbdaogenerator<br />
[17] http:/ / code. google. com/ p/ openpojo
Pluggable look and feel 253<br />
Pluggable look and feel<br />
Pluggable look and feel is a mechanism used in the Java Swing widget toolkit allowing to change the look and feel<br />
of the graphical user interface at runtime.<br />
Swing allows an application to specialize the look and feel of widgets, by modifying the default (via runtime<br />
parameters), deriving from an existing one, by creating one from scratch, or, beginning with J2SE 5.0, by using the<br />
skinnable synth look and feel, which is configured with an XML property file. The look and feel can be changed at<br />
runtime.<br />
Architecture<br />
The corresponding API includes:<br />
• Hooks in Swing widgets to interact with their look and feel. Each widget defined in Swing can delegate its<br />
"painting" to its associated user interface classes called UI delegates.<br />
• An API to manage existing look and feel definitions. This API allow to set the look and feel or switch from look<br />
and feels at runtime.<br />
• Another API to define a specific look and feel, or derive a look and feel from an existing one.<br />
Examples of look and feels<br />
Platform look and feels<br />
The Java platform comes with several bundled look and feels [1] :<br />
• A default cross-platform look and feel, called Metal (see MetalLookAndFeel). This look and feel comes with<br />
several themes:<br />
• The DefaultMetalTheme, which was historically the first Swing default theme.<br />
• The smoother OceanTheme, which became the default theme for Java 5.0.<br />
• Other cross-platform look and feels:<br />
• A skinnable look and feel called synth (see synth), which is configured with an XML property file.<br />
• The Nimbus look and feel (based on synth), which is added for the Java SE 6 Update 10 [2] [3] .<br />
• Platform dependent look and feels [4] : Look and feels that aim to be the closest as possible to the platform native<br />
GUI. The fidelity to the native look and feel theming has been improved in recent Java versions by leveraging the<br />
[5] [6]<br />
platform native GUI theming library when possible<br />
• A Windows look and feel (this look and feel depends on the version of the Windows Operating System),<br />
• A Motif or GTK+ (for newer distributions) look and feel on Linux or Solaris,<br />
• A specific vendor look and feel for IBM AIX, HP-UX, and Mac OS X.
Pluggable look and feel 254<br />
Third-party look and feels<br />
Numerous other look and feels have been developed by third parties, such as:<br />
• Substance [4] , a skinnable look and feel,<br />
• Napkin [7] , which can be used to make GUI work look provisional,<br />
• Synthetica [8] , which is based on synth,<br />
• Liquid [9] , which aim to look like the Liquid theme for KDE,<br />
• JGoodies [10] Windows and plastic look and feels.<br />
See also<br />
• Look and feel<br />
• Swing<br />
External links<br />
• a list of Java look and feels [11]<br />
• Sun's tutorial overview of the pluggable look and feel mechanism [12]<br />
• Swing pluggable look and feel architecture [13]<br />
• Sun's tutorial on setting the look and feel in Java [14]<br />
References<br />
[1] "Java Tutorials: Available Look and Feels" (http:/ / java. sun. com/ docs/ books/ tutorial/ uiswing/ lookandfeel/ plaf. html#available). Sun<br />
Microsystems. 2008-02-14. . Retrieved 2008-05-25.<br />
[2] Potts, Jasper (2007-12-07). "Nimbus Category" (http:/ / www. jasperpotts. com/ blog/ category/ nimbus/ ). . Retrieved 2008-05-25.<br />
[3] "Nimbus" (http:/ / java. sun. com/ javase/ downloads/ ea/ 6u10/ nimbus. jsp). Sun Microsystems. . Retrieved 2008-05-25.<br />
[4] "Available Look and Feels" (http:/ / java. sun. com/ docs/ books/ tutorial/ uiswing/ lookandfeel/ plaf. html#available). Sun Microsystems. .<br />
Retrieved 2008-05-25.<br />
[5] "GTK Native L&F Fidelity" (http:/ / bugs. sun. com/ bugdatabase/ view_bug. do?bug_id=6185456). Sun Microsystems. . Retrieved<br />
2008-05-25.<br />
[6] "XP L&F does not work on Windows Vista (Longhorn) - needs to use uxtheme api" (http:/ / bugs. sun. com/ bugdatabase/ view_bug.<br />
do?bug_id=5106661). Sun Microsystems. . Retrieved 2008-05-25.<br />
[7] http:/ / napkinlaf. sourceforge. net/<br />
[8] http:/ / www. javasoft. de/ jsf/ public/ products/ synthetica<br />
[9] https:/ / liquidlnf. dev. java. net/<br />
[10] http:/ / www. jgoodies. com/ freeware/ looks/ index. html<br />
[11] http:/ / www. java2s. com/ Product/ Java/ Swing/ Look-And-Feel-LaF. htm<br />
[12] http:/ / java. sun. com/ docs/ books/ tutorial/ ui/ features/ plaf. html<br />
[13] http:/ / java. sun. com/ products/ jfc/ tsc/ articles/ architecture/ index. html#pluggable<br />
[14] http:/ / java. sun. com/ docs/ books/ tutorial/ uiswing/ lookandfeel/ plaf. html
Primitive wrapper class 255<br />
Primitive wrapper class<br />
A primitive wrapper class in the Java programming language is one of eight classes provided in the java.lang<br />
package to provide object methods for the eight primitive types. All of the primitive wrapper classes in Java are<br />
immutable. J2SE 5.0 introduced autoboxing of primitive types into their wrapper object, and automatic unboxing of<br />
the wrapper objects into their primitive value—the implicit conversion between the wrapper objects and primitive<br />
values.<br />
Wrapper classes are used to represent primitive values when an Object is required. The wrapper classes are used<br />
extensively with Collection classes in the java.util package and with the classes in the java.lang.reflect reflection<br />
package.<br />
The primitive wrapper classes and their corresponding primitive types are:<br />
Primitive type Wrapper class Constructor<br />
Arguments<br />
byte Byte byte or String<br />
short Short short or String<br />
int Integer int or String<br />
long Long long or String<br />
float Float float, double or String<br />
double Double double or String<br />
char Character char<br />
boolean Boolean boolean or String<br />
The Byte, Short, Integer, Long, Float, and Double wrapper classes are all subclasses of the Number class.<br />
Void<br />
Although it is not a wrapper class, the Void class is similar in that it provides an object representation of the void<br />
return type. The Void class is an uninstantiable placeholder class used by the java.lang.reflect API to hold a<br />
reference to the Class object representing the Java keyword void..<br />
Atomic wrapper classes<br />
With Java 5.0, additional wrapper classes were introduced in the java.util.concurrent.atomic package. These classes<br />
are mutable and cannot be used as a replacement for the regular wrapper classes. Instead, they provide atomic<br />
operations for addition, increment and assignment.<br />
The atomic wrapper classes and their corresponding types are:
Primitive wrapper class 256<br />
Primitive type Wrapper class<br />
int AtomicInteger<br />
long AtomicLong<br />
boolean AtomicBoolean<br />
V AtomicReference<br />
The AtomicInteger and AtomicLong classes are subclasses of the Number class. The AtomicReference class accepts<br />
the type parameter V that specifies the type of the object reference. (See "Generics in Java" for a description of type<br />
parameters in Java).<br />
See also<br />
• java.lang<br />
• java.lang.reflect<br />
• Java programming language<br />
• Java syntax<br />
Project Semplice<br />
Ģ Project Semplice is a project announced at the 2006 JavaOne conference to develop tools to allow Visual Basic<br />
6.0 source code to be compiled into Java applications.<br />
What the project does is develop a script engine for BASIC, which would then be interpreted by the Java Virtual<br />
Machine.<br />
As to this point, the project is still being developed and that it is not yet available to the public. Although, IDEs like<br />
NetBeans is already available for Java Developers, the capability of Visual Basic's Rapid Application Development<br />
is also to be developed.<br />
The project's main goal is to provide VB6 Developer's a free solution of building Web/Desktop Application which<br />
would be system independent.<br />
UPDATE: This project appears to be dead at the moment. 2 of its 3 main developers have left Sun* [1] . No code has<br />
been publicly released.<br />
External links<br />
• Project Semplice on Herbert Czymontek's blog [2]<br />
• Project Semplice on Tor Norbye's blog [3]<br />
• JavaOne Project Semplice presentation [4]<br />
References<br />
[1] http:/ / blogs. sun. com/ tor/ entry/ semplice_update<br />
[2] http:/ / blogs. sun. com/ herbertc/ entry/ project_semplice_visual_basic_for<br />
[3] http:/ / blogs. sun. com/ tor/ entry/ semplice_keynote_demo<br />
[4] https:/ / www28. cplan. com/ javaone06_cv_124_1/ sessions_catalog. jsp?ilc=124-1& ilg=english& isort=1& is=%3CISEARCH%3E&<br />
ip=yes& itrack=+ & isession_type=+ & isession_id=TS-3576& iabstract=& ispeaker=& ispk_company=
Quark Framework 257<br />
Quark Framework<br />
Paradigm functional, non-strict, modular<br />
Appeared in 2004<br />
Designed by Luke Evans, Bo Ilic (Business<br />
Objects)<br />
Typing discipline static, strong, inferred<br />
Major implementations Open Quark Framework for Java [1]<br />
Dialects --<br />
Influenced by Haskell, Clean, Java<br />
Influenced --<br />
The Quark Framework (Open Quark) consists of a non-strict functional language and runtime for the Java<br />
platform. The framework allows the compilation and evaluation of functional logic on the Java Virtual Machine<br />
(JVM), directly or under the control of a regular Java application. The native language (syntax) for the Quark<br />
Framework is called CAL. A full range of Java APIs provides the means to invoke the CAL compiler, manipulate<br />
workspaces of modules, add metadata and evaluate functional logic. Functional logic is usually dynamically<br />
compiled to Java bytecodes and executed directly on the JVM (with some small kernel logic controlling the normal<br />
evaluation order). However, an interpreter (G-machine) is also available.<br />
Motivation, History and Concept<br />
CAL, and the associated tools and APIs forming the Quark Framework, was conceived in 1998 within Seagate<br />
Software (later Crystal Decisions, now Business Objects) as a way to enable a common framework for sharing<br />
business logic across business intelligence products. A framework was desired that would allow data behaviour to be<br />
captured, at all levels of abstraction, and for these components to be composable into the actual data flows that<br />
individual products required. In general terms, such a system had to provide a way to express data behaviour<br />
declaratively, with universal composition and typing laws. In essence, this places the problem firmly in the domain<br />
of functional languages, and the desire to allow machine compositions of functions without incurring increasing<br />
efficiency penalties strongly suggested a non-strict evaluation semantic.<br />
As well as the operational requirements, it was envisaged that future application logic would likely be written for a<br />
dynamic platform (such as Java or .Net), and therefore it was determined that the Quark Framework should be native<br />
to Java (initially) with considerable emphasis on performance and interoperability with application logic written on<br />
that platform. In 1999, work began in Crystal's Research Group on an implementation of this framework. Many of<br />
the original insights into lazy functional systems were drawn from implementations of Haskell. Early on, Haskell<br />
(HUGS, GHC) was even considered as a starting point for the implementation itself, but a number of requirements<br />
made this impractical, so it was decided to let the project emerge and evolve freely following its own design criteria.<br />
For the first few years of development, the CAL source language itself was not a primary motivator, but the<br />
operational semantics were of primary concern. At this time, CAL was merely a convenient script for expressing<br />
functions rather than composing them programmatically through Java APIs, or using a graphical language native to a<br />
tool called the Gem Cutter, which began to be implemented in mid-2000 as a way to author systems of functions that
Quark Framework 258<br />
could be used in applications. From about 2002 onward, the CAL language became rather more central to the Quark<br />
Framework, especially once programmers began to create usable libraries of functions for real applications. As the<br />
language evolved, so did the demand for tools, and so a range of tools and utilities were created in parallel to<br />
language development to support those doing real work with the platform.<br />
While the Gem Cutter remained the main development environment in the initial years, since late 2005 there has<br />
been an intention to produce Eclipse-based tools, and the emphasis has shifted to activities advancing the state of<br />
Eclipse integration.<br />
The motivations for the Quark Framework appear to be similar to those driving Microsoft's LINQ project, in<br />
particular the desire for a declarative style and some lazy evaluation for certain kinds of logic, hosted within<br />
applications coded in an Object Oriented language. While CAL cannot yet be embedded inline within Java source,<br />
generated functions are fully compiled and the system can efficiently share data between CAL and Java sourced<br />
logic. For instance, CAL lists can be marshalled dynamically to and from Java data structures that implement the<br />
Iterator interface.<br />
In 2007, the Quark Framework is an advanced and well tested framework for integrating non-strict functional logic<br />
into Java programs. It can be used as a standalone functional language too, that happens to compile to Java<br />
bytecodes. The framework was offered as open source under a BSD-style license in January 2007, and continues to<br />
be used and developed within Business Objects.<br />
CAL<br />
CAL is the name of a programming language originally developed by Business Objects and now released as "Open<br />
Quark", with sources, under a BSD-style license. It is a lazy functional programming language similar to the Haskell<br />
programming language. An implementation is available from the Business Objects Labs [2] site. CAL forms part of<br />
the Quark Framework which includes a visual programming tool, Gem Cutter.<br />
One of the main objectives of the Quark Framework is to allow logic expressed in a declarative, lazy functional style<br />
to be easily and efficiently integrated into Java applications. CAL source is typically compiled directly to byte codes<br />
(though an interpreter is also available), and can be called from regular OO code. In turn CAL code can call any Java<br />
code. Evaluation of CAL programs, and exploration of results can be completely controlled by procedural code,<br />
allowing data transformation logic (for which CAL is ideally suited) to be flexibly integrated into Java applications.<br />
A Java program can also easily build new functions on-the-fly, to describe transient data flows, or to create persisted<br />
logic. This form of 'functional metaprogramming' is common in real-world deployments of the Quark Framework.<br />
The CAL language borrows much from Haskell syntax, but also eschews some Haskell features. As such, CAL is a<br />
strongly typed, lazily evaluated functional language, supporting algebraic functions and data types with parametric<br />
polymorphism and type inferencing. CAL has special syntax for strings, tuples, characters, numbers, lists and<br />
records. Single parameter type classes are supported, with superclasses, derived instances, deriving clauses for<br />
common classes, default class methods and higher-kinded type variables. While doubtless a subjective measure,<br />
CAL's developers have tried to keep the language simple. In particular, only the expression style is supported<br />
(Haskell's equation based style with argument pattern matching is not supported), and CAL does not make use of<br />
layout (semicolons are required to terminate definitions). CAL also makes certain syntactic choices to align it more<br />
strongly with Java. For instance, Java's syntax for comments is used, and CAL's inline documentation comments are<br />
close to JavaDoc.<br />
One of the main differences between Haskell and CAL is in the area of interfacing with the 'real world'. Whereas<br />
Haskell goes to great lengths to validate the purity of functions, CAL relies on the programmer to hide 'imported<br />
impurity', exposing pure functions from a module where impure imports are made. CAL has a range of mechanisms<br />
for controlling evaluation order and laziness. These are often essential tools in the creation of effective solutions with<br />
native functions, but are also important in the aforementioned interface with the stateful world. The choice to<br />
de-emphasise formal tracking of purity, in favour of mechanisms to allow the programmer to express the right logic,
Quark Framework 259<br />
has proven to provide a good balance of flexibility and 'directness' when interfacing with external operations.<br />
One of the main design goals for CAL was to make the language as comfortable as possible for mainstream<br />
developers to pick up and use effectively. This is reflected in choices for syntax, but also in conventions and patterns<br />
used within the standard libraries. For example, libraries use longer, descriptive names and are commented to explain<br />
the implementations and best practices for use.<br />
To see some CAL language source code click here [3] . This tutorial CAL module is designed as a top-to-bottom<br />
'feature parade' to showcase basic syntax with examples of some built-in and user defined data structures.<br />
Here are a few examples, derived from the tutorial module linked to in the preceding paragraph:<br />
1. Quicksort<br />
/**<br />
* Here is a simple implementation of the quicksort algorithm for lists in<br />
* CAL.<br />
*<br />
* Note: it is not the most efficient implementation, since it filters the<br />
* list twice to partition.<br />
*<br />
* It is used here as an illustration. The production implementation of<br />
* sorting on lists is<br />
* {@link List.sort@}.<br />
*<br />
* The type of quicksort is constrained by the {@link Ord@} type class. This<br />
* means that quicksort can sort list of any orderable type.<br />
*/<br />
quicksort :: Ord a => [a] -> [a];<br />
quicksort list =<br />
let<br />
in<br />
//partition_min is a local function of 1 argument<br />
partition_min pivot = filter (\x -> x < pivot);<br />
partition_max pivot = filter (\x -> x >= pivot);<br />
case list of<br />
[] -> [];<br />
pivot : tail -><br />
;<br />
quicksort (partition_min pivot tail)<br />
++ (pivot : (quicksort (partition_max pivot tail)));<br />
Note that CAL supports inline documentation comments, with embedded tags. Function type declarations<br />
immediately precede the function definition. CAL supports type classes (e.g. Ord). Two local functions are declared<br />
in the let block. Quicksort has a recursive definition, building up the output list at each level of recursion from the<br />
sorts applied to the list of values either side of the pivot item.
Quark Framework 260<br />
2. Data Declarations<br />
In common with other functional languages, CAL provides a way to declare new types using data declarations. Here<br />
is an example of declaring a new data type for 'Employee':<br />
/**<br />
* The Employee data type is an example of a CAL algebraic data type. It<br />
* has one data constructor, RegularEmployee. The RegularEmployee data<br />
* constructor has 3 fields: name, manager and directReports.<br />
*<br />
* The firstName and lastName fields have type String. The manager field<br />
* has type Maybe Employee. This reflects the fact that an employee may<br />
* have one manager or no managers (in the case fo the CEO), and that<br />
* manager is also an Employee. directReports has type [Employee] i.e. a<br />
* list of 0 or more employees. Note that the manager and directReports<br />
* fields have types that recursively refer to the Employee type. In other<br />
* words, Employee is a recursive algebraic data type.<br />
*/<br />
data Employee =<br />
RegularEmployee<br />
name :: String<br />
//the employeeID field is a potential future addition to the<br />
//Employee data type. Notice below that case expressions using<br />
//field-name based extraction would not need to be updated due<br />
//to this change, but case expressions using positional based<br />
//extraction would need updating.<br />
//employeeID :: Int<br />
manager :: (Maybe Employee)<br />
directReports :: [Employee]<br />
//This deriving clause provides a default instance implementation for<br />
//the Show type class for the Employee type. Essentially what this<br />
//means is that the Debug.show function will work with Employee<br />
//values to display a String representation of the value suitable for<br />
//debugging purposes.<br />
deriving Show;<br />
Note that fields (data constructor arguments) must have names in CAL, as well as their type. The deriving clause<br />
makes the data type work with functions defined in certain type classes. Here we ensure that CAL automatically adds<br />
the requisite logic to make values of Employee be renderable as strings for the purposes of tracing.<br />
Fields can be extracted in a variety of ways:<br />
a) Positionally in a case expression:<br />
/**<br />
* @arg employee<br />
* @return the employee's name<br />
*/<br />
employeeName :: Employee -> String;<br />
employeeName employee =<br />
case employee of
Quark Framework 261<br />
//illustrates positionally based case expression extraction of the<br />
//"name" field of the RegularEmployee data constructor<br />
RegularEmployee empname _ _ -> empname;<br />
;<br />
b) By field name in a case expression:<br />
/**<br />
* @arg employee<br />
* @return the employee's name<br />
*/<br />
employeeName :: Employee -> String;<br />
employeeName employee =<br />
case employee of<br />
//illustrates field-name based case expression extraction of the<br />
//"name" field of the RegularEmployee data constructor<br />
RegularEmployee {name} -> name;<br />
;<br />
This method is obviously more stable with respect to changes in data constructor arguments than the positional<br />
version<br />
c) By a selector expression<br />
/**<br />
* @arg employee<br />
* @return the employee's name<br />
*/<br />
employeeName :: Employee -> String;<br />
employeeName employee =<br />
//illustrates data constructor field selection of the directReports<br />
//field<br />
employee.RegularEmployee.name;<br />
Note that CAL allows multiple constructor arguments to be cited in a case extractor, along with multiple constructors<br />
to match on (so long as they all have the named arguments). So, the following scenario is possible (assuming the<br />
data declaration includes the employeeID field and new constructors for Contractor and Associate):<br />
// ...snip...<br />
case employee of<br />
//illustrates multiple field case expression extraction over multiple<br />
//data constructors. Note the local renaming of the employeeID field<br />
//to 'id'<br />
(RegularEmployee | Contractor | Associate) {name, employeeID = id } -> (name, id);<br />
;<br />
// ...snip...
Quark Framework 262<br />
3. Records<br />
CAL unifies tuples and records, which can be used as containers for heterogeneously typed values (as compared to<br />
lists, which are sequences of values of the same type). Records are extensible and can be convenient for passing<br />
collections of values where the formality of a new data definition is not necessary. Records can have textual or<br />
numeric (ordinal) indexed fields. Traditional tuples are simply records with exclusively ordinal fields and tuple<br />
constructors (parentheses) simply generate ordinal fields in sequence up from #1.<br />
Here are three examples of records: a tuple (demonstrating its simpler constructor syntax), a record with ordinal<br />
fields (fully equivalent to the first tuple) and a record with mixed ordinal and named fields:<br />
/**<br />
* A record with 3 fields: field #1 has type String, field #2 has type Maybe<br />
* Boolean and field #3 has type [Double].<br />
* It is expressed using tuple notation.<br />
*/<br />
tupleRecord1 :: (String, Maybe Boolean, [Double]);<br />
tupleRecord1 = ("apple", Just True, [2.0, 3.0, -5]);<br />
/**<br />
* This record actually has the same value as tupleRecord1, but it includes<br />
* field names explicitly, and thus uses braces rather than parentheses.<br />
* When using explicit field names, the ordering of the fields does not<br />
* matter.<br />
*/<br />
tupleRecord2 :: {#1 :: String, #3 :: [Double], #2 :: Maybe Boolean};<br />
tupleRecord2 = {#3 = [2.0, 3.0, -5], #1 = "apple", #2 = Just True};<br />
/**<br />
* Here is a record with both textual and ordinal fields.<br />
*/<br />
mixedRecord1 :: {#1 :: Maybe [Int], #2 :: Boolean, age :: Double, name :: String};<br />
mixedRecord1 = {name = "Anton", age = 3.0, #1 = Just [10 :: Int, 20], #2 = False};<br />
CAL on Java<br />
The CAL compiler takes CAL source, as text or as a source model (Java object model). This is processed by the<br />
early compiler stages to desugar and analyse the source. The intermediate form, plus metadata from analysis, is<br />
processed by a number of optimisers, optionally including a full rewrite optimiser capable of function fusion,<br />
deforestation and other major optimisations that preserve semantics but improve a program operationally.<br />
The compiler supports plugable back-ends. First amongst these is LECC (Lazily Evaluating CAL Compiler). This<br />
back-end generates Java classes and byte codes directly, emitting methods according to compiler schemes that take<br />
account of context metadata derived in the compiler, such as strictness of function arguments. LECC can package<br />
generated code in a number of ways, including as a CAL Archive (CAR), or a Java JAR. At runtime, a class loader<br />
can load an entire corpus of functions, or the Quark Framework loader can load closely connected functions<br />
according to prior dependency analysis. This latter feature is important to minimise start up times, whereby only the<br />
functions actually required by an application incur loading overhead.<br />
The LECC back-end can also generate Java source code, which is then compiled by the regular JDK Java compiler<br />
to produce class files. Amongst other things, this is very useful when validating compiler schemes during compiler<br />
development, and provides a way to reason about the operational behaviour of CAL on the Java platform.
Quark Framework 263<br />
As well as LECC, Open Quark includes a G-machine interpreter and a compiler back-end that generates G-machine<br />
code. While considerably slower than LECC, this option is useful for experiments and may be a better fit for some<br />
deployments.<br />
While many deployments of CAL may use the language standalone, the Quark Framework is fundamentally<br />
designed to be used within regular Java applications to provide a hybrid/multi-paradigm system. The intent is to<br />
allow transformational logic, which benefits from more algebraic representation, to be embeddable within Java OO<br />
logic handling regular (stateful) aspects of the application. To this end, CAL supports a very powerful and easy to<br />
use interface to Java, and the Quark Framework SDK allows Java code considerable control over how functions are<br />
evaluated and results produced. Java code can issue new functions to the Quark Framework for compilation, which<br />
can be immediately available for evaluation. Thus, Java can use the Quark Framework as a functional<br />
meta-programming environment. This has been a common use case for the framework, and is supported efficiently<br />
(low latency, with concurrent compilation and evaluation). On the consumption side, results can be presented to Java<br />
as lazy suspensions, so that minimal functional evaluation is performed and only when Java logic requests the 'next'<br />
output value. This feature allows data-flow logic to be constructed on-the-fly within a Java application, used<br />
on-demand and then disposed of if necessary. Both the LECC and G-machine runtimes are able to load and unload<br />
functions from memory to support a fully dynamic environment.<br />
The 'foreign' interface between CAL and Java is able to import any Java entity into CAL and make calls on Java<br />
methods. Values are passed efficiently between the two environments, without unnecessary boxing/unboxing<br />
operations. A powerful feature called "I/O policies" allows values to be lazily marshalled between structures if<br />
required (for instance, if you have a particular Java class or data structure that you wish to produce to represent a<br />
CAL value). These policies are declared completely on the CAL side, leaving the Java side 'natural'. The default<br />
policies are usually quite sufficient to share values, so usually nothing special must be done to exchange values.<br />
Here are some examples of CAL code that declares interfaces to Java entities:<br />
1. Importing a Java type, a constructor and a method<br />
The following code imports the "java.util.LinkedList" class (which becomes the CAL 'opaque' data type<br />
"JLinkedList"). The fragment then imports the default constructor for this class, and the instance method 'add'. All of<br />
these imports are marked private, which means that they would only be usable within the importing CAL module.<br />
This is quite common, as its usually good practise to export public functions from modules that behave as pure<br />
functions.<br />
data foreign unsafe import jvm "java.util.LinkedList"<br />
private JLinkedList deriving Inputable, Outputable;<br />
foreign unsafe import jvm "constructor"<br />
private linkedList_new :: JLinkedList;<br />
foreign unsafe import jvm "method add"<br />
private linkedList_add :: JLinkedList -> JObject -> Boolean;
Quark Framework 264<br />
2. Fields can be imported too<br />
foreign unsafe import jvm "static field java.lang.Float.NEGATIVE_INFINITY" floatNegativeInfinity :: Float;<br />
This is especially useful for constants, per the example.<br />
3. Casts for Java types<br />
Occasionally, it is necessary to cast between Java types that have been imported. For instance, JObject and JList are<br />
imported in the Prelude. If you needed to cast between them in CAL, then you could declare the appropriate casting<br />
functions. These declarations are properly checked for validity.<br />
foreign unsafe import jvm "cast" castObjectToList :: JObject -> JList;<br />
foreign unsafe import jvm "cast" castListToObject :: JList -> JObject;<br />
Of course, with casting, there's always the potential for runtime class cast exceptions, so it's a good thing that CAL's<br />
exception features are fully integrated with Java too, e.g. ...<br />
4. Java Exceptions<br />
The following fragment shows a CAL exception type being declared and a function that can demonstrate the<br />
throwing in CAL of this exception, or a Java NullPointerException depending on the argument it is passed. Note that<br />
CAL exceptions can have any payload. The definition of nullPointerException_make is not shown for brevity.<br />
data MyExceptionType a =<br />
MyExceptionType<br />
message :: String<br />
someOtherStuff :: a<br />
list :: [a]<br />
deriving Show<br />
;<br />
instance Exception Double where;<br />
instance Exception a => Exception (MyExceptionType a) where;<br />
//this is an interesting example because the JNullPointerException is not<br />
//caught by the JThrowable catch clause. exceptions thrown by CAL (with<br />
//CAL types) must be caught using their CAL type.<br />
calThrownException1 :: Int -> String;<br />
calThrownException1 n =<br />
(<br />
)<br />
if n < 0 then<br />
throw (MyExceptionType "spinach salad" 10.0 [20, 30, 40])<br />
else if n > 0 then<br />
else<br />
`catch`<br />
throw (nullPointerException_make "a new NullPointerException")<br />
"all OK"<br />
(\ex -> "caught MyExceptionType: " ++ show (ex :: MyExceptionType Double))<br />
`catch`<br />
(\ex -> "caught Throwable: " ++ show (ex :: JThrowable))
Quark Framework 265<br />
`catch`<br />
(\ex -> "caught NullPointerException: " ++ show (ex :: JNullPointerException))<br />
;<br />
If you want, you can make any type an Exception. See the following fragment:<br />
instance Exception String where;<br />
instance Exception Int where;<br />
instance Exception Integer where;<br />
instance Exception a => Exception (Maybe a) where;<br />
instance Exception a => Exception [a] where;<br />
instance Exception r => Exception {r} where;<br />
//tests using various Cal types as Exception types, including the interesting<br />
//case of records<br />
calThrownException5 =<br />
throw ("abc", 1 :: Int, 2 :: Integer, ["abc", "def"], Just (20 :: Int))<br />
`catch`<br />
(<br />
);<br />
let<br />
in<br />
handler :: (String, Int, Integer, [String], Maybe Int) -> String;<br />
handler r = show (r.#5, r.#4, r.#3, r.#2, r.#1);<br />
handler<br />
Finally, and just for fun, we show how you can map an exception handler over a list!<br />
handleAnyThrowableWithDefault :: a -> JThrowable -> a;<br />
handleAnyThrowableWithDefault def throwable = def;<br />
exceptionTest1 :: Boolean;<br />
exceptionTest1 =<br />
List.map (\x -> x `catch` handleAnyThrowableWithDefault (-999))<br />
[(4 :: Int) / 1, 10 /2, 5 / 0, (1 - 1) / 0, 2 / 2, 5 / (2 -2)]<br />
== [4, 5, -999, -999, 1, -999]<br />
;<br />
The three arithmetic exceptions (divide by zero) are converted to the default value (-999) by the exception handler.<br />
External references<br />
Downloads of Open Quark (with and without sources) and collateral are currently hosted at the Open Quark [1] site.<br />
The following documents are available:<br />
• The CAL Users Guide [4] - The main reference for the CAL language<br />
• CAL for Haskell Programmers [5] - A comparison of CAL with Haskell for those with familiarity of the latter<br />
• Effective CAL [6] - A discussion of best practices when programming in CAL<br />
• Open Quark Library documentation [7] - The HTML docs generated from library CAL Doc<br />
• The Gem Cutter Manual [8] - The main reference for the Graphical Language and its tool, the Gem Cutter<br />
• Open Quark Java SDK documentation [9] - The HTML docs generated from SDK JavaDoc<br />
• Java meets Quark [10] - A discussion and tutorial for using the SDK to embed Open Quark in Java applications
Quark Framework 266<br />
• Using JFit [11] - The reference for the JFit tool, a batch generator for foreign function declarations in CAL<br />
• Business Activity Monitor Sample [12] - A case study of embedding Open Quark in a Java app<br />
References<br />
[1] http:/ / openquark. org<br />
[2] http:/ / labs. businessobjects. com/ cal<br />
[3] http:/ / openquark. org/ Documents/ tutorial_calintro. html<br />
[4] http:/ / openquark. org/ Documents/ cal_users_guide. pdf<br />
[5] http:/ / openquark. org/ Documents/ cal_for_haskell_programmers. pdf<br />
[6] http:/ / openquark. org/ Documents/ effective_cal. pdf<br />
[7] http:/ / openquark. org/ Documents/ open_quark_cal_doc. zip<br />
[8] http:/ / openquark. org/ Documents/ gem_cutter_manual. pdf<br />
[9] http:/ / openquark. org/ Documents/ open_quark_javadoc. zip<br />
[10] http:/ / openquark. org/ Documents/ java_meets_quark. pdf<br />
[11] http:/ / openquark. org/ Documents/ using_jfit. pdf<br />
[12] http:/ / openquark. org/ Documents/ business_activity_monitor_overview. pdf<br />
REPLAY (software)<br />
REPLAY is a management system for audiovisual content developed at ETH Zurich.<br />
Background<br />
REPLAY was developed as the future Multimedia Portal of ETH Zurich within the scope of the ICT strategy<br />
2006-2009 and got branded „REPLAY“ in 2007. It is to manage the audiovisual content of ETH Zurich from<br />
production to distribution in an automated manner.<br />
Application area<br />
The main focus of REPLAY is the quasi automated handling of large number of lecture recordings (>150 per week)<br />
and to provide an integrated management solution for other video objects (films, digitization results etc.). Thus, it<br />
covers all the audiovisual material usually to be found in academic and other institutions (museums, companies etc.).<br />
Workflow<br />
REPLAY covers the complete lifecycle of the audiovisual objects: In the classroom / lecture hall, the Linux-based<br />
Playmobil as an additional hardware component automatically captures audio, video, and VGA (for<br />
slides/presentations/computer display/other devices). After the lecture, these sources are bundled with metadata and<br />
proceeded into the REPLAY backend. Other video material can be ingested through an inbox. All bundles are then -<br />
archived, - indexed (based on slide content, using Optical Character Recognition), - encoded according to settings<br />
and - distributed in various channels (RSS, streaming, download etc.) One of the distribution channels is Interplay, a<br />
user interface designed for interactive consumption of video.<br />
Much of the indexing and searching functionalites comes from Yovisto, a German metadata search engine for<br />
academic content.
REPLAY (software) 267<br />
Qualities<br />
REPLAY is written in Java, Open Source and oriented towards standards wherever possible. It is modular in design<br />
and envisaged to run on a singular machine as well as in a distributed environment.<br />
License<br />
REPLAY is Open Source under GNU LGPL license version 2.<br />
Development<br />
Development website [1] . Replay has been developed towards release 0.7 (March 2009); as of June 2009 the project<br />
has ended and support was suspended by the end of 2009. Efforts around REPLAY and its technology are beinge<br />
transferred to the Opencast Matterhorn project.<br />
External links<br />
• Official website [2]<br />
• Project website [3]<br />
• Article from the proceedings of the 36th annual ACM SIGUCCS conference [4]<br />
• The WSU eLearner blog on REPLAY [5]<br />
• The ICT en Onderwijs blog on REPLAY (Dutch) [6]<br />
• Presentation of REPLAY at EDUCAUSE 2008 [7]<br />
• Article on REPLAY (German) [8]<br />
• Presentation of REPLAY (German, video) [9]<br />
References<br />
[1] http:/ / replay. origo. ethz. ch/<br />
[2] http:/ / www. replay. ethz. ch<br />
[3] http:/ / www. project-replay. ethz. ch/<br />
[4] http:/ / portal. acm. org/ citation. cfm?doid=1449956. 1450016<br />
[5] http:/ / wsuelearner. wordpress. com/ 2008/ 11/ 18/ educause-2008-replay-for-audiovisual-lecture-recordings/<br />
[6] http:/ / www. gorissen. info/ Pierre/ item/ 2008/ 10/ 31/ replay-opern-source-lecture-capturing<br />
[7] http:/ / www. replay. ethz. ch/ docs/ educause<br />
[8] http:/ / www. workshop. ch/ openmind/ 2008/ 12/ 20/<br />
replay-gesamtloesung-zur-aufzeichnung-und-verbreitung-von-vorlesungen-der-eth-zuerich/<br />
[9] http:/ / www. tele-task. de/ lectures/ view/ 3910/ real/
Real time Java 268<br />
Real time Java<br />
Real time Java is a catch-all term for a combination of technologies that allows programmers to write programs that<br />
meet the demands of Real time systems in the Java programming language.<br />
Java's sophisticated memory management, native support for threading and concurrency, type safety, and relative<br />
simplicity have created a demand for its use in many domains. Its capabilities have been enhanced to support real<br />
time computational needs:<br />
• Java supports a strict priority based threading model.<br />
• Because Java threads support priorities, Java locking mechanisms support priority inversion avoidance<br />
techniques, such as priority inheritance or the priority ceiling protocol.<br />
To overcome typical real time difficulties, the Java Community introduced a specification for real-time Java,<br />
JSR001. A number of implementations of the resulting Real-Time Specification for Java (RTSJ) have emerged,<br />
including a reference implementation from Timesys, IBM's WebSphere Real Time, Sun Microsystems's Java SE<br />
Real-Time Systems [1] , Aonix PERC or JamaicaVM from aicas.<br />
The RTSJ addressed the critical issues by mandating a minimum specification for the threading model (and allowing<br />
other models to be plugged into the VM) and by providing for areas of memory that are not subject to garbage<br />
collection, along with threads that are not preemptable by the garbage collector. These areas are instead managed<br />
using region-based memory management.<br />
Real-Time Specification for Java<br />
The Real-Time Specification for Java (RTSJ) is a set of interfaces and behavioral specifications that allow for<br />
real-time programming in the Java programming language. RTSJ 1.0 was developed as JSR 1 under the Java<br />
Community Process, which approved the new standard in November, 2001. As of 2006, RTSJ 1.1 is being developed<br />
under JSR 282.<br />
See also<br />
• Functional specification<br />
• Javolution - RTSJ Compliant Java Library (open-source)<br />
External links<br />
• Real-Time Specification for Java (RTSJ) [2]<br />
• JSR-1 [3]<br />
• IBM WebSphere Real Time [4] a fully conformant RTSJ SE VM<br />
• JamaicaVM [5] an RTSJ SE implementation with deterministic garbage collection<br />
• PERC [6] a real-time VM based on Java Standard Edition rather than RTSJ<br />
• Sun Java SE Real-Time System [7]<br />
• Apogee real-time Java with real-time GC [8]<br />
• Timesys RTSJ implementation and testing toolkit [9]<br />
• jRate (Java Real-Time Extension) [10] an open-source extension of the GNU GCJ compiler front-end and runtime<br />
system which adds support for most of the features required by the RTSJ.<br />
• DDC-I Scorpion Java [11] real-time Java SE, with safety-critical and secure versions.<br />
• International Workshop on Java Technologies for Real-time and Embedded Systems (JTRES 2006) [12] JTRES<br />
2007 [13] JTRES 2008 [14]
Real time Java 269<br />
References<br />
[1] Java SE Real-Time Systems (http:/ / java. sun. com/ javase/ technologies/ realtime/ index. jsp)<br />
[2] http:/ / www. rtsj. org/<br />
[3] http:/ / jcp. org/ en/ jsr/ detail?id=1<br />
[4] http:/ / www-03. ibm. com/ linux/ realtime. html<br />
[5] http:/ / www. aicas. com/ jamaica. html<br />
[6] http:/ / www. aonix. com/<br />
[7] http:/ / java. sun. com/ javase/ technologies/ realtime. jsp<br />
[8] http:/ / www. apogee. com/<br />
[9] http:/ / www. timesys. com/ java/<br />
[10] http:/ / jrate. sourceforge. net/<br />
[11] http:/ / www. ddci. com/ products_scorpion. php<br />
[12] http:/ / www-users. cs. york. ac. uk/ ~andy/ JTRES06/<br />
[13] http:/ / www. vmars. tuwien. ac. at/ jtres2007/<br />
[14] http:/ / jtres. java. sun. com/ 2008/<br />
Resource (Java)<br />
In the Java programming language a resource is a piece of data that can be accessed by the code of an application.<br />
An application can access its resources through Uniform Resource Locators, like web resources, but the resources<br />
are usually contained within the JAR file(s) of the application.<br />
A resource bundle is a set of key and value pairs, stored as a resource, that is commonly used to allow the<br />
localization of an application. For this purpose different resource bundles with a common set of keys are used to<br />
store translations for the messages and user interface texts of an application.<br />
References<br />
Campione, Mary; Kathy Walrath, Alison Huml (2004). "Internationalization" [1] . The Java Tutorial Continued [2] (6<br />
print. ed.). Addison-Wesley. ISBN 0-201-48558-3. Retrieved April 2006.<br />
References<br />
[1] http:/ / java. sun. com/ docs/ books/ tutorial/ i18n/ TOC. html<br />
[2] http:/ / java. sun. com/ docs/ books/ tutorial/ books/ continued/ index. html
Restlet 270<br />
Restlet<br />
Stable release 2.0.0 / July 19, 2010<br />
Development status Active<br />
Written in Java<br />
Operating system Cross-platform<br />
Website http:/ / www. restlet.<br />
org/<br />
Restlet is a lightweight, comprehensive, open source REST framework for the Java platform. Restlet is suitable for<br />
both server and client Web applications. It supports major Internet transport, data format, and service description<br />
standards like HTTP and HTTPS, SMTP, XML, JSON, Atom, and WADL. A GWT port of the client-side library is<br />
also available.<br />
Licenses<br />
Restlet is available under four different licenses: [1]<br />
• CDDL ver 1.0<br />
• LGPL ver 2.1<br />
• LGPL ver 3.0<br />
• EPL ver 1.0<br />
Architecture<br />
Restlet directly models the concepts (Resource, Representation, Connector, Component, etc.) from Roy T. Fielding's<br />
original dissertation on the architecture of the Web, Architectural Styles and the Design of Network-based Software<br />
Architectures [2] .<br />
The Restlet framework is composed of two main parts. First, there is the "Restlet API", a neutral API supporting the<br />
concepts of REST and facilitating the handling of calls for both client-side and server-side applications. This API<br />
must be supported by a Restlet implementation before it can effectively be used. Multiple implementations could be<br />
provided (open source projects or commercial products).<br />
It is available in five consistent editions. Each edition targets a special development environment:<br />
• Google Web Toolkit (GWT) for AJAX applications deployed in desktop browsers, without any plugin required;<br />
• Google App Engine (GAE/J) for deployment on Google’s cloud computing infrastructure;<br />
• Android for deployment on compatible smartphones;<br />
• Java SE for standalone deployments in regular Java Virtual Machines;<br />
• Java EE for deployment in Servlet engines.
Restlet 271<br />
Connectors<br />
The list of available connectors splits into:<br />
• Server connectors: Servlet, Spring, Jetty, Grizzly, Simple, JAXB, JAX-RS, JiBX, Velocity;<br />
• Client connectors: Internal, Apache HTTP Client, Net (JDK's HttpURLConnection), JavaMail, JDBC.<br />
History<br />
Founder Jerome Louvel of Noelios Consulting began the Restlet project in December 2005, and was the primary<br />
developer and committer through the project's 1.0 release in April, 2007. [3] He was subsequently joined by Thierry<br />
Boileau, also of Noelios, and an expanding list of extension developers from the Restlet community.<br />
The May, 2007 publication of the O'Reilly book RESTful Web Services featured Restlet alongside Django and<br />
Rails. [4]<br />
Restlet 1.1 was released October 28, 2008 [5] , and included support for GWT and the then-emerging JAX-RS<br />
standard.<br />
On May 6, 2009, Jerome Louvel announced that the planned 1.2 release of Restlet would be renamed 2.0, mainly<br />
due to significant changes in the modeling of resources. The 2.0 release is targeted for the second half of 2009. [6]<br />
Features exposed in 2.0 milestone builds include specific support for Google App Engine and Android.<br />
An upcoming Restlet book ("Restlet In Action") has been announced by Noelios and Manning Press, planned to<br />
cover Restlet version 2.0.<br />
External links<br />
• Restlet - Lightweight REST framework for Java [7]<br />
• JavaWorld article on Restlet [8]<br />
References<br />
[1] Restlet - Legal terms (http:/ / www. restlet. org/ about/ legal)<br />
[2] http:/ / www. ics. uci. edu/ ~fielding/ pubs/ dissertation/ top. htm<br />
[3] http:/ / www. eweek. com/ c/ a/ Application-Development/ Java-Project-Founder-Outlines-Benefits-of-Restlet/<br />
[4] Richardson, Leonard; Ruby, Sam (2007), RESTful Web Services, O'Reilly (published (May 8, 2007)), ISBN 0596529260<br />
[5] http:/ / blog. noelios. com/ 2008/ 10/ 28/ restlet-110-released/<br />
[6] http:/ / restlet. tigris. org/ ds/ viewMessage. do?dsMessageId=2078602& dsForumId=4447<br />
[7] http:/ / www. restlet. org/<br />
[8] http:/ / www. javaworld. com/ javaworld/ jw-12-2008/ jw-12-rest-series-2. html
Retrotranslator 272<br />
Retrotranslator<br />
Stable release 1.2.6 / February 29, 2008<br />
Written in Java<br />
Operating<br />
system<br />
Cross-platform<br />
Platform Java Virtual Machine<br />
License BSD-like License<br />
Website [1]<br />
Retrotranslator is a program written in Java that converts Java classes (bytecode). The source classes may use Java<br />
1.5 and Java 1.6 features, whereas the target will be compatible with Java 1.4 and older environments.<br />
Retrotranslator supports all Java 5 language features and part of the Java 5 API on both J2SE 1.4 and J2SE 1.3. On<br />
older Java environments only the Java 5 features that don't depend on the new API are supported. Retrotranslator is<br />
based on the ASM bytecode manipulation framework and the backport of the Java 5.0 concurrency utilities (see<br />
http:/ / backport-jsr166. sourceforge. net/ )<br />
The Stripes Framework developers suggest to use Retrotranslator in order to use Stripes (which extensively use Java<br />
1.5 features) on a Java 1.4 environment [2]<br />
Alternative tools<br />
• Retroweaver<br />
• Declawer<br />
• JBossRetro<br />
External links<br />
• Java backporting tools<br />
References<br />
[1] http:/ / retrotranslator. sourceforge. net/<br />
[2] http:/ / www. stripesframework. org/ display/ stripes/ Java+ 1. 4+ and+ Stripes
SLAMD 273<br />
SLAMD<br />
The SLAMD Distributed Load Generation Engine (SLAMD) is a Java-based application designed for stress testing<br />
and performance analysis of network-based applications. Initial development of SLAMD was performed at Sun<br />
Microsystems, with recent development sponsored primarily by UnboundID Corp. [1] .<br />
SLAMD is available under the terms of the Sun Public License, which is an OSI-approved open source license. The<br />
main site for obtaining information about SLAMD is available at its main web site [2] , and it is available as a java.net<br />
[3] project.<br />
SLAMD was originally developed for the purpose of benchmarking and analyzing the performance of LDAP<br />
directory servers, and it is the most powerful and flexible tool available for this task. However, it is also well-suited<br />
for testing other kinds of network applications and has been used for things like Web servers and Web-based<br />
applications, relational databases, and mail servers. It can also be used for non-network based applications (and in<br />
fact, it is used for comparing things like CPU power and memory latency across a number of different kinds of<br />
systems), although its distributed nature makes it ideal for systems that can be accessed remotely.<br />
Architecture<br />
SLAMD uses a distributed model consisting of a server (SLAMD is distributed with Apache Tomcat) and clients.<br />
The operator schedules a new job using a browser, and submits the job for execution. The server sends the scheduled<br />
job to selected clients, these clients then generate load based on parameters defined in the SLAMD job class and<br />
report results back to the SLAMD Server. SLAMD 2.0.0-alpha1 uses the Berkeley DB Java Edition. [4]<br />
Extensibility<br />
"SLAMD provides a Java-based API to make it possible to quickly develop custom workloads, and it also<br />
contains an embedded scripting engine that can make it easy to stress applications using protocols like LDAP,<br />
HTTP, SMTP, IMAP, and POP, or any database that can be accessed via JDBC. It also includes tools for<br />
recording and playing back TCP traffic, and a utility for intercepting LDAP communication and writing it as a<br />
script that may be executed in the SLAMD scripting engine." [5]<br />
SLAMD jobs are managed by Java classes. New SLAMD job classes can be created by writing Java code using a<br />
well-defined API[6], compiling the Java code, and installing the Job Class (the class is installed on the servers and<br />
the server pushes it out to the clients).<br />
Installation<br />
Supported Systems<br />
SLAMD is supported on any computer operating system that supports Java, such as Solaris, Linux, AIX, HPUX, and<br />
Windows. SLAMD version 2 or greater requires Java 5 or greater.<br />
Jobs<br />
Benchmarking campaigns are a series of SLAMD jobs. SLAMD jobs are created by filling in the forms in the<br />
Schedule a New Job page. The operator sets up a job via a browser, then submits the job. The Server sends the job to<br />
SLAMD Clients.<br />
The SLAMD Clients generate load based on parameters in the SLAMD job class. Parameters can be items such as<br />
duration, ramp-up and ramp-down, and any other parameter defined in the Job Class.
SLAMD 274<br />
Reporting<br />
SLAMD generates reports in the following formats:<br />
• HTML<br />
• Portable Document Format<br />
• Text file<br />
See also<br />
• Benchmarking<br />
External links<br />
• SLAMD at java.net [3]<br />
• SLAMD website [7]<br />
• Benchmarking at about.com [8]<br />
• Six Sigma [9]<br />
• MrBenchmark blog at Sun Microsystems [10]<br />
References<br />
[1] http:/ / www. unboundid. com<br />
[2] http:/ / www. slamd. com/<br />
[3] http:/ / slamd2. dev. java. net<br />
[4] http:/ / www. slamd. com/ downloads/ slamd-2. 0. 0-alpha1-release-notes. pdf<br />
[5] SLAMD Distributed Load Generation Engine - Home (http:/ / www. slamd. com)<br />
[6] http:/ / www. slamd. com/ docs/ slamd_job_developers_guide. pdf<br />
[7] http:/ / www. slamd. com<br />
[8] http:/ / management. about. com/ cs/ benchmarking/ a/ Benchmarking. htm<br />
[9] http:/ / www. isixsigma. com/ me/ benchmarking/<br />
[10] http:/ / blogs. sun. com/ MrBenchmark
SLAMD Server 275<br />
SLAMD Server<br />
A SLAMD Server is a server supported by an application server that services SLAMD clients and SLAMD jobs.<br />
SLF4J<br />
Developer(s) Ceki Gülcü<br />
Stable release 1.6.1 / July 5, 2010<br />
Written in Java<br />
Operating<br />
system<br />
Cross-platform<br />
Type Logging Tool<br />
License MIT License<br />
Website http:/ / www. slf4j. org/<br />
Simple Logging Facade for Java (SLF4J) provides a Java logging API by means of a simple facade pattern. The<br />
underlying logging backend is determined at deployment time and includes java.util.logging [1] , log4j and logback.<br />
The separation of the client API from the logging backend reduces the coupling between an application and any<br />
particular logging framework. This can make it easier to integrate with existing or third-party code or to deliver code<br />
into other projects that have already made a choice of logging backend.<br />
SLF4J was created by Ceki Gülcü as a more reliable alternative to Jakarta Commons Logging framework.<br />
Similarities and Differences with Log4j<br />
• Five of Log4j's six logging levels are used. FATAL has been dropped on the basis that inside the logging<br />
framework is not the place to decide when an application should terminate and therefore there is no difference<br />
between ERROR and FATAL from the logger's point of view.<br />
• Logger instances are created via the LoggerFactory, which is very similar in Log4j. For example,<br />
private static final Logger LOG =<br />
LoggerFactory.getLogger(Wombat.class);<br />
• In Logger [2] , the logging methods are overloaded with forms that accept one, two or more values. Occurrences of<br />
the simple pattern {} in the log message is replaced in turn with the values. This is simple to use yet provides a<br />
performance benefit when the values have expensive toString() methods. When logging is disabled at the<br />
DEBUG level, the logging framework does not need to evaluate the string representation of the values. In the<br />
following example, the values count or userAccountList only need to be evaluated when DEBUG is<br />
enabled; otherwise the overhead of the debug call is trivial.<br />
LOG.debug("There are now " + count + " user accounts: " +<br />
userAccountList); // slow<br />
LOG.debug("There are now {} user accounts: {}", count,<br />
userAccountList); // faster<br />
• Similar methods exist in Logger [2] for isDebugEnabled() etc to allow more complex logging calls to be<br />
wrapped so that they are disabled when the corresponding level is disabled, avoiding unnecessary processing.
SLF4J 276<br />
• Unlike Log4j, SLF4J offers logging methods that accept markers. These are special objects that enrich the log<br />
messages and are an idea that SLF4J has borrowed from logback.<br />
See also<br />
• log4j<br />
• Java Logging Frameworks<br />
External links<br />
• Official slf4j Homepage [3]<br />
References<br />
[1] http:/ / java. sun. com/ javase/ 6/ docs/ api/ java/ util/ logging/ package-summary. html<br />
[2] http:/ / slf4j. org/ apidocs/ org/ slf4j/ Logger. html<br />
[3] http:/ / slf4j. org/
Bruno Souza 277<br />
Bruno Souza<br />
Born<br />
Nationality Brazilian<br />
Bruno Souza<br />
Bruno Peres Ferreira de Souza [1]<br />
Known for Self-promotion<br />
Website<br />
www.javaman.com.br [2]<br />
Bruno Souza is the President of SOUJava [3] , a Brazilian Java User Group. He promotes himself as the<br />
"JavaMan" [1]<br />
Javali, a project owned by SOUJava, is focused in increasing Java usage in Brazil [4] . This project has the support<br />
from ITI [5] [6] [7] .<br />
From 2007 [8] to 2009 [9] , Bruno was on the Board of Directors at the Open Source Initiative, where he currently<br />
holds an Emeritus status. [9]<br />
External links<br />
• Bruno Souza´s homepage [10] and weblog [11]<br />
• Bruno Souza´s Interview in Netbeans.tv [12]<br />
References<br />
[1] Souza, Bruno. "Site do JavaMan" (http:/ / www. javaman. com. br/ ) (in Portuguese). Bruno's own homepage. . Retrieved 2009-01-13.<br />
[2] http:/ / www. javaman. com. br<br />
[3] "Organização - SOUJava" (http:/ / www. soujava. org. br/ pages/ viewpage. action?pageId=1835023) (in Portuguese). SOUJava. . Retrieved<br />
2009-01-13.<br />
[4] "Javali" (https:/ / javali. dev. java. net/ ). . Retrieved 2008-10-19.<br />
[5] Instituto Nacional de Tecnologia da Informação (2004-07-01). "ITI apóia projeto Javali" (http:/ / www. iti. gov. br/ twiki/ bin/ view/ Noticias/<br />
PressRelease2004Jul01A) (in Portuguese). Press release. . Retrieved 2009-01-13.<br />
[6] Instituto Nacional de Tecnologia da Informação (2006-05-24). "Governo Federal recebe apoio de empresa na adoção de Software Livre"<br />
(http:/ / www. iti. gov. br/ twiki/ bin/ view/ Noticias/ PressRelease2006May24A) (in Portuguese). Press release. . Retrieved 2009-01-13.<br />
[7] "Apresentação" (http:/ / www. iti. gov. br/ twiki/ bin/ view/ ITI/ Apresentacao) (in Portuguese). Instituto Nacional de Tecnologia da<br />
Informação. . Retrieved 2009-01-13.<br />
[8] "OSI Board of Directors" (http:/ / www. opensource. org/ docs/ board-annotated#BrunoDeSouza). . Retrieved 2008-10-19.<br />
[9] OSI (http:/ / www. opensource. org) (2009-05-11). "2009 OSI Board Elections held in April" (http:/ / www. opensource. org/ node/ 431).<br />
Press release. .<br />
[10] http:/ / www. javaman. com. br/<br />
[11] http:/ / today. java. net/ pub/ au/ 88<br />
[12] http:/ / www. netbeans. tv/ interviews/ Bruno-Souza-215/
Static import 278<br />
Static import<br />
Static import is a feature introduced in the Java programming language that allows members (fields and methods)<br />
defined in a class as public static to be used in Java code without specifying the class in which the field is defined.<br />
This feature was introduced into the language in version 5.0.<br />
The feature provides a typesafe mechanism to include constants into code without having to reference the class that<br />
originally defined the field. It also helps to deprecate the practice of creating a constant interface: an interface that<br />
only defines constants then writing a class implementing that interface, which is considered an inappropriate use of<br />
interfaces [1] .<br />
The mechanism can be used to reference individual members of a class:<br />
import static java.lang.Math.PI;<br />
import static java.lang.Math.pow;<br />
or all the static members of a class:<br />
import static java.lang.Math.*;<br />
For example, this class:<br />
public class HelloWorld {<br />
public static void main(String[] args) {<br />
cm, it has:");<br />
"cm");<br />
System.out.println("Hello World!");<br />
System.out.println("Considering a circle with a diameter of 5<br />
System.out.println("A circumference of " + (Math.PI * 5) +<br />
System.out.println("And an area of " + (Math.PI *<br />
Math.pow(5,2)) + "sq. cm");<br />
}<br />
}<br />
Can be shortened to:<br />
import static java.lang.Math.*;<br />
import static java.lang.System.out;<br />
public class HelloWorld {<br />
has:");<br />
}<br />
public static void main(String[] args) {<br />
}<br />
out.println("Hello World!");<br />
out.println("Considering a circle with a diameter of 5 cm, it<br />
out.println("A circumference of " + (PI * 5) + "cm");<br />
out.println("And an area of " + (PI * pow(5,2)) + "sq. cm");
Static import 279<br />
References<br />
[1] Java Practices (http:/ / www. javapractices. com/ topic/ TopicAction. do;jsessionid=8DE0FD351E0CF7378452E4E1001FCDDA?Id=32)<br />
StormMQ<br />
Developer(s) StormMQ Limited<br />
Stable release 2010.05.20.1859.RC / May 20, 2010<br />
Written in Java<br />
Operating<br />
system<br />
Cross-platform<br />
Type AMQP, Message Queuing Service, message oriented middleware<br />
License Client downloads Mozilla Public License<br />
Website<br />
StormMQ.com [1]<br />
In computing, StormMQ is a Message Queuing Service (a form of message-oriented middleware that provides a<br />
message broker), using the standard Advanced Message Queuing Protocol (AMQP). StormMQ is the first Hosted,<br />
On-Premise or Cloud solution for Machine-to-Machine Message Queuing using AMQP. StormMQ Limited provides<br />
an open, secure platform and the necessary legal protections for data moved through the cloud. The platform<br />
interoperates with clients from RabbitMQ and Apache Qpid, with additional clients developed by StormMQ with<br />
third parties available as open source with code released under the Mozilla Public License.<br />
See also<br />
• Advanced Message Queuing Protocol<br />
• Message Queuing Service<br />
• message oriented middleware<br />
References<br />
[1] http:/ / stormmq. com/<br />
• Ross Cooney (2010-03-20). "StormMQ at CloudStorm" (http:/ / www. spoutingshite. com/ 2010/ 03/ 20/<br />
cloudstorm-london/ ). SpoutingShite.<br />
• Tony Byrne (2010-05-01). "StormMQ-Ruby-Client" (http:/ / github. com/ tonybyrne/ StormMQ-Ruby-Client/<br />
tree/ l). GitHub.<br />
External links<br />
• StormMQ web site (http:/ / stormmq. com/ )<br />
• StormMQ touts data-protection compliance for secure messaging service in the cloud (http:/ / www. the451group.<br />
com/ report_view/ report_view. php?entity_id=62762)
strictfp 280<br />
strictfp<br />
strictfp is a keyword in the Java programming language that restricts floating-point calculations to ensure<br />
portability. It was introduced into Java with the Java virtual machine (JVM) version 1.2.<br />
Basis<br />
The IEEE standard, IEEE 754, specifies a standard method for both floating-point calculations and storage of<br />
floating-point values in either single (32-bit, used in Java floats) or double (64-bit, used in Java doubles) precision.<br />
Prior to JVM 1.2, floating-point calculations were strict; that is, all intermediate floating-point results were<br />
represented as IEEE single or double precisions. As a consequence, errors of calculation, overflows and underflows,<br />
could occur. Whether or not an error had occurred, the calculation would always return a valid number; if an<br />
overflow or underflow had occurred, that number would be incorrect. Hence, whether an error had occurred was<br />
typically not obvious. Since JVM 1.2, intermediate computations are not limited to the standard 32- and 64- bit<br />
precisions. On platforms that can handle other representations, those representations can be used, preventing<br />
overflows and underflows, thereby increasing precision. For some applications, a programmer might need every<br />
platform to have precisely the same floating-point behavior, even on platforms that could handle greater precision.<br />
The strictfp modifier accomplishes this by truncating all intermediate values to IEEE single- and double- precision,<br />
as occurred in earlier versions of the JVM [1] .<br />
Usage<br />
Programmers can use the modifier strictfp to ensure that calculations are performed as in the earlier versions; that is,<br />
only with IEEE single and double precision types used. Using strictfp guarantees that results of floating-point<br />
calculations are identical on all platforms. This can be extremely useful when comparing floating-point numbers.<br />
It can be used on classes, interfaces and non-abstract methods. [2] When applied to a method, it causes all calculations<br />
inside the method to use strict floating-point math. When applied to a class, all calculations inside the class use strict<br />
floating-point math. Compile-time constant expressions must always use strict floating-point behavior<br />
Examples<br />
public strictfp class MyFPclass {<br />
}<br />
// ... contents of class here ...<br />
The Java package java.lang.Math class contains these strictfp methods:<br />
public static strictfp double abs(double);<br />
public static strictfp int max(int, int);<br />
public static strictfp long max(long, long);<br />
public static strictfp float max(float, float);<br />
public static strictfp double max(double, double);<br />
public static strictfp int min(int, int);
strictfp 281<br />
Behaviors and restrictions<br />
Strictfp is sometimes viewed as a problem of Java [3] [4] .<br />
References<br />
• http:/ / java. sun. com/ docs/ books/ vmspec/ 2nd-edition/ html/ Concepts. doc. html#24465<br />
[1] Flanagan, David (March 2005). Java in a Nutshell (http:/ / oreilly. com/ catalog/ 9780596007737) (Fifth ed.). O'Reilly Media.<br />
ISBN 978-0-596-00773-7. . Retrieved 2010-03-03.<br />
[2] Schildt, Herbert (2007). Java: A Beginner's Guide (4 ed.). McGraw-Hill Companies. ISBN 978-0-07-226384-8.<br />
[3] Kahan, W.; Joseph D. Darcy (1998-03-01). "How Java's Floating-Point Hurts Everyone Everywhere" (http:/ / www. cs. berkeley. edu/<br />
~wkahan/ JAVAhurt. pdf) (PDF). . Retrieved 2006-12-09.<br />
[4] "Types, Values, and Variables" (http:/ / java. sun. com/ docs/ books/ jls/ third_edition/ html/ typesValues. html#4. 2. 3). Sun Microsystems. .<br />
Retrieved 2006-12-09.<br />
String Buffer<br />
In object-oriented programming, a String Buffer is an alternative to a String. It has the ability to be altered through<br />
adding or appending, whereas a String is normally fixed or unchangeable.<br />
In Java<br />
Theory<br />
Java's standard way to handle text is to use its String class. Any given String in Java is an immutable object, which<br />
means its state cannot be changed. A String has an array of characters. Whenever a String must be manipulated, any<br />
changes require the creation of a new String (which, turn, involves the creation of a new array of characters, and<br />
copying of the original array). This happens even if the original String's value or intermediate Strings used for the<br />
manipulation are not kept.<br />
Java provides an alternate class for string manipulation, called a StringBuffer [1] . A StringBuffer, like a String, has<br />
an array to hold characters. It, however, is mutable (its state can be altered). Its array of characters is not necessarily<br />
completely filled (as oppose to a String, whose array is always the exact required length for its contents). Thus, it has<br />
the capability to add, remove, or change its state without creating a new object (and without the creation of a new<br />
array, and array copying). The exception to this is when its array is no longer of suitable length to hold its content. In<br />
this case, it is required to create a new array, and copy contents.<br />
For these reasons, Java would handle an expression like<br />
String newString = aString + anInt + aChar + aDouble;<br />
like this:<br />
String newString = (new StringBuffer(aString)).append(anInt).append(aChar).append(aDouble)).toString();<br />
Implications<br />
Generally, a StringBuffer is more efficient than a String in string handling. However, this is not necessarily the case,<br />
since a StringBuffer will be required to recreate its character array when it runs out of space. Theoretically, this is<br />
possible to happen the same number of times as a new String would be required, although this is unlikely (and the<br />
programmer can provide length hints to prevent this). Either way, the effect is not noticeable in modern desktop<br />
computers.
String Buffer 282<br />
As well, the shortcomings of arrays are inherent in a StringBuffer. In order to insert or remove characters are<br />
arbitrary positions, whole sections of arrays must be moved.<br />
The method by which a StringBuffer is attractive in an environment with low processing power takes this ability by<br />
using too much memory, which is likely also at a premium in this environment. This point, however, is trivial,<br />
considering the space required for creating many instances of Strings in order to process them. As well, the<br />
StringBuffer can be optimized to "waste" as little memory as possible.<br />
The StringBuilder class, introduced in J2SE 5.0, differs from StringBuffer in that it is unsynchronized. When only a<br />
single thread at a time will access the object, using a StringBuilder is more efficient than using a StringBuffer.<br />
StringBuffer and StringBuilder are included in the java.lang package.<br />
In .NET<br />
Microsoft's .NET Framework has a StringBuilder class in its Base Class Library.<br />
See also<br />
• Analysis of algorithms<br />
Links<br />
• The JavaDocs of StringBuffer [1] , StringBuilder [2] and String [3] , as well as the article StringBuffer and<br />
StringBuilder.<br />
• The source code of these classes [4]<br />
• Urban Performance Legends [5] - An article which involves a discussion of immutable objects with respect to<br />
object-oriented design<br />
References<br />
[1] http:/ / java. sun. com/ j2se/ 1. 5. 0/ docs/ api/ java/ lang/ StringBuffer. html<br />
[2] http:/ / java. sun. com/ j2se/ 1. 5. 0/ docs/ api/ java/ lang/ StringBuilder. html<br />
[3] http:/ / java. sun. com/ j2se/ 1. 5. 0/ docs/ api/ java/ lang/ String. html<br />
[4] http:/ / www. java2s. com/ Code/ JavaAPI/ java. lang/ StringBuffer. htm<br />
[5] http:/ / www-128. ibm. com/ developerworks/ java/ library/ j-jtp04223. html?ca=dgr-lnxw01JavaUrbanLegends
Sun Web Developer Pack 283<br />
Sun Web Developer Pack<br />
The Sun Web Developer Pack (SWDP) is a collection of open source software released by Sun Microsystems for<br />
developing web applications that run on Java EE application servers. The SWDP is targeted at software developers<br />
interested in writing web applications that use Web 2.0 technologies such as Ajax, REST, Atom, and JavaScript.<br />
Software Included in the SWDP<br />
The SWDP consists of the following software:<br />
• Scripting language support<br />
• Project Phobos, a project that allows you to write web applications in JavaScript or other scripting languages<br />
• Ajax technologies<br />
• Project jMaki, a framework for creating Ajax-enabled web applications in Java, PHP, or Phobos<br />
• Project Dynamic Faces, a framework for creating Ajax-enabled JavaServer Faces applications<br />
• REST<br />
• RESTful web services, an API for creating REST web services in Java<br />
• WADL<br />
• ROME, a Java API for parsing and generating RSS and Atom web feeds<br />
• Atom Server (The ROME Propono subproject), a prototype Java API and framework for creating a web feed<br />
server for Atom feeds<br />
Release history<br />
Release 1 of the SWDP was made public on March 12, 2007.<br />
External links<br />
• Sun Web Developer Pack home page [1]<br />
• Documentation<br />
• Online SWDP Tutorial [2]<br />
• SWDP Tutorial bundle download [3]<br />
• Getting Started with the SWDP [4]<br />
• java.net project pages<br />
• Project jMaki [5]<br />
• Project Dynamic Faces [6]<br />
• Project Phobos [7]<br />
• WADL [8]<br />
• ROME API [9]
Sun Web Developer Pack 284<br />
References<br />
[1] http:/ / developers. sun. com/ web/ swdp/ index. jsp<br />
[2] http:/ / developers. sun. com/ web/ swdp/ docs/ tutorial/ doc/ toc. html<br />
[3] http:/ / developers. sun. com/ web/ swdp/ docs/ tutorial/ download. html<br />
[4] http:/ / developers. sun. com/ web/ swdp/ docs/ GettingStarted. html<br />
[5] https:/ / ajax. dev. java. net<br />
[6] https:/ / jsf-extensions. dev. java. net<br />
[7] https:/ / phobos. dev. java. net<br />
[8] https:/ / wadl. dev. java. net<br />
[9] https:/ / rome. dev. java. net<br />
Swing (Java)<br />
Swing is a widget toolkit for Java. It is part<br />
of Sun Microsystems' Java Foundation<br />
Classes (JFC) — an API for providing a<br />
graphical user interface (GUI) for Java<br />
programs.<br />
Swing was developed to provide a more<br />
sophisticated set of GUI components than<br />
the earlier Abstract Window Toolkit. Swing<br />
provides a native look and feel that emulates<br />
the look and feel of several platforms, and<br />
also supports a pluggable look and feel that<br />
allows applications to have a look and feel<br />
unrelated to the underlying platform.<br />
History<br />
The Internet Foundation Classes (IFC) were<br />
Example Swing widgets in Java 5 for the X Window System<br />
a graphics library for Java originally developed by Netscape Communications Corporation and first released on<br />
December 16, 1996. On April 2, 1997, Sun Microsystems and Netscape Communications Corporation announced<br />
their intention to incorporate IFC with other technologies to form the Java Foundation Classes.<br />
Swing introduced a mechanism that allowed the look and feel of every component in an application to be altered<br />
without making substantial changes to the application code. The introduction of support for a pluggable look and feel<br />
allows Swing components to emulate the appearance of native components while still retaining the benefits of<br />
platform independence. This feature also makes it easy to make an application written in Swing look very different<br />
from native programs if desired.<br />
Originally distributed as a separately downloadable library, Swing has been included as part of the Java Standard<br />
Edition since release 1.2. The Swing classes and components are contained in the javax.swing package hierarchy.
Swing (Java) 285<br />
The Swing Architecture<br />
Swing is a platform-independent, Model-<strong>View</strong>-Controller GUI framework for Java. It follows a single-threaded<br />
programming model, and possesses the following traits:<br />
Foundations<br />
Swing is platform independent both in terms of expression (Java) and implementation (Look-and-Feel).<br />
Extensible<br />
Swing is a highly partitioned architecture, which allows for the "plugging" of various custom implementations of<br />
specified framework interfaces: Users can provide their own custom implementation(s) of these components to<br />
override the default implementations. In general, Swing users can extend the framework by extending existing<br />
(framework) classes and/or providing alternative implementations of core components.<br />
Swing is a component-based framework. The distinction between objects and components is a fairly subtle point:<br />
concisely, a component is a well-behaved object with a known/specified characteristic pattern of behaviour. Swing<br />
objects asynchronously fire events, have "bound" properties, and respond to a well-known set of commands (specific<br />
to the component.) Specifically, Swing components are Java Beans components, compliant with the Java Beans<br />
Component Architecture specifications.<br />
Customizable<br />
Given the programmatic rendering model of the Swing framework, fine control over the details of rendering of a<br />
component is possible in Swing. As a general pattern, the visual representation of a Swing component is a<br />
composition of a standard set of elements, such as a "border", "inset", decorations, etc. Typically, users will<br />
programmaticaly customize a standard Swing component (such as a JTable) by assigning specific Borders, Colors,<br />
Backgrounds, opacities, etc., as the properties of that component. The core component will then use these properties<br />
(settings) to determine the appropriate renderers to use in painting its various aspects. However, it is also completely<br />
possible to create unique GUI controls with highly customized visual representation.<br />
Configurable<br />
Swing's heavy reliance on runtime mechanisms and indirect composition patterns allows it to respond at runtime to<br />
fundamental changes in its settings. For example, a Swing-based application can change its look and feel at runtime.<br />
Further, users can provide their own look and feel implementation, which allows for uniform changes in the look and<br />
feel of existing Swing applications without any programmatic change to the application code.<br />
Lightweight UI<br />
Swing's configurability is a result of a choice not to use the native host OS's GUI controls for displaying itself.<br />
Swing "paints" its controls programmatically through the use of Java 2D APIs, rather than calling into a native user<br />
interface toolkit. Thus, a Swing component does not have a corresponding native OS GUI component, and is free to<br />
render itself in any way that is possible with the underlying graphics APIs.<br />
However, at its core every Swing component relies on an AWT container, since (Swing's) JComponent extends<br />
(AWT's) Container. This allows Swing to plug into the host OS's GUI management framework, including the crucial<br />
device/screen mappings and user interactions, such as key presses or mouse movements. Swing simply "transposes"<br />
its own (OS agnostic) semantics over the underlying (OS specific) components. So, for example, every Swing<br />
component paints its rendition on the graphic device in response to a call to component.paint(), which is defined in<br />
(AWT) Container. But unlike AWT components, which delegated the painting to their OS-native "heavyweight"<br />
widget, Swing components are responsible for their own rendering.<br />
This transposition and decoupling is not merely visual, and extends to Swing's management and application of its<br />
own OS-independent semantics for events fired within its component containment hierarchies. Generally speaking,
Swing (Java) 286<br />
the Swing Architecture delegates the task of mapping the various flavors of OS GUI semantics onto a simple, but<br />
generalized, pattern to the AWT container. Building on that generalized platform, it establishes its own rich and<br />
complex GUI semantics in the form of the JComponent model.<br />
Loosely-Coupled and MVC<br />
The Swing library makes heavy use of the Model/<strong>View</strong>/Controller software design pattern [1] , which conceptually<br />
decouples the data being viewed from the user interface controls through which it is viewed. Because of this, most<br />
Swing components have associated models (which are specified in terms of Java interfaces), and the programmer can<br />
use various default implementations or provide their own. The framework provides default implementations of<br />
model interfaces for all of its concrete components. The typical use of the Swing framework does not require the<br />
creation of custom models, as the framework provides a set of default implementations that are transparently, by<br />
default, associated with the corresponding JComponent child class in the Swing library. In general, only complex<br />
components, such as tables, trees and sometimes lists, may require the custom model implementations around the<br />
application-specific data structures. To get a good sense of the potential that the Swing architecture makes possible,<br />
consider the hypothetical situation where custom models for tables and lists are wrappers over DAO and/or EJB<br />
services.<br />
Typically, Swing component model objects are responsible for providing a concise interface defining events fired,<br />
and accessible properties for the (conceptual) data model for use by the associated JComponent. Given that the<br />
overall MVC pattern is a loosely-coupled collaborative object relationship pattern, the model provides the<br />
programmatic means for attaching event listeners to the data model object. Typically, these events are model centric<br />
(ex: a "row inserted" event in a table model) and are mapped by the JComponent specialization into a meaningful<br />
event for the GUI component.<br />
For example, the JTable has a model called TableModel that describes an interface for how a table would access<br />
tabular data. A default implementation of this operates on a two-dimensional array.<br />
The view component of a Swing JComponent is the object used to graphically "represent" the conceptual GUI<br />
control. A distinction of Swing, as a GUI framework, is in its reliance on programmatically-rendered GUI controls<br />
(as opposed to the use of the native host OS's GUI controls). Prior to Java 6 Update 10, this distinction was a source<br />
of complications when mixing AWT controls, which use native controls, with Swing controls in a GUI (see Mixing<br />
AWT and Swing components).<br />
Finally, in terms of visual composition and management, Swing favors relative layouts (which specify the positional<br />
relationships between components) as opposed to absolute layouts (which specify the exact location and size of<br />
components). This bias towards "fluid"' visual ordering is due to its origins in the applet operating environment that<br />
framed the design and development of the original Java GUI toolkit. (Conceptually, this view of the layout<br />
management is quite similar to that which informs the rendering of HTML content in browsers, and addresses the<br />
same set of concerns that motivated the former.)
Swing (Java) 287<br />
Relationship to AWT<br />
Since early versions of Java, a portion of the Abstract Window Toolkit<br />
(AWT) has provided platform-independent APIs for user interface<br />
components. In AWT, each component is rendered and controlled by a<br />
native peer component specific to the underlying windowing system.<br />
By contrast, Swing components are often described as lightweight<br />
because they do not require allocation of native resources in the<br />
operating system's windowing toolkit. The AWT components are<br />
referred to as heavyweight components.<br />
Much of the Swing API is generally a complementary extension of the<br />
AWT rather than a direct replacement. In fact, every Swing lightweight<br />
interface ultimately exists within an AWT heavyweight component<br />
because all of the top-level components in Swing (JApplet, JDialog,<br />
JFrame, and JWindow) extend an AWT top-level container. Prior to<br />
Java 6 Update 10, the use of both lightweight and heavyweight<br />
AWT and Swing class hierarchy<br />
components within the same window was generally discouraged due to Z-order incompatibilities. However, later<br />
version of Java have fixed these issues, and both Swing and AWT components can now be used in one GUI without<br />
Z-order issues.<br />
The core rendering functionality used by Swing to draw its lightweight components is provided by Java 2D, another<br />
part of JFC.<br />
Relationship to SWT<br />
The Standard Widget Toolkit (SWT) is a competing toolkit originally developed by IBM and now maintained by the<br />
Eclipse community. SWT's implementation has more in common with the heavyweight components of AWT. This<br />
confers benefits such as more accurate fidelity with the underlying native windowing toolkit, at the cost of an<br />
increased exposure to the native platform in the programming model.<br />
The advent of SWT has given rise to a great deal of division among Java desktop developers, with many strongly<br />
favoring either SWT or Swing. Sun's development on Swing continues to focus on platform look and feel (PLAF)<br />
fidelity with each platform's windowing toolkit in the approaching Java SE 7 release (as of December 2006).<br />
There has been significant debate and speculation about the performance of SWT versus Swing; some hinted that<br />
SWT's heavy dependence on JNI would make it slower when the GUI component and Java need to communicate<br />
data, but faster at rendering when the data model has been loaded into the GUI, but this has not been confirmed<br />
either way [2] . A fairly thorough set of benchmarks concluded that neither Swing nor SWT clearly outperformed the<br />
other in the general case [3] .<br />
SWT serves the Windows platform very well but is considered by some to be less effective as a technology for<br />
cross-platform development. By using the high-level features of each native windowing toolkit, SWT returns to the<br />
issues seen in the mid 90's (with toolkits like zApp, Zinc, XVT and IBM/Smalltalk) where toolkits attempted to<br />
mask differences in focus behaviour, event triggering and graphical layout. Failure to match behavior on each<br />
platform can cause subtle but difficult-to-resolve bugs that impact user interaction and the appearance of the GUI.
Swing (Java) 288<br />
Examples<br />
A basic example<br />
The following is a rather simple Swing-based program. It displays a window (a JFrame) containing a label and a<br />
button.<br />
Notice how all instantiation and handling of all Swing components are done on the Event Dispatch Thread by use of<br />
the method EventQueue.invokeLater(Runnable)) and an anonymous Runnable class (see Swing and thread safety).<br />
// Import the swing and AWT classes needed<br />
import java.awt.EventQueue;<br />
import java.awt.FlowLayout;<br />
import javax.swing.JButton;<br />
import javax.swing.JFrame;<br />
import javax.swing.JLabel;<br />
/**<br />
* Basic Swing example.<br />
*/<br />
public class SwingExample {<br />
public static void main(String[] args) {<br />
on the<br />
// Make sure all Swing/AWT instantiations and accesses are done<br />
// Event Dispatch Thread (EDT)<br />
EventQueue.invokeLater(new Runnable() {<br />
@Override<br />
"decorations", i.e.<br />
contained<br />
else the<br />
public void run() {<br />
// Create a JFrame, which is a Window with<br />
// title, border and close-button<br />
JFrame f = new JFrame("Swing Example Window");<br />
// Set a simple Layout Manager that arranges the<br />
// Components<br />
f.setLayout(new FlowLayout());<br />
// Add some Components<br />
f.add(new JLabel("Hello, world!"));<br />
f.add(new JButton("Press me!"));<br />
// "Pack" the window, making it "just big enough".<br />
f.pack();<br />
// Set the default close operation for the window, or
Swing (Java) 289<br />
}<br />
window<br />
}<br />
See also<br />
});<br />
}<br />
• Abstract Window Toolkit<br />
• Layout manager<br />
// program won't exit when clicking close button<br />
// (The default is HIDE_ON_CLOSE, which just makes the<br />
// invisible, and thus doesn't exit the app)<br />
f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);<br />
// Set the visibility as true, thereby displaying it<br />
f.setVisible(true);<br />
• SwingLabs - Extensions to Swing that might be included in Swing in the future<br />
• Standard Widget Toolkit A third party competing widget toolkit resembling the Abstract Window Toolkit in<br />
function.<br />
References<br />
• Matthew Robinson, Pavel Vorobiev: Swing, Second Edition, Manning, ISBN 1-930110-88-X<br />
• David M. Geary: Graphic Java 2, Volume 2: Swing, Prentice Hall, ISBN 0-13-079667-0<br />
• John Zukowski: The Definitive Guide to Java Swing, Third Edition, Apress, ISBN 1-590-59447-9<br />
• James Elliott, Robert Eckstein, Marc Loy, David Wood, Brian Cole: Java Swing, O'Reilly, ISBN 0-596-00408-7<br />
• Kathy Walrath, Mary Campione, Alison Huml, Sharon Zakhour: The JFC Swing Tutorial: A Guide to<br />
Constructing GUIs, Addison-Wesley Professional, ISBN 0-201-91467-0<br />
• Joshua Marinacci, Chris Adamson: Swing Hacks, O'Reilly, ISBN 0-596-00907-0<br />
External links<br />
• The Swing API documentation [7]<br />
• The Swing architecture [4]<br />
References<br />
[1] Swing as MVC (http:/ / java. sun. com/ products/ jfc/ tsc/ articles/ architecture/ )<br />
[2] Swing vs. SWT Performance - Have a Look at the Call Stacks (http:/ / www. javalobby. org/ java/ forums/ t65168. html)<br />
[3] Igor, Križnar (2005-05-10). "SWT Vs. Swing Performance Comparison" (http:/ / cosylib. cosylab. com/ pub/ CSS/ DOC-SWT_Vs.<br />
_Swing_Performance_Comparison. pdf). cosylab.com. . Retrieved 2008-05-24. "It is hard to give a rule-of-thumb where SWT would<br />
outperform Swing, or vice versa. In some environments (e.g., Windows), SWT is a winner. In others (Linux, VMware hosting Windows), Swing<br />
and its redraw optimization outperform SWT significantly. Differences in performance are significant: factors of 2 and more are common, in<br />
either direction."<br />
[4] http:/ / java. sun. com/ products/ jfc/ tsc/ articles/ architecture/
SwingLabs 290<br />
SwingLabs<br />
Developer(s) Sun<br />
Operating<br />
system<br />
Cross-platform<br />
Type Widget library<br />
License LGPL<br />
Website<br />
swinglabs.dev.java.net [1]<br />
swingLabs is a Sun Open source project proposing extensions to the Java Swing GUI toolkit. Available components<br />
include:<br />
• Sorting, filtering, highlighting for tables, trees, and lists<br />
• Find/search<br />
• Auto-completion<br />
• Login/authentication framework<br />
• TreeTable component<br />
• Collapsible panel component<br />
• Date picker component<br />
• Tip-of-the-Day component<br />
The aim of the project is to experiment new or enhanced GUI functionalities that are required by Rich client<br />
applications. It acts as a testbed for ideas related to client side technologies.<br />
Integration into Java API<br />
Successful project components are eventually incorporated into the core Swing toolkit for future Java versions,<br />
although API compatibility is not guaranteed. Examples of these are:<br />
• the GroupLayout manager in Java SE 6 [2] .<br />
• incorporation of the SystemTray in Java SE 6.<br />
• the new Desktop class in Java SE 6, which allows to launch easily associated applications registered on the native<br />
desktop, as for example : launching the user-default browser, launching the user-default mail client, launching a<br />
registered application to open, edit or print a specified file.<br />
License<br />
The project is distributed under a LGPL license.<br />
Sub-projects<br />
The swingLabs project [1] is divided into several sub-projects. For example :<br />
• swingX [3] : provides extensions to the Java Swing GUI toolkit.<br />
• JDIC [4] : as for JDesktop Integration Components, a project aims to make Java applications first-class citizens of<br />
current desktop platforms without sacrificing platform independence. Its mission is to enable seamless<br />
desktop/Java integration.<br />
• nimbus [5] : a Look and feel using synth, the Java skinnable look and feel.<br />
• swingLayout [6] : the home of the GroupLayout manager, before inclusion in Java SE 6.
SwingLabs 291<br />
• JDNC [7] : Contained components that allow to build easily Swing-based rich-client Java applications. The project<br />
is no more actively maintained. It has been replaced by Swing Application Framework (JSR 296)<br />
• scenegraph [8] : A library that provide 2D Scene graph functionality to Java 2D, including Swing widgets. This<br />
library is used internally by the JavaFX Script language.<br />
• PDFRenderer [9] : A 100% pure Java PDF viewer library.<br />
See also<br />
• Swing (Java)<br />
• Swing Application Framework<br />
• SwingWorker<br />
External links<br />
• swingLabs project home page [1]<br />
• swingx project home page [3]<br />
• swingx project tutorials and documents [10]<br />
• swingx 0.7 version javadoc [11]<br />
References<br />
[1] https:/ / swinglabs. dev. java. net/<br />
[2] GroupLayout was initially developed in conjunction with Matisse, the GUI builder of NetBeans.<br />
[3] https:/ / swingx. dev. java. net/<br />
[4] https:/ / jdic. dev. java. net/<br />
[5] https:/ / nimbus. dev. java. net/<br />
[6] https:/ / swing-layout. dev. java. net/<br />
[7] https:/ / jdnc. dev. java. net/<br />
[8] https:/ / scenegraph. dev. java. net/<br />
[9] https:/ / pdf-renderer. dev. java. net/<br />
[10] http:/ / swinglabs. org/ docs. jsp<br />
[11] http:/ / www. javadesktop. org/ swinglabs/ build/ weekly/ latest/ swingx-HEAD/ javadoc/ index. html
Synth Look and Feel 292<br />
Synth Look and Feel<br />
synth is a skinnable Java look and feel, which is configured with an XML property file.<br />
According to Sun, goals for synth were:<br />
• Enable to create custom look without writing any code.<br />
• Allow appearance to be configured from images.<br />
• Provide the ability to customize the look of a component based on its named properties.<br />
• Provide a centralized point for overriding the look of all components.<br />
• Enable custom rendering based on images, or user-defined SynthPainters.<br />
History<br />
synth is available beginning with version J2SE 5.0 of Java (see Java version history).<br />
Java SE 6 Update 10 release and newer contain Nimbus, a cross-platform Look and Feel implemented with Synth.<br />
However, for backwards compatibility, Metal is still the default Swing look and feel. [1]<br />
Architecture<br />
Synth is a skinnable look and feel in which all painting is delegated to the components, without having to write any<br />
code (see Synth Look and Feel).<br />
However synth does not provide a default look, and components that are not defined in the synth XML file will not<br />
be painted. It is however possible to assign a default style to all other widgets, and customize styles for some specific<br />
widgets only.<br />
Example<br />
The following XML declaration defines a style named textfield and binds it to all text fields. The defaultStyle allows<br />
to set a default font, foreground and background colors to all other widgets.<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
Synth Look and Feel 293<br />
Supposing that the XML declaration is defined in a file named synthExample.xml, the following code loads the XML<br />
definition file and sets the current look and feel to synth (loading a synth Look and Feel is done using the load<br />
method of the SynthLookAndFeel class):<br />
SynthLookAndFeel laf = new SynthLookAndFeel();<br />
laf.load(new File("synthExample.xml").toURL());<br />
UIManager.setLookAndFeel(laf);<br />
See also<br />
• Swing, the standard cross-platform widget toolkit for Java<br />
• Pluggable look and feel<br />
• Look and Feel in Widget Toolkits<br />
External links<br />
• Synth Look and Feel API documentation<br />
• synth file format [2]<br />
• synth tutorial [3]<br />
• another synth tutorial [4]<br />
• nimbus home page [5]<br />
• Synthetica - commercial Synth Look and Feel with many different themes [8]<br />
• EaSynth Look And Feel Designer - commercial IDE for Synth based look and feel [5]<br />
References<br />
[1] "Nimbus Look and Feel (The Java Tutorials > Creating a GUI With JFC/Swing > Modifying the Look and Feel)" (http:/ / java. sun. com/<br />
docs/ books/ tutorial/ uiswing/ lookandfeel/ nimbus. html). Sun Microsystems. . Retrieved 2010-07-01.<br />
[2] http:/ / java. sun. com/ j2se/ 1. 5. 0/ docs/ api/ javax/ swing/ plaf/ synth/ doc-files/ synthFileFormat. html<br />
[3] http:/ / javadesktop. org/ articles/ synth/<br />
[4] http:/ / www. ibm. com/ developerworks/ java/ library/ j-synth/<br />
[5] http:/ / www. easynth. com/ products/ EaSynthLookAndFeelDesigner. html
TeachScheme! 294<br />
TeachScheme!<br />
The TeachScheme! project is an outreach effort of the PLT research group. The goal is to train college faculty, high<br />
school teachers and possibly even middle school teachers in programming and computing.<br />
History<br />
Matthias Felleisen and PLT started the effort in 1995 (January, one day after the POPL symposium) in response to<br />
observations of his Rice freshmen students and the algebra curriculum of local public schools. His objective was to<br />
use functional programming to bring mathematics alive and to help inject design knowledge into the introductory<br />
computer science curriculum.<br />
The group raised funds from several private foundations, the US Department of Education, and the National Science<br />
Foundation to create<br />
• software appropriate for novices in functional programming<br />
• courseware (curricula, lecture notes, exercises, mini-projects)<br />
• teacher training camps.<br />
Over ten years, it ran several dozen one-week workshops for some 550 teachers. In 2005, the TeachScheme! project<br />
ran an Anniversary workshop where two dozen teachers presented their work with students.<br />
In 2010, PLT renamed its major programming language Racket. The name for DrScheme, the IDE, was changed to<br />
DrRacket.<br />
Functional Programming, Computing and Algebra<br />
The starting point of TeachScheme! is the observation that students are computers in grade school courses on<br />
arithmetic and middle/high school courses on pre/algebra. Teachers program them with rules and run specific<br />
problems via exercises. The key is that students execute purely functional programs.<br />
If we can turn students into teachers that create functional programs and run them on computers, we can reinforce<br />
this content and show students how writing down mathematics and how writing down functional programs creates<br />
lively animated scenes and even computer games.<br />
Here is an example:<br />
(require 2htdp/universe)<br />
(require 2htdp/image)<br />
;; create an image from the current time<br />
(define (create-image t)<br />
(place-image APPLE 50 (* 1/10 t t) SPACE))<br />
;; names for basic images<br />
(define APPLE (circle 3 "solid" "red"))<br />
(define SPACE (empty-scene 100 100))<br />
(animate create-image)<br />
This short program simulates an apple falling from the top to the bottom of a small white canvas. It consists of three<br />
parts:
TeachScheme! 295<br />
• a function definition for create-image, which is a one-line function in mathematics, assuming an algebra of<br />
images with place-image, circle, and empty-scene have been introduced;<br />
• two abbreviations, where names are equated with some value, just as in "let x be 5" in an algebra text; and<br />
• one line for running the program.<br />
A teacher can explain create-image as easily as any ordinary function in an algebra course. For example, one can<br />
first draw a table with two rows and n columns where each column contains t at the top and an appropriate image at<br />
the bottom. That is, if the numbers increase from left to right, then on each image the red dot is a little bit lower.<br />
Finally the animate line applies the given function, create-image, at the rate of 28 ticks per second to 0, 1, 2, 3, and<br />
so on. The resulting images are displayed on the computer monitor at the same pace. That's how movies are made.<br />
The background needed for such an example is little more than knowledge about making movies, about the algebra<br />
of pictures in DrRacket (which is like the one for numbers), and minimal pre-algebra. The TeachScheme! project<br />
claims, however, that children would have more fun with such "live" functions than with algebraic expressions that<br />
count the number of garden tiles [see Prentice Hall books for grades 8-9].<br />
The TeachScheme! project proposes that both traditional mathematics as well as science courses could benefit from<br />
an integration of this form of programming. In contrast to the traditional Basic or Visual Basic blocks in such books,<br />
a Racket program consists of as many lines as the mathematics. Moving between the mathematics and the program is<br />
thus straightforward. Better still, the meaning of the two are the same. DrRacket's algebraic stepper can illustrate<br />
how Racket evaluates the program as if it were a sixth or seventh grade student, step by step, using plain algebra.<br />
Functional Programming, Computing and Design in Programming 101<br />
For the introductory curriculum on programming, the TeachScheme! project emphasizes that courses should focus<br />
on the role of systematic design. Even if students never program again, they should see how helpful a systematic<br />
approach to problem solving is. This should help them whether they become programmers or doctors or journalists<br />
or photographers. Thus, an introductory course in programming would not be perceived as a place where students<br />
learn about the syntax of the currently fashionable (and soon-to-be-obsolete) programming languages, but a place<br />
where they can learn something widely applicable.<br />
The key design element of the TeachScheme! curriculum is the design recipe. It has two dimensions: the process<br />
dimension and the data dimension.<br />
Along the process dimension students learn that there are six steps to designing a (simple) program, before they can<br />
run it and others can use it:<br />
• problem analysis with the goal of describing the classes of data that go into the program and come out;<br />
• the reformulation of the problem statement as a concise purpose statement;<br />
• the creation of examples that illustrate the purpose statement and that serve as criteria for success;<br />
• the organization of givens, also called a template or inventory;<br />
• coding;<br />
• and the creation of a test suite from examples to ensure the program works properly on small inputs.<br />
Note that, as in test-driven development, test cases are written before coding, as part of requirements analysis, rather<br />
than afterward as part of testing.<br />
Almost any human endeavour can benefit from clearly understanding the problem, defining criteria for success,<br />
analyzing the available resources/givens, developing a proposed solution, and checking it against the criteria, in that<br />
order. A journalist, for example, benefits from a similar process: figuring out the major concepts in a story; coining a<br />
headline; lining up examples and specific data; organizing the article about the story around the givens and how the<br />
story unfolded; writing; and fact checking.<br />
The data dimension can be summarized by the maxim the shape of the data determines the shape of the code and<br />
tests. For example, if the input or output data type has three variants, a test suite should have at least one test case
TeachScheme! 296<br />
from each variant, and program code will probably contain a three-way conditional (whether explicit or hidden in a<br />
polymorphic dispatch). If the input or output data type has three fields, a test suite will have to specify values for<br />
those three fields, and program code will have to refer to those three fields. If the input or output data type has a<br />
simple base case and one or more self-referential variants, the test suite should include a base case and one or more<br />
non-base cases, and the program code will probably have a base case and one or more self-referential cases,<br />
isomorphic to the data type. The technique of recursion, rather than being scary and mysterious, is simply the<br />
application of already-learned techniques to a self-referential data type.<br />
Organizing the givens is the task of translating the descriptions of data into a program skeleton. Each form of<br />
description determines a specific form of program organization. The transformation is nearly mechanical and helps<br />
the students focus on the creative part of the task.<br />
How to Design Programs is the text book authored by the core of the TeachScheme! group.<br />
TeachScheme! and choice of programming language<br />
The name TeachScheme! appears to imply that this design recipe requires Scheme (now Racket) and is only<br />
teachable with DrRacket. Neither conclusion is true, however. The TeachScheme! members and their students have<br />
successfully applied the design recipe in Assembly, C, Java, ML, Python, and other programming languages, not to<br />
speak of poetry, geometry, and biology courses.<br />
To get started the TeachScheme! project has produced three essential elements:<br />
• a series of successively more powerful and permissive teaching languages, which are dialects of Racket, matched<br />
to the design recipe but with error reporting matched to the student's level (for example, many things that are legal<br />
in standard Racket, but which a beginning student doesn't need, are flagged as errors in the Beginning Student<br />
level);<br />
• a beginner-friendly, freely-downloadable, pedagogic programming environment, DrRacket, that enforces these<br />
language levels;<br />
• a curriculum, encoded mostly in the book HTDP and its (draft) successor HtDP 2nd Edition [1]<br />
Their choice of Racket reflects their belief that Racket is a good language for a small team with little funding (in<br />
comparison to Java) to validate their conjectures. The PLT group has always tried to ensure, however, that the ideas<br />
remain portable to other contexts.<br />
From TeachScheme! to ReachJava<br />
Over the past few years, the team has also created a second part of the curriculum. It demonstrates how the same<br />
design recipe ideas apply to a complex object-oriented programming language, such as Java. This phase of the<br />
curriculum applies the same design recipe to Java, initially in a functional paradigm, then introducing object-oriented<br />
concepts such as polymorphism and inheritance, and then introducing the imperative techniques that are idiomatic in<br />
mainstream Java.<br />
A part of the team has a grant from the National Science Foundation for conducting field tests in colleges and high<br />
schools. Professional-development workshops took place in the summer of 2007, 2008, 2009, and 2010. This part of<br />
the project is dubbed ReachJava; the accompanying book is tentatively titled "How to Design Classes."
TeachScheme! 297<br />
TeachScheme! and Bootstrap<br />
Recently PLT at Northeastern University and Citizen Schools from Boston [2] have joint efforts to reach out to inner<br />
city students with after-school programs. Citizen Schools is a nation-wide organization that matches volunteers with<br />
after-school program sites and gets them started with scripted curricula. They have translated the TeachScheme!<br />
material into a sixth-grade curriculum and tested it with great success in Boston. [3] The effect on the mathematics<br />
courses of this program has encouraged Microsoft to fund a national scale-up effort, developing materials for<br />
training teachers and creating sites in Texas, California, and other volunteer cities.<br />
External links<br />
• TeachScheme! [4]<br />
• Racket [5]<br />
• How to Design Programs [6]<br />
• Bootstrap [7]<br />
References<br />
[1] http:/ / www. ccs. neu. edu/ home/ matthias/ HtDP2e/<br />
[2] http:/ / www. citizenschools. org/ boston/<br />
[3] http:/ / www. cs. brown. edu/ ~sk/ Publications/ Talks/ Moby-Bootstrap/<br />
[4] http:/ / www. teach-scheme. org/<br />
[5] http:/ / www. racket-lang. org/<br />
[6] http:/ / www. htdp. org/<br />
[7] http:/ / www. bootstrapworld. org/<br />
The Java Posse<br />
The Java Posse is a podcast of news,<br />
discussion, and interviews about the<br />
Java programming language and<br />
associated Java technologies. The four<br />
regular contributors are Tor Norbye<br />
(Sun Microsystems), Carl Quinn<br />
(Google), Dick Wall (Google) and Joe<br />
Nuxoll (Apple Inc.). [1] By January<br />
2007, the estimated listenership was<br />
between 7- and 10,000 people. [2]<br />
The podcast was begun in September<br />
2005 and was a successor to an earlier<br />
short-lived Java podcast produced by<br />
Wall called "JavaCast", cohosted with<br />
Brandon Werner. [1] As of December<br />
2007, over 150 episodes of The Java<br />
(Left to right) Tor Norbye, Joe Nuxoll, Carl Quinn and Dick Wall recording Java Posse<br />
episode #96 in December 2006<br />
Posse have been recorded. The group has also organized the "Java Posse Roundup", an unconference held in Crested<br />
Butte, Colorado in 2007 and organized by Bruce Eckel. Sessions from the roundup have been published as episodes<br />
of the podcast.<br />
Quinn and Wall also co-host the Google developer podcast.
The Java Posse 298<br />
External links<br />
• The Java Posse web site [3] .<br />
References<br />
[1] Chris Adamson, "The Java Podcasters" (http:/ / www. onjava. com/ pub/ a/ onjava/ 2006/ 01/ 25/ java-podcasters. html), 25 January 2006<br />
[2] Chris Adamson, Editor's Daily Blog (http:/ / weblogs. java. net/ blog/ editors/ archives/ 2007/ 01/ hold_on. html), java.net, 25 January 2007<br />
[3] http:/ / javaposse. com/<br />
Unified Expression Language<br />
The Java Unified Expression Language is a special purpose programming language mostly used in Java web<br />
applications for embedding expressions into web pages. The Java specification writers and expert groups of the Java<br />
web-tier technologies have worked on a unified expression language which is now part of the JSP 2.1 specification<br />
(JSR-245). While the expression language is part of the JSP specification, it does not depend on the JSP specification<br />
and therefore it is available for a variety of technologies.<br />
History<br />
The expression language started out as part of the JavaServer Pages Standard Tag Library (JSTL) and was originally<br />
called SPEL (Simplest Possible Expression Language). It offered a simple way to access data objects. Over the<br />
years, the expression language has evolved to include more advanced functionality and it was included in the JSP 2.0<br />
specification, because of the popularity and success in the community.<br />
During the development of JSP 2.0, the JavaServer Faces technology was released which also needed an expression<br />
language, but the expression language defined in the JSP 2.0 specification didn't satisfy all the needs for<br />
development with JSF technology. The most obvious limitation is that its expressions are evaluated immediately.<br />
And also, the JSF components need a way to invoke methods on server-side objects. A more powerful language was<br />
created with the following new features:<br />
• Deferred expressions, which are not immediately evaluated<br />
• Expressions that can set as well as get data<br />
• Method expressions, which can invoke methods<br />
The new expression language worked well for the purposes of JSF. But developers had problems when integrating<br />
the JSP EL with the JSF EL because of conflicts. Because of these incompatibilities, the unified expression language<br />
initiative was started to unify these expression languages. As of JSP 2.1, the expression languages of JSP 2.0 and JSF<br />
1.1 have been merged into a single unified expression language (EL 2.1).<br />
Features<br />
The new unified EL is a union of the JSP and JSF expression languages. In addition to the features already available<br />
in the JSP EL, the unified EL has the following features:<br />
• Deferred evaluation<br />
• Support for expressions that can set values and expressions that can invoke methods<br />
• A pluggable API for resolving expressions
Unified Expression Language 299<br />
Implementations<br />
JUEL is an open-source implementation of the Unified Expression Language. It is considered stable and feature<br />
complete and is licensed under the Apache License 2.0. JUEL is also suitable for use in non-JSP applications.<br />
External links<br />
• JSR 245: JavaServer Pages 2.1 [1]<br />
• Unified Expression Language [2] (article at Sun Developer Network (SDN)<br />
• Unified Expression Language for JSP and JSF [3] (article at java.net)<br />
• JUEL [4] is an implementation of the Unified Expression Language (EL), specified as part of the JSP 2.1 standard<br />
(JSR-245).<br />
References<br />
[1] http:/ / www. jcp. org/ en/ jsr/ detail?id=245<br />
[2] http:/ / java. sun. com/ products/ jsp/ reference/ techart/ unifiedEL. html<br />
[3] http:/ / today. java. net/ pub/ a/ today/ 2006/ 03/ 07/ unified-jsp-jsf-expression-language. html<br />
[4] http:/ / juel. sourceforge. net<br />
Java Virtual Machine<br />
A Java Virtual Machine (JVM) enables a set of computer software programs and data structures to use a virtual<br />
machine model for the execution of other computer programs and scripts. The model used by a JVM accepts a form<br />
of computer intermediate language commonly referred to as Java bytecode. This language conceptually represents<br />
the instruction set of a stack-oriented, capability architecture. Sun has claimed there are over 4.5 billion<br />
JVM-enabled devices. [1]<br />
Overview<br />
A JVM can also be used to implement programming languages other than Java. For example, Ada source code can<br />
be compiled to Java bytecode, which may then be executed by a JVM. JVMs can also be released by other<br />
companies besides Sun (the developer of Java) — JVMs using the "Java" trademark may be developed by other<br />
companies as long as they adhere to the JVM specification published by Sun (and related contractual obligations).<br />
Java was conceived keeping in mind the concept of WORA ‘write once and run anywhere’. This is possible using the<br />
Java Virtual Machine. The JVM is the environment in which java programs execute. It is software that is<br />
implemented on top of real hardware and operating system.<br />
JVM is a crucial component of the Java Platform, and because JVMs are available for many hardware and software<br />
platforms, Java can be both middleware and a platform in its own right — hence the trademark write once, run<br />
anywhere. The use of the same bytecode for all platforms allows Java to be described as "compile once, run<br />
anywhere", as opposed to "write once, compile anywhere", which describes cross-platform compiled languages. A<br />
JVM also enables such features as Automated Exception Handling, which provides 'root-cause' debugging<br />
information for every software error (exception), independent of the source code.<br />
A JVM is distributed along with a set of standard class libraries that implement the Java API (Application<br />
Programming Interface). An API is provided by a computer system, library, or application in order to allow data<br />
exchange between them. APIs are bundled together as the Java Runtime Environment.
Java Virtual Machine 300<br />
Execution environment<br />
Programs intended to run on a JVM must be compiled into a standardized portable binary format, which typically<br />
comes in the form of .class files. A program may consist of many classes in different files. For easier distribution of<br />
large programs, multiple class files may be packaged together in a .jar file (short for Java archive).<br />
The JVM runtime executes .class or .jar files, emulating the JVM instruction set by interpreting it, or using a<br />
just-in-time compiler (JIT) such as Sun's HotSpot. JIT compiling, not interpreting, is used in most JVMs today to<br />
achieve greater speed. Ahead-of-time compilers that enable the developer to precompile class files into native code<br />
for a particular platforms also exist.<br />
Like most virtual machines, the Java Virtual Machine has a stack-based architecture akin to a<br />
microcontroller/microprocessor. However, the JVM also has low-level support for Java-like classes and methods,<br />
which amounts to a highly idiosyncratic memory model and capability-based architecture.<br />
The JVM, which is the instance of the 'JRE' (Java Runtime Environment), comes into action when a Java program is<br />
executed. When execution is complete, this instance is garbage collected. JIT is the part of the JVM that is used to<br />
speed up the execution time. JIT compiles parts of the byte code that have similar functionality at the same time, and<br />
hence reduces the amount of time needed for compilation.<br />
JVM languages<br />
Versions of non-JVM languages<br />
Language On JVM<br />
Erlang Erjang<br />
JavaScript Rhino<br />
PHP Quercus<br />
Python Jython<br />
REXX<br />
NetRexx [2]<br />
Ruby JRuby<br />
Tcl Jacl<br />
Languages designed expressly for JVM<br />
MIDletPascal<br />
Clojure<br />
Groovy<br />
Scala<br />
Although the JVM was primarily aimed at running compiled Java programs, many other languages can now run on<br />
top of it [3] . The JVM has currently no built-in support for dynamically typed languages: the existing JVM<br />
instruction set is statically typed, [4] although the JVM can be used to implement interpreters for dynamic languages.<br />
The JVM has a limited support for dynamically modifying existing classes and methods; this currently only works in<br />
a debugging environment. However, new classes and methods can be added dynamically. Built-in support for<br />
dynamic languages is currently planned for Java 7. [5]
Java Virtual Machine 301<br />
Bytecode verifier<br />
A basic philosophy of Java is that it is inherently "safe" from the standpoint that no user program can "crash" the<br />
host machine or otherwise interfere inappropriately with other operations on the host machine, and that it is possible<br />
to protect certain functions and data structures belonging to "trusted" code from access or corruption by "untrusted"<br />
code executing within the same JVM. Furthermore, common programmer errors that often lead to data corruption or<br />
unpredictable behavior such as accessing off the end of an array or using an uninitialized pointer are not allowed to<br />
occur. Several features of Java combine to provide this safety, including the class model, the garbage-collected heap,<br />
and the verifier.<br />
The JVM verifies all bytecode before it is executed. This verification consists primarily of three types of checks:<br />
• Branches are always to valid locations<br />
• Data is always initialized and references are always type-safe<br />
• Access to "private" or "package private" data and methods is rigidly controlled.<br />
The first two of these checks take place primarily during the "verification" step that occurs when a class is loaded<br />
and made eligible for use. The third is primarily performed dynamically, when data items or methods of a class are<br />
first accessed by another class.<br />
The verifier permits only some bytecode sequences in valid programs, e.g. a jump (branch) instruction can only<br />
target an instruction within the same function or method. Furthermore, the verifier ensures that any given instruction<br />
operates on a fixed stack location [6] , allowing the JIT compiler to transform stack accesses into fixed register<br />
accesses. Because of this, the fact that JVM is a stack architecture does not imply a speed penalty for emulation on<br />
register-based architectures when using a JIT compiler. In the face of the code-verified JVM architecture, it makes<br />
no difference to a JIT compiler whether it gets named imaginary registers or imaginary stack positions that need to<br />
be allocated to the target architecture's registers. In fact, code verification makes the JVM different from a classic<br />
stack architecture whose efficient emulation with a JIT compiler is more complicated and typically carried out by a<br />
slower interpreter.<br />
Code verification also ensures that arbitrary bit patterns cannot get used as an address. Memory protection is<br />
achieved without the need for a Memory management unit (MMU). Thus, JVM is an efficient way of getting<br />
memory protection on simple architectures that lack an MMU. This is analogous to managed code in Microsoft's<br />
.NET Common Language Runtime, and conceptually similar to capability architectures such as the Plessey 250, and<br />
IBM System/38.<br />
Bytecode instructions<br />
The JVM has instructions for the following groups of tasks:<br />
• Load and store<br />
• Arithmetic<br />
• Type conversion<br />
• Object creation and manipulation<br />
• Operand stack management (push / pop)<br />
• Control transfer (branching)<br />
• Method invocation and return<br />
• Throwing exceptions<br />
• Monitor-based concurrency<br />
The aim is binary compatibility. Each particular host operating system needs its own implementation of the JVM and<br />
runtime. These JVMs interpret the byte code semantically the same way, but the actual implementation may be<br />
different. More complicated than just the emulation of bytecode is compatible and efficient implementation of the<br />
Java core API that has to be mapped to each host operating system.
Java Virtual Machine 302<br />
Secure execution of remote code<br />
A virtual machine architecture allows very fine-grained control over the actions that code within the machine is<br />
permitted to take. This is designed to allow safe execution of untrusted code from remote sources, a model used by<br />
Java applets. Applets run within a VM incorporated into a user's browser, executing code downloaded from a remote<br />
HTTP server. The remote code runs in a restricted "sandbox", which is designed to protect the user from<br />
misbehaving or malicious code. Publishers can purchase a certificate with which to digitally sign applets as "safe",<br />
giving them permission to ask the user to break out of the sandbox and access the local file system, clipboard or<br />
network.<br />
C to bytecode compilers<br />
From the point of view of a compiler, the Java Virtual Machine is just another processor with an instruction set, Java<br />
bytecode, for which code can be generated. The JVM was originally designed to execute programs written in the<br />
Java language. However, the JVM provides an execution environment in the form of a bytecode instruction set and a<br />
runtime system that is general enough that it can be used as the target for compilers of other languages.<br />
Because of its close association with the Java language, the JVM performs the strict runtime checks mandated by the<br />
Java specification. That requires C to bytecode compilers to provide their own "lax machine abstraction", for<br />
instance producing compiled code that uses a Java array to represent main memory (so pointers can be compiled to<br />
integers), and linking the C library to a centralized Java class that emulates system calls. Most or all of the compilers<br />
listed below use a similar approach.<br />
Several C to bytecode compilers exist:<br />
• NestedVM [7] translates C to MIPS machine language first before converting to Java bytecode.<br />
• Cybil [8] works similarly to NestedVM but targets J2ME devices.<br />
• LLJVM [9] compiles C to LLVM IR, which is then translated to JVM bytecode.<br />
• C2J [10] is also GCC-based, but it produces intermediary Java source code before generating bytecode [11] .<br />
Supports the full ANSI C runtime.<br />
• Axiomatic Multi-Platform C [12] supports full ANSI C 1989, SWT, and J2ME CDC 1.1 for mobile devices.<br />
• Java Backend for GCC [13] , possibly the oldest project of its kind, was developed at The University of<br />
Queensland in 1999.<br />
• Javum [14] is an attempt to port the full GNU environment to the JVM, and includes one of the above compilers<br />
packaged with additional utilities.<br />
• egcs-jvm [15] appears to be an inactive project.<br />
Compilers targeting Java bytecode have been written for other programming languages, including Ada and COBOL.<br />
Licensing<br />
Starting with J2SE 5.0, changes to the JVM specification have been developed under the Java Community Process as<br />
JSR 924 [16] . As of 2006, changes to specification to support changes proposed to the class file format (JSR 202 [17] )<br />
are being done as a maintenance release of JSR 924. The specification for the JVM is published in book form, [18]<br />
known as "blue book". The preface states:<br />
We intend that this specification should sufficiently document the Java Virtual Machine to make possible<br />
compatible clean-room implementations. Sun provides tests that verify the proper operation of<br />
implementations of the Java Virtual Machine.<br />
Sun's JVM is called HotSpot. Clean-room Java implementations include Kaffe, IBM J9 and Dalvik. Sun retains<br />
control over the Java trademark, which it uses to certify implementation suites as fully compatible with Sun's<br />
specification.
Java Virtual Machine 303<br />
Heap<br />
The Java Virtual Machine heap is the area of memory used by the JVM (and specifically HotSpot) for dynamic<br />
memory allocation [19] . The heap is split up into "generations":<br />
• The young generation stores short-lived objects that are created and immediately garbage collected.<br />
• Objects that persist longer are moved to the old generation (also called the tenured generation).<br />
[20] [21]<br />
• The permanent generation (or permgen) is used for class definitions and associated metadata.<br />
There was originally no permanent generation, and objects and classes were just stored together in the same area.<br />
But as class unloading occurs much more rarely than objects are collected, moving class structures to a specific area<br />
allows significant performance improvements [20] .<br />
See also<br />
• List of Java virtual machines<br />
• Comparison of application virtual machines<br />
• Automated Exception Handling<br />
• Java performance<br />
• List of JVM languages<br />
References<br />
• Clarifications and Amendments to the Java Virtual Machine Specification, Second Edition [22] includes list of<br />
changes to be made to support J2SE 5.0 and JSR 45<br />
• JSR 45 [23] – Specifies changes to the class file format to support source-level debugging of languages such as<br />
JSP and SQLJ that are translated to Java<br />
External links<br />
• The Java Virtual Machine Specification [7]<br />
• Java implementations [24] at the Open Directory Project<br />
• Sun to build virtual machine for iPhone - ComputerWorld [25]<br />
• Java Virtual Machine Download Link [26]<br />
• JVM implementation in pure Java [27]<br />
References<br />
[1] http:/ / www. java. com/ en/ about/ Learn about Java Technology<br />
[2] 1996, possibly the first new language specifically designed to run on the JVM)<br />
[3] Tolksdorf, Robert (2005). "Languages for the Java VM" (http:/ / www. is-research. de/ info/ vmlanguages/ ). . Retrieved 2008-06-08.<br />
[4] Nutter, Charles (2007-01-03). "InvokeDynamic: Actually Useful?" (http:/ / headius. blogspot. com/ 2007/ 01/ invokedynamic-actually-useful.<br />
html). . Retrieved 2008-01-25.<br />
[5] Krill, Paul (2008-01-31). "Sun's Da Vinci Machine broadens JVM coverage" (http:/ / www. infoworld. com/ article/ 08/ 01/ 31/<br />
davinci-machine_1. html). . Retrieved 2008-02-06.<br />
[6] "The Verification process" (http:/ / java. sun. com/ docs/ books/ jvms/ second_edition/ html/ ClassFile. doc. html#9766). The Java Virtual<br />
Machine Specification. Sun Microsystems. 1999. . Retrieved 2009-05-31.<br />
[7] http:/ / nestedvm. ibex. org/<br />
[8] http:/ / cibyl. googlecode. com<br />
[9] http:/ / da. vidr. cc/ projects/ lljvm/<br />
[10] http:/ / www. novosoft-us. com/ solutions/ product_c2j. shtml<br />
[11] http:/ / tech. novosoft-us. com/ product_c2j_faq. jsp<br />
[12] http:/ / objectmix. com/ compilers/ 37664-ampc-version-1-6-2-released-c-java-class-files-compiler. html<br />
[13] http:/ / www. itee. uq. edu. au/ ~cristina/ uqbt. html#gcc-jvm<br />
[14] http:/ / sourceforge. net/ projects/ javum/
Java Virtual Machine 304<br />
[15] http:/ / sourceforge. net/ projects/ egcs-jvm/<br />
[16] JSR 924 (http:/ / www. jcp. org/ en/ jsr/ detail?id=924) – Specifies changes to the JVM specification starting with J2SE 5.0<br />
[17] JSR 202 (http:/ / www. jcp. org/ en/ jsr/ detail?id=202) – Specifies a number of changes to the class file format<br />
[18] The Java Virtual Machine Specification (http:/ / java. sun. com/ docs/ books/ vmspec/ ) (the first (http:/ / java. sun. com/ docs/ books/<br />
vmspec/ html/ VMSpecTOC. doc. html) and second (http:/ / java. sun. com/ docs/ books/ vmspec/ 2nd-edition/ html/ VMSpecTOC. doc. html)<br />
editions are also available online)<br />
[19] "Frequently Asked Questions about Garbage Collection in the Hotspot Java Virtual Machine" (http:/ / java. sun. com/ docs/ hotspot/ gc1. 4.<br />
2/ faq. html). Sun Microsystems. 6 February 2003. . Retrieved 7 February 2009.<br />
[20] Masamitsu, Jon (28 November 2006). "Presenting the Permanent Generation" (http:/ / blogs. sun. com/ jonthecollector/ entry/<br />
presenting_the_permanent_generation). . Retrieved 7 February 2009.<br />
[21] Nutter, Charles (11 September 2008). "A First Taste of InvokeDynamic" (http:/ / blog. headius. com/ 2008/ 09/ first-taste-of-invokedynamic.<br />
html). . Retrieved 7 February 2009.<br />
[22] http:/ / java. sun. com/ docs/ books/ vmspec/ 2nd-edition/ jvms-clarify. html<br />
[23] http:/ / www. jcp. org/ en/ jsr/ detail?id=45<br />
[24] http:/ / www. dmoz. org/ Computers/ Programming/ Languages/ Java/ Implementations/<br />
[25] http:/ / www. computerworld. com/ action/ article. do?command=viewArticleBasic& articleId=9067358<br />
[26] http:/ / java. com/ en/ download/ inc/ windows_new_xpi. jsp<br />
[27] http:/ / igormaznitsa. com/ projects/ mjvm/ index. html<br />
Xerlin<br />
Xerlin is an open source XML editor for the Java 2 platform [1] released under an Apache style license. [2] The project<br />
is a Java based XML modeling application written to make creating and editing XML files easier. The latest version<br />
of Xerlin is 1.3, which was released in May 2005.<br />
Project Details<br />
Xerlin contains contributions originally made to the Merlot XML editor project, the open source project on which<br />
Xerlin is based. ChannelPoint founded and hosted the Merlot XML Editor as an open source project during<br />
2000-2001. Xerlin was created to build on those foundations and in fact used some of the same developers. [3]<br />
Xerlin runs on any Java 2 virtual machine (JDK1.2.2 or higher). The application is extensible via custom editor<br />
interfaces that can be added for individual DTD's. Xerlin can validate XML against both DTDs and Schemas.<br />
See also<br />
• Exari - Project founders<br />
Further reading<br />
• "Jar Bundler User Guide: Creating an Application Package" [4] . 2006-05-23. Retrieved 2009-05-15.<br />
• Kubo, Hiroya; Masatoshi Tamamura, Takashi Kowata, Ikuyo Kaneko (2002) (in Japanese) (pdf). Supporting<br />
School Evaluations by Customizable Questionnaire Schema Sharing [5] . Retrieved 2009-05-15.<br />
• Harold, Elliotte Rusty (2003-10-02). Effective XML: 50 specific ways to improve your XML. Addison-Wesley.<br />
pp. 76 – 77. ISBN 0-321-15040-6.<br />
• Baclawski, Kenneth; Niu, Tianhua (2005-10-01). Ontologies for Bioinformatics (1st ed.). MIT Press. pp. 10, 11,<br />
34. ISBN 0-262-02591-4.<br />
• Barth, Thomas; Schüll, Anke (March 2006) (in German, English). Grid Computing: Konzepte, Technologien,<br />
Anwendungen (1st ed.). Germany: <strong>View</strong>eg+Teubner. pp. 118, 122, 123, 132. ISBN 3-8348-0033-3.<br />
• Magnus, Jørgen Barsett (December 2007). Metabolic Engineering of the Valine Pathway in Corynebacterium<br />
Glutamicum - Analysis and Modelling. Germany: Forschungszentrum Jülich. p. 16. ISBN 3-89336-499-4.
Xerlin 305<br />
• Steinbrenner, Eugen (February 2009) (in German). Internetbasierte interaktive Lernmodule zur hierarchischen<br />
Datenstrukturierung und zur Linienglättung. Germany: Grin Verlag. pp. 9, 88. ISBN 3-640-27276-5.<br />
External links<br />
• Official website [6]<br />
• Xerlin [7] at SourceForge.net<br />
References<br />
[1] Henderson, Robert; Deane, Sharon (2004-01-07). "Real-world XML". XML Made Simple. Amsterdam: Elsevier. p. 125.<br />
ISBN 0-7506-5998-X.<br />
[2] "Xerlin XML Editor license" (http:/ / www. xerlin. org/ LICENSE. txt). . Retrieved 2009-05-15.<br />
[3] "Stylus Studios: Open source XML Editor" (http:/ / www. stylusstudio. com/ xmldev/ 200207/ post20510. html). 2002-07-15. . Retrieved<br />
2009-05-15.<br />
[4] http:/ / developer. apple. com/ documentation/ Java/ Conceptual/ Jar_Bundler/ Packaging/ Packaging. html<br />
[5] http:/ / sqs. cmr. sfc. keio. ac. jp/ 2005/ 01/ gn. pdf<br />
[6] http:/ / www. xerlin. org/<br />
[7] http:/ / sourceforge. net/ projects/ xerlin/
XStream 306<br />
XStream<br />
Developer(s) Codehaus<br />
Initial release January 1, 2004<br />
Written in Java<br />
Operating<br />
system<br />
Cross-platform<br />
License BSD-style license<br />
Website http:/ / xstream. codehaus.<br />
org/<br />
XStream is a simple Java library to serialize objects to XML (or JSON) and back again. [1]<br />
XStream library<br />
XStream stands out for its ease of use and low footprint. It uses reflection to discover the structure of the object<br />
graph to serialize at runtime. The XML it generates is very readable.<br />
The library doesn't require modifications to objects, so it's non intrusive to use the library. It can serialize internal<br />
fields, including private and final. Supports non-public and inner classes. [2]<br />
Object graph serialization<br />
When serializing an object it serializes the full object graph. Duplicate references encountered in the object-model<br />
will be maintained. For example using the following class CD<br />
package com.thoughtworks.xstream;<br />
public class Cd {<br />
private String id;<br />
private Cd bonusCd;<br />
Cd(String id, Cd bonusCd) {<br />
}<br />
this.id = id;<br />
this.bonusCd = bonusCd;<br />
Cd(String id) {<br />
}<br />
this.id = id;<br />
public String getId() {<br />
}<br />
return id;<br />
public Cd getBonusCd() {<br />
}<br />
return bonusCd;
XStream 307<br />
}<br />
and add some of these object to a list<br />
Cd bj = new Cd("basement_jaxx_singles");<br />
Cd mr = new Cd("maria rita");<br />
List order = new ArrayList();<br />
order.add(mr);<br />
// adds the same cd twice (two references to the same object)<br />
order.add(bj);<br />
order.add(bj);<br />
// adds itself (cycle)<br />
order.add(order);<br />
XStream xstream = new XStream();<br />
xstream.alias("cd", Cd.class);<br />
System.out.println(xstream.toXML(order));<br />
If the above code is executed with XStream's default relative references mode, it will generate the following XML:<br />
<br />
<br />
maria rita<br />
<br />
<br />
basement_jaxx_singles<br />
<br />
<br />
<br />
<br />
XStream is free software, distributed under a permissive, revised BSD-style licence.<br />
Usage<br />
• Confluence [3]<br />
• Apache Muse [3]<br />
External links<br />
• XStream Library Home Page [4]<br />
References<br />
[1] "Serializing Java Objects with XStream" (http:/ / www. xml. com/ lpt/ a/ 1462). XML.com, O'Reilly Media, Inc. 2004-08-18. . Retrieved<br />
2009-12-14.<br />
[2] "Use XStream to serialize Java objects into XML" (http:/ / www. ibm. com/ developerworks/ java/ library/ x-xstream/ index. html). Ibm.com.<br />
. Retrieved 2009-12-14.<br />
[3] "XStream - References" (http:/ / xstream. codehaus. org/ references. html). Xstream.codehaus.org. . Retrieved 2009-12-14.<br />
[4] http:/ / xstream. codehaus. org/
Article Sources and Contributors 308<br />
Article Sources and Contributors<br />
Java (programming language) Source: http://en.wikipedia.org/w/index.php?oldid=379815313 Contributors: -Barry-, 16@r, 172.176.26.xxx, 1wolfblake, 4twenty42o, 7, =JaCyX=, @modi,<br />
ABCD, AJim, Aaron Bowen, Aaron Rotenberg, Abarnea 2000, Abelson, Adam1213, AdamH, Adamacious, Adashiel, Addaintstopnme, Addshore, Aditya, AdjustShift, Adw2000, Ae-a, Aeons,<br />
Aesopos, Agrawaam, Ahoerstemeier, Air pacquiao, Aitias, Aiyizo, Aka042, Akamad, Akersmc, Aksi great, Aktsu, Alai, Alainr345, Alan Rockefeller, Alansohn, AlbertCahalan, Alerante, Alex<br />
LE, Alex.atkins, Alex.muller, Alexdethier, Alexius08, Alfio, Alhoori, Alicam8, AlistairMcMillan, Allan McInnes, Alterego, Altmany, Alvin-cs, Am088, Amareto2, Amazon911,<br />
Ambarishmohan, Amicon, Amire80, Amitchaudhary, Ammubhave, Ancheta Wis, AndonicO, Andre Engels, Andrea Parri, Andres, Andrewferrier, Andrewlp1991, Andypandy.UK, Anger22,<br />
Angusmclellan, Anirudhsshastry, Anirudhvyas010, Anizzah, Anon lynx, Anoopan, Antaeus Feldspar, Antandrus, Antidrugue, Anwar saadat, Aphonik, Arabic Pilot, Arbitrarily0,<br />
ArchMageZeratuL, ArchNemesis, Archenzo, Ardonik, Ardric47, Aremith, Arloz, Armando82, Arnehans, Arrenlex, AscendantOat, Austin Hair, Averell23, B3t, BBUCommander, Baa,<br />
Babarcash, Babedacus, Babomb, Bacchus87, Bachmann1234, Bact, Badgernet, Banaticus, Baricom, Baronnet, BarretBonden, Basitj, Batneil, Bboy123, Bcrowell, Bedel23, Belem tower, Ben<br />
Arnold, BenAveling, Benhocking, Beno1000, Betacommand, Bevo, Biblbroks, BigGuyC, Bijee, Biker Biker, Billy On Bannana Peels, Biot, Bissinger, Blablablob, Blankfrack, Bluemoose,<br />
Blurpeace, Bobblewik, Bobo192, Boing! said Zebedee, Booyabazooka, Borislav, Bovlb, Bravegag, Brick Thrower, Brion VIBBER, Brossow, BruceMagnus, Bubba-, Buchanan-Hermit, Bulatych,<br />
BurntSky, Burzmali, Byronknoll, Bytbox, CAkira, Cal 1234, Calvin 1998, Calvinaustin, Canadafreakazoid, CanadianLinuxUser, Cananian, Candear, CanisRufus, Cap'n Refsmmat, CapitalR,<br />
Capricorn42, CaribDigita, Casperl, Cat-five, Catamorphism, Catgut, Cburnett, Centrx, CesarB, Cgs, Chandrasekar78, Chaotic cultist, Charles Matthews, CharlesC, Chasingsol, Chazwatson,<br />
Chealer, Cheesy mike, Chei, Cheung1303, Chinhnt2k3, Chiok, Chip Zero, Chiprunner, Chocolateboy, Chowbok, Chrislk02, Chrissyboi, ChristianEdwardGruber, ChristopheS, Christopher<br />
Mahan, Chu Jetcheng, Chuayw2000, Chuq, ClanCC, Classical Esther, Cleared as filed, ClockworkLunch, Closedmouth, Clydedoris, Coffee, Coley s, Cometstyles, Connelly, Conor H.,<br />
Conversion script, Coolshit, Corpx, Corti, Cp98ak, Cpl Syx, Crazz bug 5, Creidieki, CunningLinguist, Cureden, Curmudgeon99, Curps, Cwfrei, Cwolfsheep, Cyan, Cybercobra, CyborgTosser,<br />
Cynic783, Cyp, Cyrius, D'Agosta, D6, DARTH SIDIOUS 2, DJ Clayworth, DMacks, DNewhall, Daf, Daimengrui, Damian Yerrick, Dan aka jack, Danakil, Dancraggs, Danhash, Daniel<br />
Brockman, DanielTrox, Danrah, Darklilac, Dave Runger, David Gerard, Davidjk, Davidweiner23, Dawnseeker2000, Dbiagioli, Dcoetzee, Dcprice555, DeadEyeArrow, Debajit, Debashish, Debeo<br />
Morium, Decagon, Delian31, Delirium, Delldot, Delta G, DennisWithem, Derek farn, DetlevSchm, Dgies, Dgwarwick, Dhoom, Diberri, Dibujon, Diderot's dreams, Dillard421, DineshMungra,<br />
Dingskes, Dipet343, Discospinster, Djsuess, Dll99, Dmyersturnbull, Dominic7848, Don-vip, Dongiulio, Doradus, Doug Bell, Dpark, Dr-unifex, DrIdiot, Drakkos, Drappel, Dreadstar, Dream of<br />
Goats, DreamGuy, Drmies, DropDeadGorgias, Dterei, Dumitru Gherea, Dysprosia, Dystopianray, Eagleal, Easyas12c, EatMyShortz, EbulaJonez, Ed Poor, Edcolins, Edknol, Edward, Edwin.wei,<br />
Efriedman, Egomaniac, Ekashp, ElBenevolente, Elf, Ellenaz, Ellmist, Eloquence, Elvarg, Ems2, Enchanter, EngineerScotty, Enough2000, EpiQ SkiLL, Er Komandante, ErKURITA, Errandir,<br />
Ervinn, Essjay, Ethridgela, Etz Haim, Euchiasmus, Everyking, Evice, Evil Monkey, Evil saltine, Evildeathmath, Excirial, FactChecker1199, Fagstein, Fakahi, Falcon300000, Falcon8765, Fang<br />
Aili, Fasga, Fashionslide, Fast.ch, Fasten, Favonian, Fennec, Ferdinand Pienaar, Feureau, Ff1959, Fieldday-sunday, Finlay McWalter, Flamingantichimp, Flash200, FlavrSavr, Fleminra, Fogger,<br />
Fotinakis, Frap, Frecklefoot, Fredrik, Freedom to share, FreplySpang, Ftiercel, Fuchsias, Funandtrvl, Furrykef, Fx2, Gail, Gaius Cornelius, Galaxy001, Galwhaa, Gamma, Gary King,<br />
Garygateaux, Garyzx, Gazwim, Gdavidp, Geekler, Generalguy11, Georgia guy, Giftlite, Gilgamesh, Gimme danger, Gimmekat, Givegains, Glasser, Glenn Maddox, Glezos, GnuDoyng, Gogo<br />
Dodo, Gortsack, Gracenotes, GraemeL, Graffity, Grandscribe, Graue, Great Cthulhu, Green caterpillar, Green meklar, Greenrd, Gronky, Grunt, Gscshoyru, Gudeldar, Gurch, Gurklurk, Gutworth,<br />
Guusbosman, Guy Peters, Guyjohnston, Gwern, Gzkn, Gökhan, H-b-g, H4xx0r, Hadal, Haham hanuka, HalfShadow, Hao2lian, HappyInGeneral, Hara100, Hariva, Harm.frielink,<br />
HarmonicSphere, HarryAlffa, Harshadoak, Haseo9999, Havarhen, Hayabusa future, Hdante, Hedoluna, Henning Makholm, Henrygb, HereToHelp, Hervegirod, Hfastedge, Hgfernan, Hirudo,<br />
Hirzel, Hmains, HoganLong, Hooperbloob, Hosterweis, Hrshtkumar, Hu12, Husond, IBlender, Ideogram, Imaginationac, Immunize, Int19h, Ioakar, Iodine, Iridescent, Irish Souffle, Irishguy,<br />
Ishanthasiribaddana, J Di, J.J.Sagnella, J.delanoy, J.l.barthel, J7, JEBrown87544, JHeinonen, JIP, JLaTondre, JOptionPane, JTN, JWaide, Jabberrock, Jaglnx, Jamesday, Jarchitect, Java jack jan,<br />
Javageek212, Javawizard, Jay, Jay Gatsby, Jaybee, Jaydeki, Jcw69, Jdforrester, Jeff G., Jeffq, Jeffrey Mall, Jeffuit, Jeltz, Jemijohn, JenniferHeartsU, Jeronimo, Jesse Viviano, JesseHogan, Jglick,<br />
Jibjibjib, Jijithp, JimWae, Jimguot, Jiy, Jj137, Jjaazz, Jleedev, Jmendez, Joelr31, Joerite, John Hendrikx, John Vandenberg, JohnCongerton, Johnuniq, Jojit fb, Jonabbey, Jonathanischoice, Jondel,<br />
Jonik, Jopo sf, JorgePeixoto, Joseph Solis in Australia, JoshHolloway, Joshisachin79, Jsavit, Juansempere, Julian Mendez, Junes, Jusdafax, Justforasecond, KUsam, Kaldari, Kamalraja,<br />
Kamasutra, Kariteh, Karl-Henner, Kbolino, Kcirb, Kedit1181, Keith Azzopardi, KelleyCook, Kevin Saff, Keycard, Khakipuce, Khalid hassani, Killick, Kingturtle, Kkm010, Kks krishna,<br />
Klausness, Klingpl0x, KnowledgeOfSelf, Knyf, Kona1611, Koyaanis Qatsi, Kozuch, Kprobst, Kula85, Kungfuadam, Kurrgo master of planet x, Kvdveer, Kwaku, Kyle Baggs, LFaraone,<br />
Landryhc, Lavellem, Leafyplant, LeaveSleaves, Lee Daniel Crocker, Lee J Haywood, LeeHunter, LeilaniLad, LestatdeLioncourt, Levin, Lights, Little Mountain 5, LittleDan, Loadmaster,<br />
Logariasmo, Lpetrazickis, Lucas Malor, Luk, Lukejea, Lumingz, Luna Santin, Lupin, Lysander89, M1chu, M4gnum0n, MER-C, MIT Trekkie, MYC36, MaBe, Magicfox13, Magioladitis,<br />
Magister Mathematicae, Magnus Manske, Mahanga, MaikSchreiber, Mailer diablo, Mainepenguin, Majorly, Malcohol, Mani1, Maoj-wsu-MC, MarSch, MarXidad, Maraist, Marcelbutucea,<br />
Marcoandre, Mark Harrison, Mark Renier, MarkSweep, Marky1981, Marlow4, Martarius, Marteau, Marty360, Maryo1912, Massysett, Matherson, Matthew Yeager, Matthewpun, Matthieu fr,<br />
Mav, Max Schwarz, MaxEnt, Maxim, Mcclain, Meara, Mecanismo, MeekMark, Meekohi, Melnakeeb, Melsaran, Menchi, Mentifisto, Metamorf, Mfb52, Mhorlbec, Michaelneale, Mikademus,<br />
Mike0001, Mikelo.Arbaro, Mikm, Minesweeper, Minghong, Minipie8, Minkythecat, Minute Lake, Mipadi, Mirror Vax, Misantropo, Misza13, Mitchellfx, Mjroots, Modster, Modulatum,<br />
Mohamedloey, Mohsens, Molteanu, Momet, Monkbel, MoraSique, Morte, Morwen, Mr link, MrCoder, MrJones, Mritunjai, Mrstonky, Msusmangani, Mtleslie, MuZemike, Mucus, Mxn, Myanw,<br />
Mzajac, N4te, NJM, Naddy, Nanshu, NapoliRoma, NathanBeach, Ncmathsadist, Neilc, Nephelin, Nephtes, Neurolysis, NevilleDNZ, NewEnglandYankee, Newsmaestro, Nick R Hill, Nick125,<br />
NickBush24, Nigelj, Nikai, Nikhil.bandekar, Nil Einne, Nimur, Nixeagle, Nmrd, Nnp, NoirNoir, Nopetro, Npovmachine, Ntsimp, NuclearWarfare, Nwbeeson, Oatmealcookiemon, Oblivious,<br />
Odinjobs, Ohnoitsjamie, Oldadamml, Oleg Alexandrov, Oli Filth, Onehundredandtwo, Onevalefan, Opt 05, Orderud, Orisino, OscarTheCat3, OwenBlacker, OwenX, Oysterguitarist, P-unit,<br />
P0lyglut, PGibbons, PMJain, Pagingmrherman, Pascalv, Patman g, Patrick987, Paul Murray, Paul Richter, Paul99, Paules nl, Pavel Vozenilek, Peepeedia, Pengo, PerLundberg, Perfecto, Peter<br />
Delmonte, Peter Griffin, Peter lawrey, Peterl, Pgk, PhageRules1, Phantomsteve, Pharos, Phgao, Phil websurfer@yahoo.com, PhilKnight, Philipwhiuk, Phoenix-forgotten, Piano non troppo, Piet<br />
Delport, Pigpigking, Pinktulip, Pipedreamergrey, Pizza Puzzle, Plugwash, PlusMinus, Pmronchi, Pne, Poccil, Polluxian, Polydor, Pontillo, Poor Yorick, Potatoj316, Premvvnc, Priyankgokani, Pro<br />
Grape, Professor Calculus, Proficient, ProvingReliabilty, Public Menace, Pundeerd, PuzzletChung, Pwooster, Quadell, Qwertyus, R3m0t, Rab8613, Raistlin11325, RandalSchwartz, Ranjith16,<br />
Rao crazy, Raul654, Ravchit, Raven4x4x, Raynoism, Rccarman, Rcs, Rdsmith4, Real-Life Sock Puppet, RedWolf, RedZombie125, Redrocket, Redvers, Reisio, Rettetast, RexNL, Rgeorgy,<br />
Rhobite, RichF, Rick Jelliffe, Risk one, Rjmfernandes, Rjwilmsi, Robert Merkel, Robert Skyhawk, RobertG, Robo.mind, Rodhullandemu, Rogerd, Ron mmi, Ronz, RossPatterson, Rossmann,<br />
RoyBoy, Rror, Rtanz, Rufous, Ruiz, Ruud Koot, Rzwitserloot, S-n-ushakov, SAE1962, SF007, SGNDave, SNIyer12, ST47, Sam Hocevar, Sam Korn, Sam jervis, Samohyl Jan, San25872,<br />
Santiago Roza (Kq), Saravask, Sasha Slutsker, Sass24, Satanjava, Scarian, Schissel, SchnitzelMannGreek, Scientus, Scjessey, Scm83x, Scovetta, Sdfisher, Sdornan, SeanJA, Seanhan,<br />
Search4Lancer, Sebastiangarth, Seraphimblade, Sfmontyo, Shadowjams, Shenme, Siddartha.kaja, Sigma 7, SimonP, Sinn, Sir Anon, SirWoland, Siroxo, Sirworthyduck, Sj, Sjarosz, Sjc,<br />
SkyWalker, Sleske, Slike, SlitherM, Smyth, Snowolf, Socablg2, SocratesJedi, Sohil it, Some P. Erson, Soptep, Spalding, Sparker046, Speedogoo, Spencer, Spiff, SpikeToronto, Spookfish,<br />
Spoon!, Spug, Squingynaut, Starblind, Starwiz, Steffen Felbinger, Stephen, Stephen B Streater, Stereo, Stevenj, Stevenrasnick, Stevietheman, Stormie, Styrofoam1994, Subanark, Suffusion of<br />
Yellow, Sunderland06, Super Quinn, SuperU, Superfly Jon, Superm401, Supernova17, Supertouch, Susvolans, SvGeloven, Swintrob, Sylent, Synthiac, Szajd, TOReilly, TRauMa, TakuyaMurata,<br />
Talandor, Tar5047, Tariqabjotu, Tasc, TastyPoutine, Tcgunner90, Tcncv, Teabeard, Technopat, Tedickey, Tellyaddict, Template namespace initialisation script, TerokNor, Terrible Tim,<br />
Testmod1, The Anome, The Elves Of Dunsimore, The Hokkaido Crow, The Thing That Should Not Be, The wub, The1physicist, The2ndflood, TheDarkArchon, TheSpook, Thehelpfulone,<br />
Theresa knott, Theuser, Thingg, Thornelytaylor, Thue, Thumperward, Thunderbolt16, Tillmo, Tim1988, TimTay, Timwhit, Titoxd, Tjansen, Tkgd2007, Tlim7882, Tmaher, Tmbg37, Tom 99,<br />
Tommy2010, Tompsci, Torc2, Tothwolf, Toussaint, Toytoy, Tresiden, Troels Arvin, Tthorley, Ttwaring, Turing, Tushar.kute, Tustin2121, Tvynr, Twister nt, Tyraios, Tyrol5, Tyw7, Ubuntu2,<br />
Ultimus, Uncle G, UnitedStatesian, Unixer, Unixxx, Urod, Uselesswarrior, Utcursch, UtherSRG, VX, Valerio81, VantagePoint, Vchimpanzee, VeLoCiTy89, Vera.tetrix, Viciodk, Viebel, Viento,<br />
Violetriga, Visor, Vizspring, Vocaro, Volt4ire, Vvidetta, WJBscribe, Wasimbargujar, Wbrameld, Wdyoung, Web-Crawling Stickler, Webmink, Weregerbil, Wesley crossman, Wgw2024, Wgw4,<br />
White Cat, Whosyourjudas, Wiggin15, Wik, WikiLeon, Wikianon, Wikipelli, Wikipendant, Wikiwerks, Wikiwikiwifi, William Allen Simpson, Wimt, Windchaser, Wknight94, Wlievens,<br />
Wmahan, Wonko, Wootery, Wowus, Wrp103, Wsaryada, WurmWoode, Ww, Wyredchris, Wzwz, Xan 213, Xaosflux, Xelgen, Xezbeth, Xinconnu, Xpodmaniac, Xproject, Yamaguchi先生,<br />
Yamamoto Ichiro, Yamla, Yozh, Yulracso, Yurik, Yurivict, Zawersh, Zazpot, Zekeo, Zenohockey, Zijian, Zik-Zak, Zxcvbnm, Zyphrix, Ævar Arnfjörð Bjarmason, 六脉飞天牛, 2413 anonymous<br />
edits<br />
Web Language Source: http://en.wikipedia.org/w/index.php?oldid=296014078 Contributors: Amalas, Anshul, Codeseg, Satori Son, Solarapex, Vycanis<br />
AgentSheets Source: http://en.wikipedia.org/w/index.php?oldid=345477334 Contributors: Adjusting, Andreas Kaufmann, Birbilis, CRGreathouse, CharlesGillingham, DNewhall, Destynova,<br />
Dragentsheets, Dugwiki, Gudeldar, Hroðulf, Karatorian, Kvn8907, Mange01, McLar eng, Oddharmonic, Peterl, The Thing That Should Not Be, Tziortzioti, VX, Waldir, William Avery, 12<br />
anonymous edits<br />
Oak (programming language) Source: http://en.wikipedia.org/w/index.php?oldid=368212204 Contributors: Csl77, Hervegirod, Hmains, Loadmaster, Paul Foxworthy, Rich Farmbrough, Ryan<br />
suchocki, 4 anonymous edits<br />
Lightweight Java Source: http://en.wikipedia.org/w/index.php?oldid=363175217 Contributors: Alainr345, Hmains, Rich Farmbrough, VX, Vortigen<br />
.properties Source: http://en.wikipedia.org/w/index.php?oldid=374340272 Contributors: .digamma, Andy.goryachev, Bissinger, Brsanthu, Chridd, Cybercobra, Goatcheez, Greenrd, Ike-bana,<br />
Iridescent, J. Finkelstein, Jerome Charles Potts, Jmlk17, John Vandenberg, Kjoonlee, Mipadi, Nick, Od Mishehu, PatrikR, Ptomasek, Rror, Spacebirdy, Timothy Truckle, Tom Morris, Waxigloo,<br />
22 anonymous edits<br />
Apache Harmony Source: http://en.wikipedia.org/w/index.php?oldid=378992487 Contributors: Aidan W, Alainr345, Andareed, Audriusa, Brian Geppert, Burschik, C. A. Russell, Daev,<br />
Dave.tillman, Dirk Riehle, Doug Bell, East718, Engas, Evice, Faisal.akeel, Fiftyquid, Frap, Gaius Cornelius, Geirmagnussonjr, Greenrd, Gronky, Grutness, Haakon, Hervegirod, Hu12, Ike-bana,<br />
ItsProgrammable, JLaTondre, JensMueller, Joehni, John of Reading, Kesla, Khalid hassani, LazyEditor, Lightmouse, Logixoul, Marudubshinki, Maurogiachero, Membar2,
Article Sources and Contributors 309<br />
Mercadodiego@gmail.com, MoreNet, Per Abrahamsen, Qutezuce, Revolus, Rich Farmbrough, Rjwilmsi, SF007, SimonP, Straxus, Superm401, SymlynX, TakuyaMurata, The Thing That Should<br />
Not Be, TheParanoidOne, UU, Uga2, Waldoalvarez00, 169 anonymous edits<br />
Apache Muse Source: http://en.wikipedia.org/w/index.php?oldid=331712358 Contributors: CultureDrone, EdGl, M4gnum0n, MauriceKA, Mlaffs, Power.corrupts<br />
Apache Shiro Source: http://en.wikipedia.org/w/index.php?oldid=371264579 Contributors: Achille, Alainr345, Cameronbraid, Jeandré du Toit, Kyle1278, Malcolma, Manjula.aw, Rhino1977,<br />
Skipshot4, Tokek, 8 anonymous edits<br />
Java applet Source: http://en.wikipedia.org/w/index.php?oldid=380110454 Contributors: 213.89.18.xxx, Alainr345, Alansohn, Alexwright, Alvin-cs, Amareto2, Anonymous56789, Artw,<br />
Audriusa, Bdiscoe, BonzoESC, Borgx, Bryan Derksen, Brz7, Byronknoll, Canderra, Cesarsorm, Charivari, Chris Wood, ChronoKinetic, Cmccormick8, Conradbate, Conversion script, Da rulz07,<br />
Doug Bell, Ency, EoffreyGey, FactChecker1199, Frap, Frecklefoot, Futurix, Fuzzie, Giftiger wunsch, Group29, Grshiplett, Haakon, Hellisp, Hem1234, Heron, Hu12, Ian Pitchford, Iridescent,<br />
Jacobolus, Jay, JeLuF, Jengelh, Jmnbatista, Jwoodger, Lee J Haywood, LittleDan, Lotje, Magioladitis, Maima, Marcobiscaro2112, Mark Renier, MartinHarper, Michael Hardy, Mikenolte,<br />
Minghong, Modulatum, NawlinWiki, Nipesh1, Od Mishehu, Patobrien99, Peak, Pearle, PhilKnight, Phyzome, Plugwash, Prodego, RealWorldExperience, RedWolf, Reisio, Rich Farmbrough,<br />
Rick Block, Rror, SDiZ, Sahib12, Shandru, Shanes, Sherool, Skeejay, SnowFire, Spoon!, Stephen B Streater, Taka, TimTay, TonyW, Toussaint, Twi20Pi, UU, Udittmer, Unknown W. Brackets,<br />
Wapcaplet, Wtmitchell, Yozh, 用心阁, 169 anonymous edits<br />
Associació d'Usuaris de Java de Catalunya Source: http://en.wikipedia.org/w/index.php?oldid=348025725 Contributors: Chris the speller, Jordi.pujol.ulied, LilHelpa, Malcolma, Rich<br />
Farmbrough, Skier Dude, Tabletop, 3 anonymous edits<br />
Automated exception handling Source: http://en.wikipedia.org/w/index.php?oldid=364328873 Contributors: Abarnea 2000, Alansohn, Cybercobra, Intgr, Reinyday, Rigadoun, Shabda, 1<br />
anonymous edits<br />
Bean Scripting Framework Source: http://en.wikipedia.org/w/index.php?oldid=345196680 Contributors: BeBop, Bkkbrad, Bluemoose, Caerwine, Curps, Faisal.akeel, Gaius Cornelius,<br />
JLaTondre, Jnc, Jpp, Kopf1988, Madhero88, Malcolma, TheParanoidOne, Weyes, Wikimsd, Winptor, 16 anonymous edits<br />
CJAN Source: http://en.wikipedia.org/w/index.php?oldid=300894550 Contributors: Elonka, JanGB, Rjwilmsi, Scrool, Skysmith, Tabletop, UncleFester, WRK, 6 anonymous edits<br />
Celtix Source: http://en.wikipedia.org/w/index.php?oldid=368606334 Contributors: Frap, MrOllie, Tassedethe, Yadab Das, 1 anonymous edits<br />
Chainsaw (log file viewer) Source: http://en.wikipedia.org/w/index.php?oldid=305625547 Contributors: Fabrictramp, Gamefreak2413, LAX, PigFlu Oink, Sci girl, 12 anonymous edits<br />
clone (Java method) Source: http://en.wikipedia.org/w/index.php?oldid=371965403 Contributors: Abdull, Afromayun, Andreafrancia, Btx40, Faustus, Gerd-HH, Jcarroll, Jugular, Ketiltrout,<br />
Lax4mike, Mcorazao, Pjpringle, Spoon!, Supereddy, Tyraios, Yaniv Kunda, Zxcvcxz, 19 anonymous edits<br />
Comparison of Java and C Sharp Source: http://en.wikipedia.org/w/index.php?oldid=379974742 Contributors: (www itshixun com)GaoXiaoZu, 21655, Acid2base, Ahoerstemeier, Ajgorhoe,<br />
Alasdairking, AmadeoV, Amniarix, Ancheta Wis, Audriusa, Bertport, Bilal.alsallakh, Blowdart, Brunoton, Btx40, CCFS, Canderra, CanisRufus, Capnmidnight, Cerowyn, Chip Zero, Chowells,<br />
Chri1753, Chrisahn, Closedmouth, Collard, Colonies Chris, Coolboy1234, Craig Stuntz, Creek23, Curps, Cybercobra, CyborgTosser, Cyril, Daniel Earwicker, Darthsco, Debresser,<br />
DerrickOswald, DevastatorIIC, Developer38, Donhalcon, DoomBringer, Doug Bell, Dreftymac, Drstorm, EDNY200901(FLYASDRAGON), EDNY20090105maona, Ed Poor, Edurant,<br />
Elsendero, Enchanter, Erik Sandberg, FayssalF, Firsfron, Frecklefoot, Futurix, Gaijin42, Gatoatigrado, Greggobridges, GregorB, GreyCat, Groat, Gurch, Helpsloose, Hervegirod, Hooperbloob,<br />
Howcheng, Idolescent, Ieee8023, Ike-bana, Inquisitus, Int19h, ItsProgrammable, J04n, JHunterJ, JIP, Jackcsk, Jamelan, JamesNK, JavaKid, Jaydec, Jdthood, Jfbilodeau, Jfrascencio, Jkl, Jmundo,<br />
Josephw, Jvorchak, Kenyon, Kesla, Khabara, Kittybrewster, Knowzilla, KrisK, Ktalon, Leotohill, Lightxx, Loadmaster, Lobner, Maghnus, Maraist, Martin Fuchs, Mazi, Mboverload, Melchoir,<br />
Mets501, Mfb52, Mik01aj, Mikenolte, Mikon, Mirror Vax, Mishka.medvezhonok, Mitch Ames, MovGP0, Mugunth Kumar, NaibStilgar, Nathanaeljones, Neilc, Netoholic, NewEnglandYankee,<br />
Nma wiki, Norm mit, Nuggetboy, Numberp, Oldadamml, Omegarad, Orderud, Oren0, PPGMD, Pelister, Philu, Piano non troppo, Porges, Promit, Psiphiorg, Quota, Qutezuce, RHB, Rajakhr,<br />
Ralesk, RapidSkis, Raptor3676, Rednblu, RenataLiting, RevRagnarok, Robartin, Root4(one), Rp, Rror, Rursus, Samrolken, Sarloth, SchfiftyThree, ShadowRangerRIT, Shubhkarmansandhawalia,<br />
Soumyasch, Spidermario, Squash, SteinbDJ, Steven Zhang, Strangeweather, Subanark, Superm401, Svick, Tbjablin, The Elves Of Dunsimore, The1physicist, Tim1357, TimBentley, TimTay,<br />
Timwi, Tleave2000, Tmcdouga, TobiasPersson, Tohd8BohaithuGh1, Torc2, Toussaint, Triplesub, UnitedStatesian, Useerup, Vahid83, Valodzka, Vazbik, Visor, Vlad, W3bbo, Waldir, War<br />
Famine Pestilence Death, Webmaster961, Winterst, Woohookitty, Yms, Ynhockey, Yurik, ZacBowling, Zain engineer, 543 anonymous edits<br />
Comparison of Java and C++ Source: http://en.wikipedia.org/w/index.php?oldid=380005248 Contributors: 1exec1, Aandu, Aavindraa, ActiveSelective, Adamd1008, Alainr345, Alex Heinz,<br />
Alexnye, Alterego, Aprock, Barefootguru, Bdodo1992, Bjdehut, Bovineone, Bryan Derksen, Buckyboy314, CanisRufus, Cardatron, Catamorphism, Cfeet77, Chip Zero, CmdrRickHunter,<br />
CodedoC, Crashie, Curps, CyborgTosser, Damian Yerrick, Dangiankit, DanielPharos, Daquell, Darkwind, David Wahler, Decltype, Derek Ross, DerrickOswald, DevastatorIIC, Donhalcon, Doug<br />
Bell, Dthomsen8, Dustball, EYOLs, Ed Poor, EdSquareCat, Eelis.net, Ees, EmeryD, Erik Sandberg, Esben, EverGreg, Ezrakilty, Flums, Frecklefoot, Gamahucheur, Garyzx, Giftlite, Grunt,<br />
Gudeldar, Harryboyles, Hgb asicwizard, Hirzel, Hsz, Ivec, JavaKid, Jayaram ganapathy, Jespdj, Johntabularasa, JulesH, Juliano, KardinalKill, Karl Dickman, Kazkaskazkasako, Kbolino, Kexyn,<br />
Kilo-Lima, King Mir, Kittybrewster, Kmorozov, Kwertii, Lkinkade, Loadmaster, MarSch, Marco255, Martin Fuchs, MartinDK, Mathieu, McNepp, Medinoc, Michael Trigoboff, Miffy900,<br />
Mikon, Mirror Vax, Molteanu, Mwn3d, Mysekurity, Neilc, Netoholic, Nono64, Orderud, OverlordQ, Owl order, Pascal.Tesson, Pcu123456789, Peterdjones, Peterl, Pfunk42, Rainwarrior,<br />
Ranjyad, Rdsmith4, Reckjavik, Rengolin, Requestion, Rjwilmsi, Rodrigostrauss, Root4(one), Sandahl, Saucepan, Schapel, SeverityOne, Sfmontyo, Sjc, SlitherM, Solarswordsman, Specs112,<br />
Spoon!, Squash, Super Quinn, Sussexonian, Tarquin, The Elves Of Dunsimore, The Thing That Should Not Be, Themusicgod1, Thenarrowmargin, Thymefromti, Tiagofassoni, Tim Starling,<br />
Timgurto, TobiasPersson, Tundra010, Urod, Veritas Blue, Vertexua, Vqwj, War Famine Pestilence Death, Weregerbil, Wesley, Wikitoov, Wrldwzrd89, Wtmitchell, XNinto, Ysangkok, Zertyz,<br />
Zzuuzz, Ævar Arnfjörð Bjarmason, 334 anonymous edits<br />
Comparison of the Java and .NET platforms Source: http://en.wikipedia.org/w/index.php?oldid=377659395 Contributors: ACSE, Aadnk, Adw2000, Alexander Abramov, AlonzoChurch,<br />
Andrewpmk, Audriusa, BorisDušek, Chip Zero, ChorizoLasagna, Crazycomputers, CritterNYC, Cyril, DH85868993, Danrah, Dethme0w, EdgeOfEpsilon, Edward, Erik Sandberg, Eriks81989,<br />
Evildeathmath, Fduch, Frap, Futurix, GoingBatty, Gordonrox24, Gracefool, HAl, Haoyao, Hervegirod, Hexene, Ike-bana, Inks.LWC, Iridescent, JavaKid, Jcarroll, Jzubeck, Kingboyk,<br />
Kubanczyk, LedgendGamer, Leotohill, MER-C, Maghnus, Meebey, Mernen, Mfb52, Mike Linksvayer, Mitch Ames, Mk*, Mrnatural, NaibStilgar, Ootachi, Paul Foxworthy, Powerlord,<br />
Ricvelozo, Rjwilmsi, SF007, Sebleblanc, Sedimin, Shadowjams, Starionwolf, Stetorvs, Superfly Jon, Svick, Tavilis, Tbjablin, Tokek, Torc2, Wtaa, Xpclient, Yozh, Yusnielb, ZacBowling, 73<br />
anonymous edits<br />
Constant interface Source: http://en.wikipedia.org/w/index.php?oldid=318583679 Contributors: BlindWanderer, Libsoc, Malcolma, Melchoir, Mister Farkas, Savastio, TreasuryTag, 1<br />
anonymous edits<br />
Java 4K Game Programming Contest Source: http://en.wikipedia.org/w/index.php?oldid=353912194 Contributors: Alynna Kasmira, Amalas, Dreftymac, Invader Zim, Jbanes, Kelly Martin,<br />
Kylu, Marasmusine, Morre, NapoliRoma, Renanse, Retired username, Rjwilmsi, Synergy, West.andrew.g, 22 anonymous edits<br />
CookXml Source: http://en.wikipedia.org/w/index.php?oldid=367970361 Contributors: Aboriginal Noise, Bryan Derksen, Coconut99 99, Elwikipedista, Gronky, Isilanes, Kl4m-AWB,<br />
Seraphimblade, Torc2, TubularWorld, 2 anonymous edits<br />
Cougaar Source: http://en.wikipedia.org/w/index.php?oldid=344288000 Contributors: Atlantima, CanisRufus, Dr Gangrene, Gvidaver, Khalid hassani, Malcolma, Midavalo, Network Inkling,<br />
Rob Cranfill, Ruud Koot, Waldir, Zootalures, 3 anonymous edits<br />
Deterministic Parallel Java Source: http://en.wikipedia.org/w/index.php?oldid=348783386 Contributors: Esfand30, Malcolma, Pointillist, R'n'B, 1 anonymous edits<br />
Devoxx Source: http://en.wikipedia.org/w/index.php?oldid=352925745 Contributors: Dawynn, Fabrictramp, HenkvD, Hu12, Michig, Pascal.Tesson, Shalom Yechiel, Sjabejug, Skittleys, Turb,<br />
Zqudlyba, 2 anonymous edits<br />
Doclets Source: http://en.wikipedia.org/w/index.php?oldid=338833861 Contributors: (:Julien:), Rolfedh, 1 anonymous edits<br />
Elastic Path Source: http://en.wikipedia.org/w/index.php?oldid=378169053 Contributors: Cander0000, Elasticpath, Nihiltres, R'n'B<br />
Electronic Disturbance Theater Source: http://en.wikipedia.org/w/index.php?oldid=370943445 Contributors: Badassant, CosineKitty, EagleFan, Paine Ellsworth, R'n'B, RoboHomo, SatyrTN,<br />
ShadowNano169, Woohookitty, 1 anonymous edits<br />
Event dispatching thread Source: http://en.wikipedia.org/w/index.php?oldid=372792428 Contributors: Auric, Doug Bell, Echawkes, FredSwartz, Hervegirod, Pearle, R. S. Shaw, Stolsvik,<br />
Ultimatepolo, 15 anonymous edits
Article Sources and Contributors 310<br />
Facelets Source: http://en.wikipedia.org/w/index.php?oldid=368769435 Contributors: Alainr345, Arjant, Gernhwak, HairyFotr, Hosamaly, MacGyverMagic, MatthewVanitas, Olekva, Penkeen,<br />
RHaworth, T@nn, Tassedethe, Tritium6, Tyraios, 43 anonymous edits<br />
final (Java) Source: http://en.wikipedia.org/w/index.php?oldid=377437826 Contributors: 16@r, Abdull, Aitias, AndrewHowse, Art187, Bluemoose, Calimo, Chetandandgey, Choas, Darend,<br />
Ezrarez, Fahadsadah, Genesis, Jann2005, Kingpin13, Kulandai, Looris, Max Schwarz, Muchness, Myncknm, Niclas Wiberg, Oleh Kernytskyi, P1h3r1e3d13, Psbsub, Randomblue, Rp, SAE1962,<br />
Sethrh, Smallman12q, Spoon!, Techman224, Tobyr2, Zolv, 45 anonymous edits<br />
FloodNet Source: http://en.wikipedia.org/w/index.php?oldid=345439463 Contributors: Badassant, Interiot, Kenb215, Malcolma, Rjwilmsi, 5 anonymous edits<br />
FormEngine Source: http://en.wikipedia.org/w/index.php?oldid=377446090 Contributors: Jpbowen, Rich Farmbrough, Ustark, Vbublitz, 2 anonymous edits<br />
Generics in Java Source: http://en.wikipedia.org/w/index.php?oldid=379190046 Contributors: 16@r, Adw2000, Alfe, BernardSumption, Buttermilchtrinker, Carlosayam, Chip Zero,<br />
Closedmouth, Cybercobra, Delirium, Dmyersturnbull, Dreish, Ed Poor, Eve Teschlemacher, Godbe, Gracenotes, Green caterpillar, Gryzlo, Hervegirod, Irrªtiºnal, Jagat321, Jjdawson7,<br />
Jluuwindsorca, John Vandenberg, KKI, Karl Stroetmann, Kauan, Maghnus, Matthew0028, Mstuomel, Nawaf.albadia, Neilc, Philip Trueman, Prodoc, Rheaghen, Ruakh, Sleske, Spoon!, Stagalj,<br />
Subanark, Tardis, Tbleher, Tuntable, Urhixidur, Zippanova, 73 anonymous edits<br />
G-java Source: http://en.wikipedia.org/w/index.php?oldid=367210806 Contributors: Blakeo x, Cynical, Elvis, Fedor GM, Frap, Fuzzie, Gm guru, IanManka, IsmAvatar, JLaTondre, John<br />
Vandenberg, Ketiltrout, Luiscubal, Malcolma, Markco1, Mike926908240680, OTAVIO1981, Pampas Cat, Sladen, XDanielx, 38 anonymous edits<br />
GlassFish Metro Source: http://en.wikipedia.org/w/index.php?oldid=368613545 Contributors: Anetode, Anthony Appleyard, Dockurt2k, Frap, Pxma, Sebleblanc, Shaun mcgrath, Tassedethe,<br />
UC Bill, 6 anonymous edits<br />
James Gosling Source: http://en.wikipedia.org/w/index.php?oldid=379579153 Contributors: Acerperi, Alainr345, Alansohn, AlistairMcMillan, Altenmann, AnOddName, Arathald,<br />
AutumnSnow, Avenged Eightfold, Bact, Badgernet, Bearcat, Bertport, Bhoeble, Blanchardb, Bobula101, Bondolo, Bosmon, Braiam, CDN99, CIreland, Cagecrawler, CharlotteWebb,<br />
Chithiraiyan, Chrislk02, Colinkem, D6, Daltenty, Dan100, Daniel, Darolew, DerHexer, Doug Bell, Ed Poor, EncMstr, EronMain, EugeneZelenko, Fieldday-sunday, FrenchIsAwesome, Ftiercel,<br />
Gary King, Geekler, Geni, GregorB, Gronky, Groogle, Guat6, Hholt01, Hooperbloob, Ibagli, J Milburn, J.delanoy, JamesTeterenko, Jarchitect, Jesse Viviano, John Vandenberg, Joolz, Jpbowen,<br />
Kaihsu, Katharineamy, LAAFan, Lamat, Luís Felipe Braga, M5mm5m, MarXidad, Martarius, Marudubshinki, Matt Crypto, Mav, Mayumashu, Michael Drew, Mirror Vax, Mre5765, Mrwojo,<br />
Ms2ger, Mxn, NapoliRoma, Neilc, Nolookingca, Nsaa, Per Abrahamsen, Peter Campbell, Prolog, RazorICE, RedWolf, Revence27, Rich Farmbrough, Scm83x, Section6, Seddon, Shadesofgrey,<br />
Shipmaster, Sionus, Snigbrook, Spinboy, Stephensuleeman, SteveSims, Stevertigo, Stolkin, Straxus, Sunray, THEN WHO WAS PHONE?, Taejo, Tanbace, The Thing That Should Not Be,<br />
TheParanoidOne, Tobias Bergemann, Toussaint, Traroth, Trialsanderrors, TrungH, Twimoki, Ugur Basak, UsefulDreams, Verner a, Vineetkrjoshi, Vprajkumar, Wayl, Webmink, Westpeter,<br />
Wikiwikiwikiwikiwiki, Woodjr, WulfTheSaxon, YUL89YYZ, 214 anonymous edits<br />
Gray Flimmer Source: http://en.wikipedia.org/w/index.php?oldid=331985933 Contributors: Malcolma, Rgopal, 4 anonymous edits<br />
Todd Greanier Source: http://en.wikipedia.org/w/index.php?oldid=368910388 Contributors: 1ForTheMoney, Alainr345, Anson2995, Bearcat, Jpbowen, Kyle1278, Oscarthecat, 4 anonymous<br />
edits<br />
Head First (book series) Source: http://en.wikipedia.org/w/index.php?oldid=338683996 Contributors: DoriSmith, Frecklefoot, Jerryobject, Kak, RayAYang, Tassedethe, 27 anonymous edits<br />
Jim Hugunin Source: http://en.wikipedia.org/w/index.php?oldid=368533905 Contributors: 1ForTheMoney, Alainr345, Andreas Kaufmann, Bruckie, Equarter, Hadrianheugh, Jacobolus,<br />
Jeodesic, Katharineamy, Sgodth, 10 anonymous edits<br />
Inner class Source: http://en.wikipedia.org/w/index.php?oldid=379495526 Contributors: Anwar saadat, Ashu8845, Brick Thrower, Ccarey, Daniel Brockman, Doug Bell, Green caterpillar,<br />
Harborsparrow, Hervegirod, Michael Slone, Mipper, Msyed, Nihiltres, Rich Farmbrough, Spoon!, Spug, Vald, Wootery, కిరణ్మయి, 21 anonymous edits<br />
Interface (Java) Source: http://en.wikipedia.org/w/index.php?oldid=364526965 Contributors: Agent Conundrum, Almost Anonymous, Andmatt, Anwar saadat, Cokoli, Corpx, Courcelles,<br />
Demitsu, Doug Bell, Dʒɑn, Ed g2s, EngineerScotty, Explanator, Fnielsen, Genpfault, Gmtress, Green caterpillar, GregorB, Hvn0413, Intgr, JaGa, Jamestochter, John Vandenberg, JonHarder,<br />
King of Hearts, Kulandai, Lexischemen, MER-C, Matthew0028, Mike0001, Moeron, Ordinant, Pcap, Pdelong, Petri Krohn, Phrenq, Piet Delport, Qwertyus, Radagast83, Sachinwfs, Sagaciousuk,<br />
Simeon, Spoon!, Telepheedian, Venkatsalem, Wigleboy, Wlievens, XDanielx, 101 anonymous edits<br />
Internet Foundation Classes Source: http://en.wikipedia.org/w/index.php?oldid=343164647 Contributors: DeXXus, Docu, Hervegirod, Jeepday, Marcobiscaro2112, Pegship, 5 anonymous<br />
edits<br />
JAD (JAva Decompiler) Source: http://en.wikipedia.org/w/index.php?oldid=377671774 Contributors: 2GooD, AlexWaelde, Daniel Roethlisberger, Dawynn, Green caterpillar, Ivmai77,<br />
Klausst, Merlin G., Midnight Comet, R'n'B, Tassedethe, Tomtheeditor, Yannick56, 20 anonymous edits<br />
JAD (file format) Source: http://en.wikipedia.org/w/index.php?oldid=368157547 Contributors: Amalas, Andrwsc, Bambinn, Coercorash, CyberSkull, David Haslam, Encyclopath, Excirial,<br />
Garas, Gurch, Jj137, JohnCD, Karsten.meier, Lauriwriter, Merbabu, Oda Mari, Patrick, Vegaswikian, Xaje, Zahakiel, 34 anonymous edits<br />
JAMWiki Source: http://en.wikipedia.org/w/index.php?oldid=375686267 Contributors: Audriusa, Dfisla, Ean5533, EvanProdromou, Gioto, Khartlage, Salamurai, Wrh2, 6 anonymous edits<br />
JGroups Source: http://en.wikipedia.org/w/index.php?oldid=297352083 Contributors: Alitokmen, John Vandenberg, Phatom87, Rigadoun, 7 anonymous edits<br />
JPicus Source: http://en.wikipedia.org/w/index.php?oldid=348860897 Contributors: Casablanca2000in, DanielRigal, Dv82matt, Katharineamy, Malcolma, Pavel.genevski<br />
Java Class Library Source: http://en.wikipedia.org/w/index.php?oldid=366545552 Contributors: Alainr345, Alansohn, Dxgriffiths, HamburgerRadio, Hervegirod, Hugh16, Phobos11,<br />
Romanc19s, ScottBlomquist, Tokek, Vocaro, Waldoalvarez00, 9 anonymous edits<br />
Java Classloader Source: http://en.wikipedia.org/w/index.php?oldid=378332996 Contributors: Aalvarez, Alainr345, Capn ed, Climbon, DenaDweller, Elpecek, GeoffMacartney, Ghettoblaster,<br />
Hervegirod, Isidore, Jengelh, JustAnotherJoe, Kreline, Krusch, Kwetal, MER-C, Michael Safyan, PaulRussell, Petri Krohn, Quarl, Romanc19s, Samkass, Sct72, Serpent's Choice, Timsabin,<br />
Urhixidur, Wikilolo, Wikimsd, Wknight94, 57 anonymous edits<br />
Java compiler Source: http://en.wikipedia.org/w/index.php?oldid=377671183 Contributors: Alansohn, AlonzoChurch, Caltas, CanisRufus, CesarB, Derek farn, Dogaroon, Doug Bell, Furrykef,<br />
HereToHelp, Hervegirod, Ike-bana, Joel12321ps, LittleDan, Oleg Alexandrov, Orderud, Pdwalker, Psycosonik222842, Quadell, Radagast83, Shanes, Spectre 25gt, TakuyaMurata, Thumperward,<br />
Tide rolls, Tomtheeditor, Tribaal, Tripleyew, Tvarnoe, 36 anonymous edits<br />
Java Development Kit Source: http://en.wikipedia.org/w/index.php?oldid=373992477 Contributors: Akendall, Alainr345, Alexey Izbyshev, Anantshayan, Apavlo, Bluemoose, Caowm, Centrx,<br />
Chochopk, Ctmt, DarkFalls, Dbabbitt, DeegC, Deineka, Dongiulio, Doug Bell, Easyas12c, Echawkes, Edknol, Elg fr, Epbr123, Feureau, Frap, Ftiercel, General Wesc, Graham87, Gronky,<br />
GrooveDog, Hervegirod, IOLJeff, Ike-bana, Improv, Isilanes, Itai, JLaTondre, JVz, John Vandenberg, JorgePeixoto, Kkm010, Kl4m-AWB, L daruwala, MIT Trekkie, Mark Renier, Melnakeeb,<br />
Michal.pise, Mmddyyyy, Mysdaao, Naradawickramage, Nixeagle, Nwbeeson, Octahedron80, Opticyclic, Philip Trueman, Plinkit, Ppntori, Qiq, RandomProcess, Rettetast, RossPatterson, Salsb,<br />
Saxifrage, Sfmontyo, Smyth, Softwaresavant, Soimort, Spoon!, Stefan h, Stephan Leeds, Swarm, TimTay, Toussaint, Valodzka, Vlad, Webmink, Wellithy, Winterst, WissensDürster,<br />
YUL89YYZ, Ylai, Yurikoles, 83 anonymous edits<br />
Java Interface Definition Language Source: http://en.wikipedia.org/w/index.php?oldid=354441014 Contributors: Alainr345, ChrisHibbert, Pammann, Shalom Yechiel, Sloman, 2 anonymous<br />
edits<br />
Java resource bundle Source: http://en.wikipedia.org/w/index.php?oldid=321826780 Contributors: Alansohn, J. Finkelstein, JLaTondre, Padrecamara, Rror, 3 anonymous edits<br />
Java TV Source: http://en.wikipedia.org/w/index.php?oldid=367075768 Contributors: Amareto2, IMSoP, Jandockx, Kathleen.wright5, Shalom Yechiel, Surachit, Tothebarricades.tk,<br />
WOSlinker, 6 anonymous edits<br />
Java Work Framework Source: http://en.wikipedia.org/w/index.php?oldid=328511613 Contributors: J04n, JLaTondre, Kosta.mosta, LilHelpa, Rror, Tassedethe, Tedickey<br />
Java annotation Source: http://en.wikipedia.org/w/index.php?oldid=372015952 Contributors: Abdull, Alelinuxbsd, Cafewalter, Cyde, Delirium, Dmccreary, Fatespeaks, Fred Bradstadt,<br />
JLaTondre, Jimmyzimms, Jwkpiano1, Kanonkas, Kesla, Nailbiter, Netizen, Ogai, Onjacktallcuca, Qutezuce, Sikon, Stagalj, Tchite, Techi2ee, Thumperward, Tyraios, W3bbo, 51 anonymous edits
Article Sources and Contributors 311<br />
Java collections framework Source: http://en.wikipedia.org/w/index.php?oldid=375536927 Contributors: Alainr345, Chrisahn, Chronodm, D, DenisKrivosheev, Eraserhead1, Explanator,<br />
Jespdj, Kamalraja, LINK3, Ohnoitsjamie, Prodoc, Qutezuce, Tassedethe, Toyota Dream House, Wikilolo, Wlievens, Wrp103, 10 anonymous edits<br />
Java concurrency Source: http://en.wikipedia.org/w/index.php?oldid=374383735 Contributors: Abortz, Alvin-cs, Anwar saadat, Black Pepper, Chowbok, JonHarder, M4gnum0n,<br />
Mati22081979, Veinor, Vonfraginoff, 8 anonymous edits<br />
Java syntax Source: http://en.wikipedia.org/w/index.php?oldid=378326840 Contributors: 16@r, Ahoerstemeier, Alainr345, Alexwright, AnOddName, Ash211, Aspects, Avenged Eightfold,<br />
AverageAmerican, AxelBoldt, Axlape, Barticus88, Benjiboi, Bigbluefish, Cairnarvon, CaptainVindaloo, Ceyockey, Chip Zero, Creidieki, D6, Dmyersturnbull, Doug Bell, Dvd Avins, Ed Poor,<br />
Edward, Excirial, Flash200, FreplySpang, Ftiercel, Gaius Cornelius, Geeman, Gilgamesh, Gortsack, Gracenotes, Hagerman, Hervegirod, HotXRock, Ikip, Jnc, Joe Schmedley, John of Reading,<br />
Jorge Stolfi, Karlzt, Kelly Martin, Ketiltrout, Kgwikipedian, Killy mcgee, King Mir, Leafyplant, LilHelpa, Lph, MBisanz, Maokart444, MarkSweep, Marvinscj, Max Schwarz, Maxwell Gerald<br />
Anderson, Mike.lifeguard, Montgomery '39, Mzanime, Neilc, Oysterguitarist, Princess Lirin, Quoth, Quuxplusone, RCX, RealBadApple, Remember the dot, Renesis, Ruud Koot, Salsia, Snowolf,<br />
Snowysquirrels, Someguy1221, SpaceLem, Sparky132, TakuyaMurata, Thumperward, Tobias Bergemann, Toussaint, Uncle G, Vihangvk, Wikimsd, Wiremore, Wtshymanski, ZeroOne, 148<br />
anonymous edits<br />
Java: <strong>View</strong> Technologies and Frameworks Source: http://en.wikipedia.org/w/index.php?oldid=366545291 Contributors: Fabrictramp, JonasMeinertz, Katharineamy, Matt5091, Mlavannis,<br />
Vendeka, Woohookitty, 7 anonymous edits<br />
JavaBeans Activation Framework Source: http://en.wikipedia.org/w/index.php?oldid=372079143 Contributors: NoNonsenseHumJock, Pammann, Shalom Yechiel, Stormbay, 1 anonymous<br />
edits<br />
JavaThreads Source: http://en.wikipedia.org/w/index.php?oldid=367334786 Contributors: 1ForTheMoney, Adimovk5, Andreas Kaufmann, Avalon, Fabrictramp, Katharineamy, Myjavaguru, 5<br />
anonymous edits<br />
javac Source: http://en.wikipedia.org/w/index.php?oldid=366877635 Contributors: Alansohn, Anwar saadat, Da rulz07, Frap, Hervegirod, Hgfernan, Ike-bana, Jonabbey, Oleg Alexandrov,<br />
Osndok, Ralmin, Spoon!, TakuyaMurata, Tkircher, 16 anonymous edits<br />
JavaFX Source: http://en.wikipedia.org/w/index.php?oldid=376249800 Contributors: AKA MBG, Alainr345, Anatolnsk, Arichnad, Arindamb, BenAveling, BlastStu, CapitalR, CardinalDan,<br />
Chase me ladies, I'm the Cavalry, Chekristo, Chowbok, Coty, Creek23, Cwlq, CyberSkull, Damiens.rf, Daniel newton, Darkfrog26, Deineka, Dotfx, DreamGuy, Dunkinacha, Faisal.akeel,<br />
Felixschrape, Ghettoblaster, GosiaCh, Gpvos, Grshiplett, HenryMinsky, Hervegirod, Hnarayanan, JavaKid, Jeshan, Jlweaver, Kinema, Kks krishna, Lkt1126, Local contributor, M1chu,<br />
M4gnum0n, Martarius, Mathiastck, Mugunth Kumar, Nabbia, Naku, Nurg, OssDev, Pqd, Publicly Visible, QBK2006, Raysonho, Rjwilmsi, Ronz, SaltyDawg, SamJohnston, Samdutton, Sherb,<br />
Shiki2, Simogasp, Sipoyraj, Sleske, Soumyasch, Surikov, Swarm, Tassedethe, Thumperward, Tokek, Toussaint, Van der Hoorn, Woodenfox, Wootery, Wwwwolf, ZZyXx, 115 anonymous edits<br />
Jawin Source: http://en.wikipedia.org/w/index.php?oldid=332020757 Contributors: MER-C, MZimmer, Pvss, Samir, Shalom Yechiel, Warren, 1 anonymous edits<br />
JExamples Source: http://en.wikipedia.org/w/index.php?oldid=380060395 Contributors: Alainr345, Andreas Kaufmann, Cwebster93, Eakle, Gennaro Prota, JLaTondre, Jonomacdrones,<br />
Kenb215, Midoladido, Nathan, RainbowCrane, Ronz, Tim1357, 8 anonymous edits<br />
Jfig Source: http://en.wikipedia.org/w/index.php?oldid=306624227 Contributors: Alpta, Benjaminevans82, Colonies Chris, EdGl, Hamitr, John Vandenberg, Kasjanek21, LQST, Rjsc, 5<br />
anonymous edits<br />
Jikes Source: http://en.wikipedia.org/w/index.php?oldid=366621186 Contributors: Chip Zero, Chruck, Delirium, Den fjättrade ankan, Doug Bell, Faisal.akeel, Fleminra, Frap, Greenrd, Greudin,<br />
Gronky, Grutness, Hervegirod, Interiot, Isilanes, Jarekadam, Kl4m-AWB, KnightRider, Lost-theory, Lumingz, Myork, Netizen, Segin, TakuyaMurata, Tedder, Thedaveshields, Wootery, Zil, 21<br />
anonymous edits<br />
jnSynch Source: http://en.wikipedia.org/w/index.php?oldid=333423646 Contributors: Janunezc, Kasjanek21, S. Ugarte, Uncle G, 2 anonymous edits<br />
Michael Kölling Source: http://en.wikipedia.org/w/index.php?oldid=365995556 Contributors: Artie p, DiablosDevil, Drbreznjev, Ed Fitzgerald, Gaius Cornelius, Garik, Gene Nygaard, JTA,<br />
JimVC3, John Vandenberg, John254, KarlFrei, Kraftlos, Lame Name, Lubiann, Possum, Rainalee au, Sky HIgh, Stephenchou0722, Timrollpickering, Tony Hunter, Utgard Loki, 27 anonymous<br />
edits<br />
List of Java keywords Source: http://en.wikipedia.org/w/index.php?oldid=376075258 Contributors: 16@r, Altenmann, Anwar saadat, Cheung1303, Chowbok, Creek23, Cybercobra, Doug<br />
Bell, Drae, DropDeadGorgias, Fx2, Gaius Cornelius, Green caterpillar, Henning Makholm, Jay, Jayzed882, Jinxed, KathrynLybarger, Kbdesai, Kusunose, M3tainfo, MarkSweep, Matt73,<br />
Muchness, Mzanime, Programming gecko, RCX, Rsrikanth05, Selket, Smyth, Spoon!, Thumperward, Tothwolf, Twi20Pi, Zhmort, Zwirello, 40 anonymous edits<br />
Marker interface pattern Source: http://en.wikipedia.org/w/index.php?oldid=352209532 Contributors: Ashutosh.shukla, Doug Bell, EALacey, Elf, Erechtheus, Jay, Jogloran, Jpp, Julesd,<br />
KevinTeague, MoraSique, NickBush24, OpenFuture, Piano non troppo, PolyGlot, Quagmire, RedWolf, SAE1962, Texture, Timwi, 26 anonymous edits<br />
Name mangling Source: http://en.wikipedia.org/w/index.php?oldid=376816035 Contributors: 16@r, AKGhetto, Abdull, Agnerf, AlistairMcMillan, Andreas Kaufmann, BB-Froggy, Benhoyt,<br />
Blaxthos, Bluetulip, Bovineone, BrokenBeta, Bvanderveen, Chmod007, Curps, DancingMan, Darkwind, David.Monniaux, DmitTrix, Doug Bell, Dysprosia, Eelis.net, Efa, Finlay McWalter,<br />
Fplay, Fredrik, Fresheneesz, Fumblebruschi, Gadfium, Gerbrant, Ghettoblaster, Itsme, Jalanpalmer, Jerryobject, Jesin, Jsmethers, Kate, Liangent, Marudubshinki, Matthew V Ball, Medinoc,<br />
Mirror Vax, Mr1278, Nimur, Orderud, PdDemeter, Percy Snoodle, Petri Krohn, Phatom87, Pinzo, Quuxplusone, Rich Farmbrough, Sam Hocevar, Solipsist, Stevenj, Strimo, Suruena,<br />
TakuyaMurata, Tausif.ik, Tedjn, TerraNova whatcanidotomakethisnottoosimilartosomeothername, Thecabinet, Thegeneralguy, TimBentley, VeryVeryTired, Wykypydya, Xezbeth, 63 anonymous<br />
edits<br />
Patrick Naughton Source: http://en.wikipedia.org/w/index.php?oldid=379356040 Contributors: 1ForTheMoney, Colonies Chris, Hervegirod, Jpbowen, Martarius, Merovingian,<br />
Moonriddengirl, MrStalker, 3 anonymous edits<br />
New I/O Source: http://en.wikipedia.org/w/index.php?oldid=379224036 Contributors: Aleksander Zawitkowski, Andyengle, Bluemoose, Bobo192, DJ Creature, DanielPitts, Doug Bell,<br />
Dthomsen8, Hervegirod, Julesd, KenFehling, Meonkeys, Noisy, Outlyer, Peter Grey, Plasticup, TakuyaMurata, Thegeneralguy, Tobias Bergemann, Uncopy, Urhixidur, Wragge, 38 anonymous<br />
edits<br />
Object type (object-oriented programming) Source: http://en.wikipedia.org/w/index.php?oldid=378790181 Contributors: Aj045, BenAveling, Brewthatistrue, Capricorn42, Chanlyn,<br />
ChanningWalton, Davidfstr, Doug Bell, Ed Poor, Egriffin, FlyHigh, Garyzx, Haakon, Jeff3000, Matt Crypto, Medinoc, Nuggetboy, Orderud, Pcap, R. S. Shaw, RJFJR, Rich Farmbrough,<br />
RockMFR, Rtistique, TakuyaMurata, Tobych, Workingonmygooglefu, Xaonon, 31 anonymous edits<br />
Omniscient Debugger Source: http://en.wikipedia.org/w/index.php?oldid=299648988 Contributors: Geni, John Vandenberg, Unforgettableid, Witchinghour, 1 anonymous edits<br />
OpenJDK Source: http://en.wikipedia.org/w/index.php?oldid=379455981 Contributors: 16@r, A.Lingo, Alainr345, Arifsaha, Audriusa, Bratch, Chealer, Choij, DStoykov, Dmyersturnbull,<br />
Dridus, Earthsound, EatMyShortz, Eugene Volchek, Euphoria, Flash200, Frap, Free Software Knight, Ghalas, Gnu andrew, Guyjohnston, Hervegirod, Jcarroll, Jimthing, Jm307, Lkt1126,<br />
LodeRunner, Mathiastck, Melnakeeb, Mranderson2008, Nabbia, NeMeSiS, Neustradamus, Phobos11, Pixel-fodder, Ramalho, Rjwilmsi, SF007, Specious, Stinerman, Theoneintraining, Tokek,<br />
Trasz, Two Bananas, WouterdeGroot, Wwwwolf, Yworo, ZeroOne, 63 anonymous edits<br />
PHP/Java Bridge Source: http://en.wikipedia.org/w/index.php?oldid=343363652 Contributors: AntPhillips, Etphonehome, Intgr, JLaTondre, JaGa, Methmann, MuffledThud, Steve carlson, 4<br />
anonymous edits<br />
Java package Source: http://en.wikipedia.org/w/index.php?oldid=363502245 Contributors: Akhristov, Alex43223, Anwar saadat, Blueharmony, Christan80, Clemens vi, Doug Bell, Dreadstar,<br />
Ed Poor, GeeJo, Grendelkhan, Henning Makholm, Hervegirod, ItsProgrammable, Jaxad0127, Jonik, Karl Dickman, LahiriB, Mandolinface, Markkauffman2000, Mbarbier, Mcorazao, Mentifisto,<br />
Mike Rosoft, Miko3k, Paramlaghane, Pearle, Pjvpjv, RedWolf, Ruchira37, Shadanan, Simeon, SonniWP, Vy0123, Willmtz, 40 anonymous edits<br />
Parboiled (Java) Source: http://en.wikipedia.org/w/index.php?oldid=367958629 Contributors: Ash, Elwikipedista, Rich Farmbrough, Sirthias, Tedickey<br />
Plain Old Java Object Source: http://en.wikipedia.org/w/index.php?oldid=366362072 Contributors: Adzinok, Alainr345, Alesj, Bachrach44, Bart Carny, Bertport, Besem, Bruguiea,<br />
Chillmann, China Crisis, Chronist, Coleopterous, DasAlbatross, Donsez, Dthomsen8, Ed Poor, Emmanuel.keller, Epbernard, Fred Bradstadt, Gracenotes, Graham87, Haakon, IWikediana,<br />
Iridescent, Jay, Johnny Kewl, Jpp, Kennardconsulting, Keylay31, Lunacrescens, MLRoach, Magioladitis, Mild Bill Hiccup, Mumia-w-18, Nburden, OlavN, Plugwash, Plumpurple, Raul Lapeira,<br />
Rbonvall, Rdvdijk, Rpawson, Sspecter, Stevage, WikiFan04, Zoquero, 99 anonymous edits
Article Sources and Contributors 312<br />
Pluggable look and feel Source: http://en.wikipedia.org/w/index.php?oldid=330618711 Contributors: Barnacles phd, Doczilla, Hervegirod, Julesd, Michael miceli, Pegship, RedWolf, Rjwilmsi,<br />
3 anonymous edits<br />
Primitive wrapper class Source: http://en.wikipedia.org/w/index.php?oldid=336364034 Contributors: Bovineone, Chip Zero, Doug Bell, Ed Poor, Ekamaloff, Hervegirod, John Vandenberg,<br />
Mareeswaran.m, Matthew0028, Naohiro19, Quilokos, Tobias Bergemann, Vedant lath, Wimt, 19 anonymous edits<br />
Project Semplice Source: http://en.wikipedia.org/w/index.php?oldid=354488754 Contributors: Cmdrjameson, Creek23, Greenrd, RTucker, 3 anonymous edits<br />
Quark Framework Source: http://en.wikipedia.org/w/index.php?oldid=370974561 Contributors: Btyner, CRGreathouse, ConalElliott, Gcom, Inferno, Iridescent, IvanAndreevich, Luke.evans,<br />
R'n'B, René Vincent Jansen, Tabletop, Tassedethe, Thumperward, 5 anonymous edits<br />
REPLAY (software) Source: http://en.wikipedia.org/w/index.php?oldid=361237690 Contributors: James R. Ward, LilHelpa, NJA, Oas777, SoWhy, Stuartyeates, 3 anonymous edits<br />
Real time Java Source: http://en.wikipedia.org/w/index.php?oldid=373239585 Contributors: Abdull, Buntfalke, CanisRufus, Dautelle, Dcoetzee, Donsez, Dusclaux, FlyHigh, Fultonm,<br />
Jamesjhunt, Jm307, John Gorn, Jsmethers, LaurentMeilleur, NapoliRoma, On5deu, Paddles, Pearle, Radagast83, RasputinAXP, Rror, Schoeberl, Skyemoor, Stemonitis, Tarret, Vörös, 31<br />
anonymous edits<br />
Resource (Java) Source: http://en.wikipedia.org/w/index.php?oldid=329573963 Contributors: Debresser, Fasten, JerroldProthero, John Vandenberg, Shyam, 2 anonymous edits<br />
Restlet Source: http://en.wikipedia.org/w/index.php?oldid=378167831 Contributors: Alainr345, Avi4now, JLaTondre, Malcolma, Robheittman, 14 anonymous edits<br />
Retrotranslator Source: http://en.wikipedia.org/w/index.php?oldid=332489708 Contributors: Davidedelvento, Fredrick Night, Hervegirod, 1 anonymous edits<br />
SLAMD Source: http://en.wikipedia.org/w/index.php?oldid=300258495 Contributors: Benfred, Blaxthos, C777, EagleOne, Ff1959, JLaTondre, NapoliRoma, Sshoaff<br />
SLAMD Server Source: http://en.wikipedia.org/w/index.php?oldid=302640824 Contributors: Dino, Ff1959, J04n<br />
SLF4J Source: http://en.wikipedia.org/w/index.php?oldid=373825379 Contributors: Ashik, Bostonvaulter, Cgulcu, M4gnum0n, Malcolmxl5, RickBeton, SzpakEng, Tassedethe, Tedickey,<br />
Tedyu002, 9 anonymous edits<br />
Bruno Souza Source: http://en.wikipedia.org/w/index.php?oldid=372286903 Contributors: Damiens.rf, Jpbowen, Kitudo, Mwalder, Rich Farmbrough, Vmeruck, 2 anonymous edits<br />
Static import Source: http://en.wikipedia.org/w/index.php?oldid=379160043 Contributors: Melchoir, Omahaprogrammer, 2 anonymous edits<br />
StormMQ Source: http://en.wikipedia.org/w/index.php?oldid=370843656 Contributors: Ranjithsutari, Raphcohn<br />
strictfp Source: http://en.wikipedia.org/w/index.php?oldid=367892479 Contributors: Atomota, Dddenton, Dmyersturnbull, Doug Bell, Enochlau, Faisal.akeel, Glasser, Iamnitin, JSMoller,<br />
Jackzhp, Mipadi, Rich Farmbrough, Thryduulf, 22 anonymous edits<br />
String Buffer Source: http://en.wikipedia.org/w/index.php?oldid=373917932 Contributors: Acdx, Alainr345, Andmatt, Evaders99, Joshporter, Malcolma, Michael Hardy, Rjwilmsi, RockMFR,<br />
TakuyaMurata, Vald, Voice of All, Wwwwolf, 8 anonymous edits<br />
Sun Web Developer Pack Source: http://en.wikipedia.org/w/index.php?oldid=336745405 Contributors: Alainr345, Ijevans, Rjwilmsi, 3 anonymous edits<br />
Swing (Java) Source: http://en.wikipedia.org/w/index.php?oldid=377420554 Contributors: ALFP, Abhinav.rajsingh, AnOddName, Anna Lincoln, Appraiser, Audriusa, Avitaltr, Bewildebeast,<br />
Blackbyrus, Bobgerac, BrianDuff, CAkira, CannotResolveSymbol, ChKa, Coconut99 99, Crosstimer, Darrien, Dave Messina, Davetron5000, Denizstij, Dgrant, Doug Bell, Dugwiki, Dxgriffiths,<br />
ESkog, EatMyShortz, Echawkes, Eghbali, Elf, Explanator, Faisal.akeel, Feezo, Furrykef, Garoad, Gobias industries inc, Harry Wood, Hem1234, Hervegirod, Hu12, Iamthenew!!, Ike-bana,<br />
Invalidname, Isnow, Jacek79, JackieBird, Jarsyl, Jaydeki, Jeshan, Jfrascencio, Jjaazz, Johnflan, Jokes Free4Me, JonHarder, Juancnuno, Justin W Smith, Kauczuk, Laterality, MC10, MIT Trekkie,<br />
MaNeMeBasat, Maxim.zakharenkov, Meegs, Michalis Famelis, Mikeshk, MinorContributor, Mjparme, Mucus, Mygerardromance, Ocatecir, Ojigiri, Peruvianllama, Plustgarten, Pmsyyz, Poccil,<br />
Prodoc, Prolog, Rafael.afonso, RedWolf, Rich Farmbrough, Rjwilmsi, Rockear, Rodhullandemu, Romanc19s, Rubicon, SJP, Saintamh, Salix alba, Sam Korn, Sebastian.Dietrich, Shinmawa,<br />
Sikon, Simonjl, SkiBumMSP, Spasemunki, Squiggleslash, Stacrd, Stolsvik, Tarquin, Thatfunkymunki, The wub, Themusicgod1, Thumperward, Toussaint, Traroth, Vnsd, Weichbrodt, Wellithy,<br />
Wootery, WreckLoose, 230 anonymous edits<br />
SwingLabs Source: http://en.wikipedia.org/w/index.php?oldid=364207864 Contributors: Alainr345, Hervegirod<br />
Synth Look and Feel Source: http://en.wikipedia.org/w/index.php?oldid=371233438 Contributors: Ghettoblaster, Hervegirod, Pegship, Powerlord, 6 anonymous edits<br />
TeachScheme! Source: http://en.wikipedia.org/w/index.php?oldid=369013022 Contributors: Cat Parade, Chriscorv4, Clements, Ilmari Karonen, Instinct, JLaTondre, JonHarder, Lexein,<br />
Matthias.f, Woohookitty, 23 anonymous edits<br />
The Java Posse Source: http://en.wikipedia.org/w/index.php?oldid=370922550 Contributors: Betacommand, Blue520, Doug Bell, FunHappySprinkles, Grstain, Gwern, Invalidname, JavaKid,<br />
Jlandin, Kenb215, MarsRover, Matt Crypto, Muzzamo, Shalom Yechiel, Vjosullivan, Wwiktorr, 16 anonymous edits<br />
Unified Expression Language Source: http://en.wikipedia.org/w/index.php?oldid=317810356 Contributors: Hannabee, Jérôme, Madalino, Pinanti, Weggie, 4 anonymous edits<br />
Java Virtual Machine Source: http://en.wikipedia.org/w/index.php?oldid=379985491 Contributors: @modi, A3csc300, AWendt, Aavviof, Abarnea 2000, Abu badali, Ahoerstemeier,<br />
Alainr345, Aldie, Alifakoor, Alphachimp, Alphax, AnOddName, Andre Engels, Angitha.t, Anwar saadat, Arrenlex, Atramos, Axlq, Bawolff, BeauPaisley, Blue Em, Boing! said Zebedee, Bryan<br />
Derksen, Burschik, CALR, Cactus.man, Calm, Chrismear, ClashTheBunny, Classicalecon, CodeMonk, Congruence, Conversion script, CyberSkull, Cyp, Dalvizu, Damian Yerrick, Danhicks,<br />
DataWraith, Dave Cohoe, David Gerard, DavidCary, Dbabbitt, Debackerl, Dejvid, Delirium, Derek farn, Dnstest, Doradus, Doug Bell, DougsTech, Dreish, Ds13, EatMyShortz, Epbr123, Frap,<br />
Fromageestciel, Furrykef, Gazpacho, Ghettoblaster, Gtoal, Gwernol, Haakon, Hairy Dude, Happysailor, Harborsparrow, Harp, Hdante, Headius, Hervegirod, Hfastedge, Hirzel, Hu12, Iane,<br />
Igoldste, Intgr, J E Bailey, JWB, Jabman, JacobBramley, Jason.grossman, Jim88Argentina, Jj137, Joaopaulo1511, Joehni, John of Reading, JokerXtreme, Jondel, Karl Dickman, Khalid hassani,<br />
Kishonti, Kks krishna, Krishan.sunbeam, Kuasha, Kungfuadam, Lee J Haywood, Liberty Miller, Livy the pixie, Lumingz, Ma8thew, Mariolina, Mav, Mboverload, Mfc, Miko3k, Mjscud,<br />
Moa3333, Modster, Moppet65535, Napi, Neilc, Nemti, Ng.j, Nickg, NoIdeaNick, Nuno Tavares, Oleg Alexandrov, Ortolan88, Paul Foxworthy, Pegasus1138, Phyzome, Plasticup, Poccil,<br />
Quaysea, Rakesh.usenet, Randolf Richardson, Raven4x4x, RedWolf, Rich Farmbrough, Rursus, SAE1962, SF007, SJP, Sander123, Schoeberl, Shadowjams, Sixth Estate, Slamb, Smarkflea,<br />
Smjg, Smyth, Square87, Stephen B Streater, Stw, Tagus, Takis, TakuyaMurata, The Anome, Thumperward, TimTay, TittoAssini, ToddFincannon, Toussaint, Tyomitch, UU, Underpants,<br />
Unsungzeros, VasilievVV, Versus22, Vicarious, Vinny, VladimirReshetnikov, Vy0123, Weregerbil, Whiner01, Whispering, Wikicrusader, Woohookitty, Wootery, Wrelwser43, Xevious, Yar2,<br />
Yozh, 258 anonymous edits<br />
Xerlin Source: http://en.wikipedia.org/w/index.php?oldid=367971010 Contributors: Beeblebrox, Elwikipedista, Iamthenewno2, Koavf, Ron Ritzman, Tassedethe, Tothwolf, WikiLaurent, 2<br />
anonymous edits<br />
XStream Source: http://en.wikipedia.org/w/index.php?oldid=367972218 Contributors: Alansohn, Andreas Kaufmann, Bryan Derksen, Den fjättrade ankan, DrHok, Elwikipedista, Fedor,<br />
Gronky, Haschuur, Isilanes, John Vandenberg, Kl4m-AWB, Laserprinter, M4gnum0n, Melab-1, Pegship, Rich Farmbrough, Rror, SmackEater, Xmlizer, 5 anonymous edits
Image Sources, Licenses and Contributors 313<br />
Image Sources, Licenses and Contributors<br />
File:Java logo.svg Source: http://en.wikipedia.org/w/index.php?title=File:Java_logo.svg License: unknown Contributors: Eastmain, MBisanz, Sophus Bie, The wub, TimTay, Tkgd2007,<br />
Webmink, 2 anonymous edits<br />
File:Wikibooks-logo-en.svg Source: http://en.wikipedia.org/w/index.php?title=File:Wikibooks-logo-en.svg License: logo Contributors: User:Bastique, User:Ramac<br />
File:Wave.svg Source: http://en.wikipedia.org/w/index.php?title=File:Wave.svg License: unknown Contributors: sbmehta converted to SVG from Sun Microsystems AI version.<br />
Image:JavaPlatform.png Source: http://en.wikipedia.org/w/index.php?title=File:JavaPlatform.png License: unknown Contributors: Sun Microsystems, Inc.<br />
Image:Wave.svg Source: http://en.wikipedia.org/w/index.php?title=File:Wave.svg License: unknown Contributors: sbmehta converted to SVG from Sun Microsystems AI version.<br />
Image:Agentsheets IDE.jpg Source: http://en.wikipedia.org/w/index.php?title=File:Agentsheets_IDE.jpg License: Public Domain Contributors: User:Dragentsheets<br />
Image:AS-projects.jpg Source: http://en.wikipedia.org/w/index.php?title=File:AS-projects.jpg License: Public Domain Contributors: Dragentsheets<br />
File:Java applet.png Source: http://en.wikipedia.org/w/index.php?title=File:Java_applet.png License: Public Domain Contributors: User:Audriusa<br />
File:OpenAstex<strong>View</strong>er.jpg Source: http://en.wikipedia.org/w/index.php?title=File:OpenAstex<strong>View</strong>er.jpg License: GNU Lesser General Public License Contributors: Original uploader was<br />
Audriusa at en.wikipedia<br />
File:Cardiac cells applet.png Source: http://en.wikipedia.org/w/index.php?title=File:Cardiac_cells_applet.png License: GNU General Public License Contributors: Elizabeth Cherry and Flavio<br />
Fenton (see )<br />
File:Mandelbrot java applet.png Source: http://en.wikipedia.org/w/index.php?title=File:Mandelbrot_java_applet.png License: GNU General Public License Contributors: Original uploader<br />
was Audriusa at en.wikipedia<br />
File:ChessApplet.png Source: http://en.wikipedia.org/w/index.php?title=File:ChessApplet.png License: BSD Contributors: Original uploader was Audriusa at en.wikipedia<br />
File:NASA World Wind.jpg Source: http://en.wikipedia.org/w/index.php?title=File:NASA_World_Wind.jpg License: unknown Contributors: Deadstar, WikipediaMaster<br />
File:Remoteconsoleapplet.png Source: http://en.wikipedia.org/w/index.php?title=File:Remoteconsoleapplet.png License: unknown Contributors: Audriusa<br />
Image:Aujac logo oficial.jpg Source: http://en.wikipedia.org/w/index.php?title=File:Aujac_logo_oficial.jpg License: Creative Commons Attribution 3.0 Contributors: User:Jordi.pujol.ulied<br />
Image:Logo jjc 2003.jpg Source: http://en.wikipedia.org/w/index.php?title=File:Logo_jjc_2003.jpg License: Creative Commons Attribution 3.0 Contributors: User:Jordi.pujol.ulied<br />
Image:Inauguracio.jpg Source: http://en.wikipedia.org/w/index.php?title=File:Inauguracio.jpg License: Creative Commons Attribution 3.0 Contributors: User:Jordi.pujol.ulied.<br />
Image:Aujac cartell jjc2004.jpg Source: http://en.wikipedia.org/w/index.php?title=File:Aujac_cartell_jjc2004.jpg License: Creative Commons Attribution 3.0 Contributors:<br />
User:Jordi.pujol.ulied<br />
Image:Aujac cartell jjc2005.jpg Source: http://en.wikipedia.org/w/index.php?title=File:Aujac_cartell_jjc2005.jpg License: Attribution Contributors: User:Jordi.pujol.ulied<br />
Image:Aujac sun tech day sabadell.jpg Source: http://en.wikipedia.org/w/index.php?title=File:Aujac_sun_tech_day_sabadell.jpg License: Creative Commons Attribution 3.0 Contributors:<br />
User:Jordi.pujol.ulied<br />
Image:Aujac soci honor 2003 jordi roig.jpg Source: http://en.wikipedia.org/w/index.php?title=File:Aujac_soci_honor_2003_jordi_roig.jpg License: Creative Commons Attribution 3.0<br />
Contributors: User:Jordi.pujol.ulied<br />
Image:Aujac soci honor 2004 eduard elias.jpg Source: http://en.wikipedia.org/w/index.php?title=File:Aujac_soci_honor_2004_eduard_elias.jpg License: Creative Commons Attribution 3.0<br />
Contributors: User:Jordi.pujol.ulied<br />
Image:javapolis1.jpg Source: http://en.wikipedia.org/w/index.php?title=File:Javapolis1.jpg License: Creative Commons Attribution-Sharealike 2.5 Contributors: Sjabejug<br />
Image:javapolis2.jpg Source: http://en.wikipedia.org/w/index.php?title=File:Javapolis2.jpg License: Creative Commons Attribution-Sharealike 2.5 Contributors: Sjabejug<br />
File:James_Gosling_2008.jpg Source: http://en.wikipedia.org/w/index.php?title=File:James_Gosling_2008.jpg License: Attribution Contributors: User:Peter Campbell<br />
Image:Java logo.svg Source: http://en.wikipedia.org/w/index.php?title=File:Java_logo.svg License: unknown Contributors: Eastmain, MBisanz, Sophus Bie, The wub, TimTay, Tkgd2007,<br />
Webmink, 2 anonymous edits<br />
Image:Java keywords highlighted.png Source: http://en.wikipedia.org/w/index.php?title=File:Java_keywords_highlighted.png License: Creative Commons Attribution-Sharealike 3.0<br />
Contributors: User:Programming gecko<br />
Image:JavaFX logo.jpg Source: http://en.wikipedia.org/w/index.php?title=File:JavaFX_logo.jpg License: unknown Contributors: GosiaCh, Salavat, Ysangkok<br />
Image:CALlogo3D.png Source: http://en.wikipedia.org/w/index.php?title=File:CALlogo3D.png License: Public Domain Contributors: Luke.evans<br />
File:Bruno_Souza.jpg Source: http://en.wikipedia.org/w/index.php?title=File:Bruno_Souza.jpg License: Public Domain Contributors: Damiens.rf, Kitudo<br />
Image:Gui-widgets.png Source: http://en.wikipedia.org/w/index.php?title=File:Gui-widgets.png License: GNU General Public License Contributors: Alex.ryazantsev, Faxe, Sven, Theoteryi,<br />
Wutsje, 3 anonymous edits<br />
File:AWTSwingClassHierarchy.png Source: http://en.wikipedia.org/w/index.php?title=File:AWTSwingClassHierarchy.png License: Public Domain Contributors: Jakub Závěrka<br />
Image:Java-posse.jpg Source: http://en.wikipedia.org/w/index.php?title=File:Java-posse.jpg License: Creative Commons Attribution 2.0 Contributors:<br />
http://www.flickr.com/photos/joenuxoll/315005590/
License 314<br />
License<br />
Creative Commons Attribution-Share Alike 3.0 Unported<br />
http:/ / creativecommons. org/ licenses/ by-sa/ 3. 0/