Introduction

The Java programming language was first introduced in 1995 by Sun Microsystems. Derived from languages such as C and C++, Java was designed to be moreintuitive and easier to use than older languages, specifically due to its simplistic object model and automated facilities such as memory management. At the time, Java drew the interest of developers because of its object-oriented, concurrent architecture; excellent security and scalability; and because applications developed in the Java language could be run on any operating system that contained a Java Virtual Machine (JVM). Since its inception, Java has been described as a language that allows developers to “write once, run everywhere” as code is compiled into class files that contain bytecode, and the resulting class files can run on any compliant JVM. This concept made Java an immediate success for desktop development, which later branched off into different technological solutions over the years, including development of web-based applications and rich Internet applications (RIAs). Today, Java is deployed on a broad range of devices including mobile phones, printers, medical devices, blue ray players, and so on.

The Java platform consists of a hierarchy of components, starting with the Java Development Kit (JDK), which is composed of the Java Runtime Environment (JRE), the Java programming language, and platform tools that are necessary to develop and run Java applications. The JRE contains the Java Virtual Machine (JVM), plus the Java application programming interfaces (APIs) and libraries that assist in the development of Java applications. The JVMis the base upon which compiled Java class files run and is responsible for interpreting compiled Java classes and executing the code. Every operating system that is capable of running Java code has its own version of the JVM. To that end, the JRE must be installed on any system that will be running local Java desktop or stand-alone Java applications. Oracle provides JRE implementations for most of the major operating systems, most recently adding Mac OS X to the list. Each operating system can have its own flavor of the JRE. For instance, mobile devices can run a scaled down version of the full JRE that is optimized to run Java Mobile Edition (ME) applications.

The Java platform APIsand libraries are a collection of predefined classes that are used by all Java applications. Any application that runs on the JVM makes use of the Java platform APIs and libraries. This allows applications to make use of functionality that has been predefined and loaded into the JVM and leaves developers with more time to worry about the details of their specific application. The classes that comprise the Java platform APIs and libraries allow Java applications to use one set of classes in order to communicate with the underlying operating system. As such, the Java platform takes care of interpreting the set of instructions provided by a Java application into operating system commands that are required for the machine on which the application is being executed. This creates a façade for Java developers to write code against so that they can develop applications; which can be written once and ran on every machine that contains a relevant JVM.

The JVM and the Java platform APIs and libraries play key roles in the lifecycle of every Java application. Entire books have been written to explore the platform and JVM. This book will focus on the Java language itself, which is used to develop Java applications, although the JVM and Java platform APIs and libraries will be referenced as needed. The Java language is a robust, secure, and modern object-oriented language that can be used to develop applications to run on the JVM. The Java programming language has been refined over several iterations and it becomes more powerful, secure, and modern with each new release. This book covers many features of the Java programming language from those that were introduced in Java 1.0 through those that made their way to the language in Java 7. In 2011, Oracle Corporation released Java 7, which was a milestone release for the Java ecosystem. Not only is Java 7 the most modern, statically typed, object-oriented language available for development, it also enhances the ability to integrate different languages that run on the JVM, such as Jython, Groovy, JRuby, and Scala to name a handful.

On the heels of the Java 7 release, Oracle also delivered JavaFX 2.0, a breakthrough in desktop application development for the JVM. JavaFX 2.0 can be used for developing rich desktop and Internet applications using the Java language, or any other language that runs on the JVM. It provides a rich set of graphical and media user interfaces to develop extraordinary visual applications. This release is a major update to the JavaFX platform, allowing applications to be written entirely in the Java language. Previous releases of JavaFX mandated the use of JavaFX Script for development of user interfaces for JavaFX. JavaFX 2.0 does away with the mandate for using JavaFX Script and allows developers to use the language of their choice for working with the JavaFX application programming interfaces.

This book covers fundamentals of Java development such as installation of the JDK, writing classes, and running applications.It delves into essential topics such as the development of object-oriented constructs, exception handling, unit testing, and localization. The book also provides solutions for desktop application development using the Swing API, and web-based solutions including servlets and applets. It covers JavaFX 2.0 in depth and is an essential guide for developers beginning to use JavaFX.This book can be used as a guide for solving problems that ordinary Java developers may encounter at some point. A broad range of topics is discussed, and the solutions to the problems that are covered in this book are concise and tothe point.

If you are a novice Java developer, we hope that this book will help you get started on your journey to working with one of the most advanced and widely used programming languages available today. For those of you who have used the Java language for some time, we hope that this book will provide you with updated material that is new to Java 7 and JavaFX 2.0 so that you can further refine your Java development skills. We ensure that advanced Java application developers will also learn a thing or two regarding the new features of the language and perhaps even stumble upon some techniques that were not used in the past. Whatever your skill level, this book will be good to have close at hand as a reference for solutions to those problems that you will encounter in your daily programming.

Who This Book Is For

This book is intended for all those who are interested in learning the Java programming language and/or already know the language but would like some information regarding the new features included in Java SE 7 and JavaFX 2.0. Those who have not yet programmed in the Java language can read this book, and it will allow them to start from scratch to get up and running quickly. Intermediate and advanced Java developers who are looking to update their arsenal with the latest features that Java SE 7 and JavaFX 2.0 make available to them can also read the book to quickly update and refresh their skill set.

Java desktop programmers will find this book useful for its content on developing desktop applications using the Java Swing toolkit and JavaFX 2.0. Developers of Java web applications will find useful content regarding servlets, applets, and more. There is, of course, a myriad of other essential topics that will be useful to Java developers of any type.

How This Book Is Structured

This book is structured so that it does not have to be read from cover to cover. In fact, it is structured so that developers can chose which topic(s) they'd like to read about and jump right to them. Each recipe contains a problem to solve, one or more solutions to solve that problem, and a detailed explanation of how the solution works. Although some recipes may build upon concepts that have been discussed in other recipes, they will contain the appropriate references so that the developer can find other related recipes that are beneficial to the solution. The book is designed to allow developers to get up and running quickly with a solution so that they can be home in time for dinner.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.64.126