The builder Hello () initializes the frame or frame by calling method setDefaultCloseOperation (int) inherited from JFrame to establish operations by default when control of closure in the title bar is selected to the value WindowConstants.DISPOSE_ON_CLOSE. This makes released the funds taken out of the window when it is closed, and not simply hidden, which allows the virtual machine and the program finish their execution. Then establishing an object type JLabel with the text “Hello, world!”, And is added to the framework using the method add (Component), inherited from the Container class. The method pack (), inherited from the Window class, is invoked to scale the window and distribute its content.
The method main () is called by the JVM at the beginning of the program. Create an instance of the class Hello and makes the window is shown by invoking the method setVisible (boolean) of the superclass (class of inheriting) with a true parameter. See, once the frame is drawn, the program does not end when it leaves the method main (), because the code is dependent on a thread and launched an independent, and that will remain active until all the windows have been destroyed.
Operating Environments
The design of Java, its strength, supported by the industry and its easy portability have made Java one of the languages with higher growth and extent of use in various fields of information technology industry.
In mobile devices and embedded systems
Since the inception of the specification J2ME (Java 2 Platform, Micro Edition), a version of the Java Runtime Environment and highly optimized small, specially developed for the market for consumer electronics devices has produced a revolution in terms of the extension Java is concerned.
You may find microprocessors designed specifically to execute bytecode Java and Java software for smart cards (JavaCard), mobile phones, pagers, set-top-boxes, TV tuners and other small appliances.
The development model of these applications is very similar to the applets browsers except that in this case are called MIDlets.
See Sun Mobile Device Technology
In the Web browser
Since the first version of java there is the possibility of developing small applications (applets) in Java that can then be embedded in an HTML page to be downloaded and executed by the web browser. These mini-applications run on a JVM that the browser is configured as an extension (plug-in) in a security context configurable restricted to prevent the local implementation of potentially malicious code.
The success of such applications (vision equipment Gosling) was not really expected because of various factors, perhaps the most important being the slow and reduced width banda of communications at the time that limited the size of applets that are embedded in the browser. The subsequent emergence of alternatives (dynamic web applications server) left a small field of use for this technology, now being relegated primarily to specific components for intermediation from a dynamic web application server with devices located on the client machine running browser.
The Java applets are not the only technology (although the first) of complex components embedded in the browser. Other technologies may be similar: Microsoft ActiveX, Flash, Java Web Start, etc..
In server systems
In part server, Java is more popular than ever, since the emergence of the specification of Servlets and JSP (Java Server Pages).
Until then, the dynamic web server applications that existed were based primarily on components CGI languages and interpreted. Both had various drawbacks (mainly slow, high burden of memory and computational or propensity for mistakes by his dynamic interpretation).
The servlets and JSPs represented a major breakthrough because:
* The API programming is quite simple, flexible and expandable.
* Servlets are not independent processes (such as CGIs) and therefore are executed within the same process that the JVM significantly improving performance and reducing the burden computational and memory required.
* The JSPs are compiled pages that are dynamically (or pre-compiled prior to distribution) so that the code that achieves a substantial advantage in performance compared to many languages interpreted.
The specification of Servlets and JSPs defines an API programming and requirements for a container (server) within which these components can be deployed to form complete dynamic web applications. Today there are many containers (free trade) compatible with these specifications.
Since its expansion between the developer community, these technologies have given way to development models with much more elaborate frameworks (eg Struts, Webwork) that overlap on servlets and JSPs to achieve a working environment much more powerful and segmented where the specialization of roles possible (developers, graphic designers, …) and facilitate reuse and robustness of code. Despite all this, the underlying technologies (servlets and JSPs) are substantially the same.
This working model has become a de-facto standard for developing dynamic web applications server and other technologies (pe. ASP) have relied on him.
In desktop applications
Today there are many user-based graphics applications in Java. The Java Runtime Environment (JRE) has become a routine component in the PC user most popular operating systems used in the world. In addition, many Java applications include the inside of the application package so that its implementation in any PC.
In the first versions of the Java platform there were significant limitations in the APIs graphical development (AWT). Since the appearance of the library Swing the situation improved substantially and subsequently with the emergence of bookstores as SWT render development of desktop applications and complex with great dynamism, usability, etc.. is relatively straightforward.
Supported Platforms
A version of the Java Runtime Environment JRE (Java Runtime Environment) is available in most desktops. However, Microsoft has not included it in its default operating systems. In the case of Apple, it includes a version of JRE on its own operating system, Mac OS. It is also a product that appears by default on most Linux distributions. Due to incompatibilities between different versions of the JRE, many applications prefer to install its own copy of the JRE before entrusting their fate to the application installed by default. The developers of Java applets or should insist to users in updating JRE or develop under an old version of Java and verify the proper functioning in later versions.
Industry related
Sun Microsystems, as a creator of the Java platform and the JDK, maintains strong policies to maintain a specification language [1] as well as the virtual machine [2] through the JCP. It is because of this effort which maintains a de facto standard.
There are countless companies that develop applications for Java and / or are directed to this technology:
* The mobile phone industry is strongly influenced by Java technology.
* The development environment Eclipse has taken an important place among the community of Java developers.
* The Apache Foundation also has a significant presence in the development of libraries and server components based on Java.
* IBM, BEA, Iona, Oracle, … are large companies with vested interests and products and in Java.
Criticisms
Harold said in 1995 that Java was created to open a new path in managing complex software, and is generally accepted that has behaved well in that aspect. But one can not say that Java has no cracks, or fully adapted to all styles of programming, all settings, or all the needs.
General
* Java has not provided skills standards for floating point arithmetic. The IEEE standard for 754 “Standard for Binary Arithmetic in Floating Point” appeared in 1985 and since then is the standard for the industry. And although the arithmetic floating Java (which changed from November 13, 2006, when it opened the source code and adopted the GNU license, besides the already existing) se basa largely on the IEEE standard, not still supports some features. More information on this subject can be found in the final section of external links.
The language
* In a strict sense, Java is not a completely object-oriented language, unlike, for example, Ruby and Smalltalk. For reasons of efficiency, Java has relaxed to some extent the paradigm object oriented, and thus for example, not all values are objects.
* Java code can sometimes be redundant in comparison with other languages. This is partly due to the frequent statements of rates and conversions type manual (casting). It is also due to the unavailability of operators overloaded, and a relatively simple syntax. However, J2SE 5.0 introduces elements to try to reduce redundancy, as a new building for loops” ‘foreach”’.
* Unlike C + +, Java does not have operators overload defined by the user. However this was a design decision that can be seen as an advantage, since this characteristic can make programs difficult to read and maintain.
Appearance
The outward appearance (” ‘look and feel”’) applications GUI (Graphical User Interface) written in Java using the platform Swing often differs from that show native applications. Although the developer can use the toolkit AWT (Abstract windowing Toolkit) that generates graphic objects of the native platform, the AWT is not capable of advanced graphics features without sacrificing portability between platforms, because each has a different set of APIs , Especially for high-level graphic objects. The tools of Swing, written entirely in Java, avoids this problem by building the graphic objects from the drawing basic mechanisms that should be available on all platforms. The downside is the extra work required to achieve the same appearance of the target platform. Although this is possible (using GTK + and the look-and-feel of Windows), most users do not know how to change the appearance that is provided by default one that adapts to the platform. Mention deserves the optimized version of the language.
Performance
The performance of an application is determined by many factors, so it is not easy to make a comparison that is totally objective. At runtime, a Java application performance depends more on the efficiency of the compiler, or JVM, that of the intrinsic properties of language. The Java bytecode can be interpreted at runtime by the virtual machine, or compiled to load the program, or during the execution itself, to generate native code that runs directly on the hardware. If it is interpreted, it will be slower than using the machine code intrinsic target platform. If compiled during the initial charge or enforcement, the penalty is at the time needed to complete the compilation.
Some characteristics of the language itself carry a penalty in time, although not unique Java. Some of them are checking the limits of arrays, check-in time delivery rates, and indirección of virtual functions.
Using a garbage collector for automatically removes those objects not required adds an overload that can affect performance, or be barely noticeable, depending on the technology of the collector and the application. The JVM using modern garbage collectors who, thanks to fast memory management algorithms, get some applications that can run more efficiently.
The yield of a compiler and JIT compilers natives may be similar, although the distinction is unclear at this point. The compilation by the JIT can consume a considerable time, mainly an inconvenience for applications or short-term with a lot of code. However, once compiled, program performance can be comparable to that achieved native compilers target platform, including numerical tasks. Although Java does not allow for the expansion manual calls to methods, many JIT compilers perform this optimization during the burden of implementation and can leverage information runtime to carry out efficient processing during the execution of the application itself. This dynamic recompilation, as provided by the Sun HotSpot virtual machine, you can get to improve the outcome of traditional static compilers, thanks to data that are available only during the time of execution.
Java was designed to provide security and portability, and offers no direct access to hardware architecture or the address space. Java does not support expansion of assembly code, although applications can access features low-level libraries using native (JNI, Java Native Interface).
Resources
JRE
The JRE (Java Runtime Environment, or runtime Java) is the software necessary to run any application developed for the Java platform. The end-user uses the JRE as part of software packages or plug-ins (or connectors) in a Web browser. Sun also offers the Java 2 SDK, or JDK (Java Development Kit) within which lies the JRE, and includes tools like the Java compiler, Javadoc to generate documentation or scrubber. It can also be obtained as a separate package, and can be seen as the necessary environment to run a Java application, while a developer must also have other facilities of the JDK.
Components
* Libraries Java, which are the result of compiling the source code developed by whoever implements the JRE, and offering support for development in Java. Examples of these libraries are:
o The central libraries, which include:
+ A collection of libraries to implement data structures such as lists, arrays, trees and sets.
+ Libraries for analysis of XML.
+ Security.
+ Libraries internationalization and localization.
Libraries or integration, allowing communication with external systems. These libraries include:
+ The API for access to databases JDBC (Java DataBase conectivity).
+ The interface JNDI (Java Naming and Directory Interface) for directory services.
+ RMI (Remote Method Invocation) and Corba for the development of distributed applications.
or Libraries for the user interface, including:
+ The toolkit native AWT (Abstract windowing Toolkit), which provides components GUI (Graphical User Interface), mechanisms to use and manage their associated events.
+ Libraries Swing, built on AWT but offered no native implementations of the components of AWT.
+ APIs for catching, processing and audio playback.
* An implementation dependent on the platform that runs the Java Virtual Machine (JVM), which is responsible for implementing the code of bookstores and external applications.
* Plugins or connectors that allow applets run in Web browsers.
* Java Web Start, for the distribution of Java applications through the Internet.
* Documentation and licensing.
APIs
Sun defines three platforms in an attempt to fill a variety of application environments. It has distributed many of its APIs (Application Program Interface) so that belong to each of the platforms:
* Java ME (Java Platform, Micro Edition) or J2ME – oriented environments with limited resources, such as cell phones, PDAs (Personal Digital Assistant), etc..
* Java SE (Java Platform, Standard Edition) or J2SE – for mid-range environments and workstations. Here lies the average user on a PC desktop.
* Java EE (Java Platform, Enterprise Edition) or j2ee – aimed at distributed environments or Internet business.
Classes in the Java APIs are organized into groups called disjuntos packages. Each package contains a set of interfaces, classes and related exceptions. Information on the packages offered by each platform can be found in the documentation of it.
All the APIs is controlled by Sun Microsystems along with other entities or persons through the program JCP (Java Community Process). Companies or individuals participating in the JCP can influence an active role in the design and development of the APIs, which has been a source of controversy.
In 2004, IBM and BEA publicly supported the idea of creating an implementation of open source (open source) Java, something that Sun, dated 2006, has refused.
Extensions and related architectures
The Java extensions are in packages that hang from the root javax: javax .*. Not included in the JDK or JRE. Some of the extensions and architectures closely linked to Java are:
* Java EE (Java Platform, Enterprise Edition; before j2ee)-for distributed applications-oriented business environment
* Java ME (Java Platform, Micro Edition; before J2ME)-for devices with limited resources such as cell phones and PDAs
* JMF (Java Media Framework)
* JavaHelp
* JavaMail
* JNDI (Java Naming and Directory Interface)
* JSML (Java Speech API Markup Language)
* JDBC (Java Database Connectivity)
* JDO (Java Data Objects)
* JAI (Java Advanced Imaging)
* JAIN (Java APIs for Integrated Networks)
* JDMK (Java Dynamic Management Kit)
* Jini (a network architecture for building distributed systems
* Jiro
* Java Card
* JavaSpaces
* JML (Java Modeling Language)
* JMI (Java Metadata Interface)
* JMX (Java Management Extensions)
* JSP (JavaServer Pages)
* JSF (JavaServer Faces)
* NYI (Java Native Interface)
* JXTA (Protocols open for virtual networks Peer-to-peer or P2P)
* Java 3D (A high-level API for 3D graphics programming)
* JOGL (Java OpenGL-A low-level API for programming using OpenGL graphics)
* LWJGL (Light Weight Java Game Library-A low-level API for access to OpenGL, OpenAL and several input devices)
* Marfa (Modular Audio Recognition Framework)
* OSGi (Dynamic Remote Service Management and Maintenance)
Java into open source
Java has become a language with a massive deployment in all environments (personal and business). The Sun maintains control over it generates resistance in the community of companies with strong interests in Java (eg IBM, Oracle) and obviously in the community of free software developers.
The evolution based on a committee with the participation of all concerned is not enough and the community has long demanded the release of APIs and libraries of the core JDK.
How far Java software is free?
In December 2006, Sun is in full relaunch of its Java platform under the GNU license GNU. When this change licensing finished, we hope that Java is no longer a trap (source (see note is in the yellow box))
Commitment from Sun Microsystems to open source
The importance of open source in connection with Java can be seen among other things, that the president and CEO of Sun, Jonathan Schwartz, has challenged the company to offer for the entire open source software that produces Sun (source), and Sun have long since started to bet on open source when released StarOffice (now called OpenOffice).
Sun has contributed more lines of open source than any other organization (source) Richard Stallman also believes that it (source)
* The success of open source – Article seat on the official site in Spanish Sun Microsystems, which speaks of the bet by Sun Microsystems open source.
Free alternative
There are alternatives sufficiently mature environment for the development and implementation of Java with a wide coverage of features regarding commercial deployments of Sun, IBM, Bea, …
* Blackdown Java for Linux, includes a plugin for Mozilla
* GNU Classpath GNU – currently being merged with libgcj Compiler for Java GNU
* Apache Harmony Apache
Criticism concerning Java and FOSS
* Free But Shackled – The Java Trap, Richard Stallman, April 12, 2004. (reply, James Gosling)
or Spanish translation of this article: Free but shackled. The trap of Java. (Note that there is a note in a yellow box that talks about the current situation regarding what was said in that article)
Note that this article was written before the release of the source code of Java. At present the position of the Free Software Foundation and Richard Stallman have changed, both wanted for their use in free software.
Free software based on Java
* Azureus
* Limewire
* Radio irat
* Source Java has a list of free software (GNU licenses, LGNU, Apache, BSD, …) done in Java.
See also
* Java syntax
* Java keywords
* Java Virtual Machine
* Java Platform
* Java applet
* Java Platform, Standard Edition (SE Java, J2SE)
* JAVA
* Comparison of Java and C + +
* Comparison of Java and C #
* Java User Group
* Java Community Process
* JavaOne
* Join Java Programming Language
* Javapedia
* Inferno Operating System
References
* Jon Byous, Java technology: The early years. Sun Developer Network, undated [ca. 1998]. Retrieved April 21, 2005.
* James Gosling, A brief history of the Green project. Java.net, undated [ca. Q1/1998]. Retrieved April 22, 2005.
* James Gosling, Bill Joy, Guy Steele, and Gilad Bracha, The Java language specification, third edition. Addison-Wesley, 2005. ISBN 0-321-24678-0.
* Tim Lindholm and Frank Yellin. The Java Virtual Machine specification, second edition. Addison-Wesley, 1999. ISBN 0-201-43294-3.
Examples Dynamic Programming
* No execution of tasks in minimum time on a system of two processors A and B
* Programs disk
* Problem stamps with dynamic programming
* Problem backpack with dynamic programming
* Problem product of a sequence of dynamic programming with parent
* Problem of currencies with dynamic programming
* Way of minimum cost between two nodes of a directed graph
* Problem of the division of weight
* Problem cows with dynamic programming
* Problem of Change Dynamics word Programming in Java
Notes
1. ? Specifying the Java language
2. ? Specifying the Java Virtual Machine
External Links
Wikibooks
* Collaborate in textbooks textbooks hosts a book or manual on Programming in Java.
* Perl modules on CPAN in Java (in English)
Sun
* Official site of Sun Microsystems in Spanish
* Official site for Java developers, etc.
* Official Site Java for non-technical users not advanced
* The Java Language Specification, Third Edition Specification official Java language
* Tutorial on the Sun Java
* White Paper original Java, 1996
* Test your VM
* Course Free Introduction to Java
Petitions for the specification of Java (Java Specification Requests)
There are several JSRs related to the Java language and APIs kernel.
* Add JSR 14 Generic Types To The Java Programming Language (J2SE 5.0)
* A Simple JSR 41 Assertion Facility (J2SE 1.4)
* JSR 47 Logging API Specification (J2SE 1.4)
* JSR 51 New I / O APIs for the Java Platform (J2SE 1.4)
* JSR 59 J2SE Merlin Release Contents (J2SE 1.4)
* Application Isolation API JSR 121 (not yet included)
* JSR 133 Java Memory Model and Thread Specification Revision (J2SE 5.0)
* JSR 166 Concurrency Utilities (J2SE 5.0)
* JSR 175 A Metadata Facility for the Java Programming Language (J2SE 5.0)
* JSR 176 J2SE 5.0 (Tiger) Release Contents (J2SE 5.0)
* Extending the JSR 201 Java Programming Language with Enumerations, autoboxing, Enhanced for loops and Static Import (J2SE 5.0)
JSR 203 * More New I / O APIs for the Java Platform ( “NIO.2″) (Java SE 7)
* JSR 204 Unicode Supplementary Character Support (J2SE 5.0) – support for Unicode 3.1
* JSR 270 Java SE 6 ( “Mustang”) Release Contents (Java SE 6)
* JSR 901 Java Language Specification (J2SE 5.0)
Tutorials
* The Java Tutorial Sun Microsystems (online)
* David Flanagan, Java in a Nutshell, Third Edition. O’Reilly & Associates, 1999. ISBN 1-56592-487-8
* Thinking in Java, by Bruce Eckel (online)
* Java Course, A.B. Downey.
* Introduction to Programming Using Java Text online David J. Eck
* How to Think Like a Computer Scientist version of Java
* An introduction to Computer Science using Java By Bradley Kjell. This text focuses on the principles and fundamentals of programming languages and computers in general, and uses Java as it’s language of instruction.
* A Java tutorial by Alhoori Hamed, an instructor at the University of Bahrain.
* Full Java Tutorial
* In Castilian:
Choosing or collections in Java
Course practical or Java
or Java applets
Basic or Java Tutorial
Manual or Java
Bits or Java
or Introduction to Java
Collection or ‘Java butt’ e-book (University of Malaga. Spain)
Video Tutorials
* Videotutoriales basic Java
Resources
* Java (Sun)
* Java Community of developers Mexico Mexicans.
* Software Development Java Virtual Community for exchanging information in Castilian on software development in Java for professional practitioners, teachers and students.
* Computer-Books.us collection of books on Java available for free download.
* Project Javapedia
* Wiki Java.net
* JavaRSS.com portal websites on Java.
* DeveloperWorks Java Zone – Community Resource Java
* JavaWhat.com Resource Directory Java
* Report, examples of programs, mini-tutorials, sources of information
* Development in Java JavaDesarrollo
* Examples, programs, forums and manuals on java
IDEs for Java
* BEA Workshop – commercial software, developed by BEA Systems, integrated with BEA WebLogic
* BlueJ – free, developed as a research project universiatario. BlueJ is also an interactive environment suitable for learning Java
* Eclipse – free and open source, Eclipse is developed by the Eclipse Foundation
* IntelliJ idea – commercial software, IntelliJ idea is developed by JetBrains
* JGrasp – Free software developed by the Department of Computer Science and Software Engineering at the Samuel Ginn College of Engineering at the University of Auburn. It is a very slight development environment for Java, C, C + +, Objective C, Ada and VHDL. Integra UML diagrams for Java diagrams and Control Structures.
* JBuilder – commercial software (there is a free version). JBuilder is developed by Borland
* JCreator – commercial software (there is a free version) developed by Xinox
* JDeveloper – SDI Oracle Corporation and integrated with Oracle Application Server
* NetBeans – IDE and platform basis for rich desktop applications (Apps Rich) free open source developed by NetBeans.org
* Sun Java Studio Enterprise – commercial software (free for members of Sun Developer Network), developed by Sun Microsystems
* Rational Application Developer for WebSphere Software – commercial software, developed by IBM, integrated with WebSphere Application Server