Sunday, November 29, 2009

Download Ebook: Essential JavaFX™ (Gail Anderson and Paul Anderson)

JavaFX is a scripting language which provides built-in properties for manipulating objects within a 2D coordinate system. A competing technology to Microsoft's Silverlight, JavaFX provides the tools to fill and pen stroke colors, and create special effects, shapes and lines. It also manipulates images and play videos and sound and defines animations that affect objects over time. This complete introduction for any level doesn't bury you with details. It starts quickly with an introduction to the power of JavaFX key features--scene node graphs, nodes as components, the coordinate system, layout options, colors and gradients, custom classes with inheritance, animation, binding, and event handlers. It then shows step-by-step how these features could be used in a real JavaFX application and will help an application look professionally designed. Commissioned by JavaFX product team and reviewed by renowned Java author, Brian Goetz, this guide is intended as the first and most accessible book for people new to JavaFX.

  • The Andersons are working directly with the JavaFX team at Sun for a complete and authoritative guide
  • Gets you started on building rich Web apps quickly without having to sort through unnecessary details or search the Web for answers
  • Focuses on most useful features and shows how to build apps that tap the full potential of JavaFX
Here's how the book is structured:

Chapter 1 gets you started with JavaFX. We show you how to download JavaFX and begin building projects with the NetBeans IDE. (We use NetBeans to build our examples, but you can also use Eclipse.)

Chapter 2 gives you a broad overview of JavaFX. It takes you through an example (a Guitar Tuner), pointing out how things are done with JavaFX. If you want to get a “feel” for the language, this chapter introduces you to many trademark JavaFX features.

Chapter 3 through Chapter 5 are “reference-oriented” chapters. Chapter 3 describes the JavaFX language, Chapter 4 describes graphical objects, and Chapter 5 discusses user interface components. These chapters are organized with small examples to help you find information quickly (how do I bind an object or generate a sequence with a for loop?). The language chapter covers everything from JavaFX built-in types to mixin inheritance. Graphical objects are the basic JavaFX shapes you use to build scene graphs and layout objects (islands in the sun, for example). The components chapter shows you the JavaFX Swing components and the JavaFX “native” UI components. We also show you how to build custom UI components in a more advanced section.

Chapter 6 shows you how to design and structure a JavaFX application. It introduces a building-block approach with a nod towards object oriented design principles.

Chapter 7 is all about JavaFX animation and timelines. JavaFX animation is both powerful and flexible. Transitions are “pre-packaged high-level” animations that help build straightforward motions quickly, such as fade-ins and fade-outs, scaling, and moving.

Chapter 8 discusses viewing and manipulating images. One example shows you how to design an animated photo carousel.

Chapter 9 covers web services. JavaFX provides two important utility classes that make it easier to work with web services. An HttpRequest class handles asynchronous web requests and a PullParser class simplifies processing the response data. We take you through several Flickr-based web service API calls.

Chapter 10 discusses the JavaFX mobile environment and explores the differences between desktop JavaFX and the JavaFX mobile runtime. We discuss guidelines for targeting mobile devices and how to make an application mobile-friendly.


Thursday, November 26, 2009

Download Ebook: Special Edition Using Enterprise JavaBeans 2.0 (Chuck Cavaness & Brian Keeton)

Special Edition Using Enterprise JavaBeans 2.0 starts with a description of how Enterprise JavaBeans fits into the big picture of J2EE development, then covers such topics as:
  • Locating EJB's using JNDI

  • Managing data with EJB Query Language

  • Building JMS applications using the new Message-driven Bean

  • Planning EJB applications using design patterns

Later chapters describe advanced development topics including interoperability, horizontal services and clustering. Throughout the book, the authors construct a component-based auction web site using the J2EE architecture as a practical example.


Download Ebook: Java Web Service (David Chappell & Tyler Jewell)

Java Web Services shows you how to use SOAP to perform remote method calls and message passing; how to use WSDL to describe the interface to a web service or understand the interface of someone else's service; and how to use UDDI to advertise (publish) and look up services in each local or global registry. Java Web Services also discusses security issues, interoperability issues, integration with other Java enterprise technologies like EJB; the work being done on the JAXM and JAX-RPC packages, and integration with Microsoft's .NET services.

Here's how the book is structured:

Chapter 1

This chapter defines web services; provides an overview of SOAP, WSDL, and UDDI; and discusses the different business uses for web services.

Chapter 2

This chapter introduces the role of service-oriented architecture (SOA) and how application architecture can leverage programs developed using a SOA.

Chapter 3

This chapter introduces the SOAP protocol and shows how it is layered on top of HTTP. It discusses the SOAP envelope, header, and body, and how SOAP with attachments works. This chapter introduces the Apache SOAP engine and the Apache SOAP client API that provides a Java interface for sending and receiving SOAP messages.

Chapter 4

This chapter continues the SOAP discussion by describing how SOAP deals with method invocations, exception handling, and the mustUnderstand header attribute.

Chapter 5

This chapter introduces WSDL and the steps involved in creating a web service description. It provides an overview of the different ways WSDL may be created within a Java program.

Chapter 6

This chapter discusses the UDDI initiative and the makeup of a UDDI Business Registry. It introduces the inquiry and publishing API for UDDI and demonstrates how to access a UDDI registry using the Apache SOAP client library, a custom library provided by a vendor, and JAXR. This chapter also discusses higher-level abstraction Java APIs for seamless access to a registry.

Chapter 7

This chapter introduces two relatively new client programming models that are evolving as part of the Java Community Process (JCP). The coding examples from the previous SOAP chapters are examined using these new APIs.

Chapter 8

This chapter discusses how an application server might support web services. It discusses where SOAP, WSDL, and UDDI fit into the J2EE picture. It also introduces the Java Community Process standardization efforts currently underway to get web services integrated tightly with J2EE.

Chapter 9

This chapter combines firsthand experience with collective research gathered from message boards, articles, and various interoperability web sites. It explores low-level issues regarding such things as datatype mapping and header processing, as well as higher-level framework issues such as interoperability with ebXML and MS Biztalk. To provide concrete examples of interoperability problems and solutions, this chapter discusses the SOAPBuilder's Interoperability Labs' effort.

Chapter 10

This chapter discusses how issues such as digital signatures, key management, and encryption present new challenges as a result of using XML and SOAP-based interoperable communications. Current specifications and implementations such as XML-Encryption, XML-Signatures, SOAP-Security, and XKMS are examined.


Download Ebook: Advanced Java Networking (Prashant)

Advanced Java Networking is designed to present you with a myriad of alternatives to connect your applications to the Internet. It is neither a programming reference nor a marketing brochure. We'll leave that to the geeks and marketeers to battle out. Instead, we wanted to explore each alternative without marketing bias or engineering snobbery.

One part of the engineering community will tell you that sockets are the only true way to communicate information over a network. Another segment will say that Java-only applications relying on Remote Method Invocation (RMI) will solve all your communication problems. Then, of course, there is the Common Object Request Broker Architecture (CORBA) camp. We'll discuss these alternatives, and we will also explore aspects of server-side programming in which we use a Web server as a mechanism to generate dynamic Web pages that can be connected to databases (and just about anything else). We present an honest account of each alternative and
guidelines for choosing what's best for your business or programming needs. In addition to the hundreds of lines of sample code we supply to help you start from scratch with Java communication, we place an additional emphasis on migration of your existing desktop-centric applications to an Internet-ready world.

This book is not for beginning programmers nor is it an introductory Java text. We assume that you have a strong object-oriented programming background, preferably in Java. You should have a strong grasp of such Java fundamentals as how to create a class, how to compile and execute programs on your native system, and how to deploy Java applications. Furthermore, you should understand a good deal of the terminology of the object-oriented world.


Download Ebook: Java Cryptography (Jonathan B. Knudsen)

Cryptography, the science of secret writing, is the biggest, baddest security tool in the application programmer's arsenal. Cryptography provides three services that are crucial in secure programming. These include a cryptographic cipher that protects the secrecy of your data; cryptographic certificates, which prove identity (authentication); and digital signatures, which ensure your data has not been damaged or tampered with.

This book covers cryptographic programming in Java. Java 1.1 and Java 1.2 provide extensive support for cryptography with an elegant architecture, the Java Cryptography Architecture (JCA). Another set of classes, the Java Cryptography Extension (JCE), provides additional cryptographic functionality.

This book covers the JCA and the JCE from top to bottom, describing the use of the cryptographic classes as well as their innards. The book is designed for moderately experienced Java programmers who want to learn how to build cryptography into their applications. No prior knowledge of cryptography is assumed. The book is peppered with useful examples, ranging from simple demonstrations in the first chapter to full-blown applications in later chapters.

This book is organized like a sandwich. The outer chapters (Chapter 1, Chapter 2, and Chapter 12) provide context for the rest of the book. Chapter 3 through Chapter 11 (the meat) are a methodical and pragmatic description of cryptographic programming in Java, including numerous useful examples.

Chapter 1, describes cryptography's role in secure systems development and introduces some short examples of cryptographic programming.

Chapter 2, introduces the fundamental concepts of cryptography: ciphers, message digests, signatures, and random numbers.

Chapter 3, presents a bird's-eye view of Java cryptographic software packages and introduces the Provider Architecture that underlies the Java Security API.

Chapter 4, describes cryptographic random numbers in Java.

Chapter 5, describes the key management classes that are included with the JDK.

Chapter 6, shows how to use message digests, signatures, and certificates for authentication.

Chapter 7, covers encryption: symmetric and asymmetric ciphers, cipher modes, and hybrid systems.

Chapter 8, describes how to create signed applets.

Chapter 9, describes how to write a security provider. It includes classes that implement the ElGamal cipher and signature algorithms.

Chapter 10, presents a completely functional application, a cryptographically enabled network talk application.

Chapter 11, includes another complete application, a cryptographically enabled email client.

Chapter 12, talks about noncryptographic security issues you should know about.

OK, let's start it. Here we go!


Download Ebook: Advanced Java Programming (T. B. Kute)

Dedicated to All the Learners... who are keen to learn some exciting features of Java.


Download Ebook: SCWCD Exam Study Kit Second Edition (Matthew Scarpino)

This book is built around the objectives that Sun has published for the updated SCWCD exam. If you know everything that is covered by the objectives, you will pass the exam. The chapters in the book examine each objective in detail and explain everything you need to understand about web component development.

Who is this book for?

This book is for Java programmers who want to prepare for the SCWCD exam, which focuses on the Servlet and JavaServer Pages technologies. This book will also be very useful for beginners since we have explained the concepts using simple examples. The text will bring you up to speed even if you are totally new to these technologies. Even expert Servlet/JSP programmers should read the book to ensure that they do not overlook any exam objectives. However, since this book is a study guide, we do not try to cover advanced tricks and techniques for expert Servlet/JSP developers.


Wednesday, November 25, 2009

Download Ebook: Hibernate in Action (Christian Bauer & Gavin King)

Relational databases are indisputably at the core of the modern enterprise. While modern programming languages, including JavaTM, provide an intuitive, object-oriented view of application-level business entities, the enterprise data underlying these entities is heavily relational in nature. Further, the main strength of the relational model—over earlier navigational models as well as over later OODB models—is that by design it is intrinsically agnostic to the programmatic manipulation and application-level view of the data that it serves up.

Many attempts have been made to bridge relational and object-oriented technologies, or to replace one with the other, but the gap between the two is one of the hard facts of enterprise computing today. It is this challenge—to provide a bridge between relational data and JavaTM objects—that Hibernate takes on through its object/relational mapping (ORM) approach. Hibernate meets this challenge in a very pragmatic, direct, and realistic way.

As Christian Bauer and Gavin King demonstrate in this book, the effective use of ORM technology in all but the simplest of enterprise environments requires understanding and configuring how the mediation between relational data and objects is performed. This demands that the developer be aware and knowledgeable both of the application and its data requirements, and of the SQL query language, relational storage structures, and the potential for optimization that relational technology offers.

Not only does Hibernate provide a full-function solution that meets these requirements head on, it is also a flexible and configurable architecture. Hibernate’s developers designed it with modularity, pluggability, extensibility, and user customization in mind. As a result, in the few years since its initial release,Hibernate has rapidly become one of the leading ORM technologies for enterprise developers—and deservedly so.

This book provides a comprehensive overview of Hibernate. It covers how to use its type mapping capabilities and facilities for modeling associations and inheritance; how to retrieve objects efficiently using the Hibernate query language; how to configure Hibernate for use in both managed and unmanaged environments; and how to use its tools. In addition, throughout the book the authors provide insight into the underlying issues of ORM and into the design choices behind Hibernate. These insights give the reader a deep understanding of the effective use of ORM as an enterprise technology.

Hibernate in Action is the definitive guide to using Hibernate and to object/relational mapping in enterprise computing today. Are you ready?


Friday, November 20, 2009

Download Ebook: Core JSP (Damon Hougland)

In recent years, a large amount of software development activity has migrated from the client to the server. The client-centric model, in which a client executes complex programs to visualize and manipulate data, is no longer considered appropriate for the majority of enterprise applications. The principal reason is deployment—it is a significant hassle to deploy client programs onto a large number of desktops, and to redeploy them whenever the application changes. Instead, applications are redesigned to use a web browser as a "terminal". The application itself resides on the server, formatting data for the user as web pages and processing the responses that the user fills into web forms.

If you set out to develop a web application, you need to choose a technology that has several important characteristics. You need to generate large amounts of dynamic HTML conveniently. You require access to databases and other services. The technology must provide an architectural foundation for performance and stability. Finally, you must be able to partition your program logic in a way that allows for future growth and maintainability.

The first web applications used the CGI (Common Gateway Interface) mechanism and a collection of server-side scripts, typically written in Perl, but occasionally in C, Python, PHP or other languages. There are numerous problems with this approach. The CGI mechanism does not scale well since every web request spawns a new server process. Communication between processes—for example, to share resources such as database connections—is extremely awkward to program. And finally, exotic programming languages may have their charm but they lack the ability to do the "heavy lifting". Features such as database access or security are typically not part of the language but supplied by a non-standard third-party library. That puts the programmer at the mercy of not only the implementors of the language itself but also the providers of various third-party libraries.

Java programmers have enjoyed the power of servlets for some time, which solves many of these problems. Servlets are programmed in Java, a language that is widely supported. Java has built-in features for database access, networking, multithreading, security, and so on. Each servlet executes in its own thread, thus avoiding the cost of generating server processes. Servlets can easily share resources such as session state and database connections. The principal disadvantage of servlets is that it is plainly tedious to generate HTML. All HTML must be generated programmatically, by statements that print all the text and tags. In particular, that means that the pages are generated by programmers. We all know what can happen when programmers try their hand at web design.

An increasingly popular approach in recent years has been the use of web server scripting languages such as Netscape LiveWire and Microsoft ASP (Active Server Pages). With these systems, a programmer embeds code snippets into web pages. The pages themselves can be professionally designed by a web designer. The web server executes the code snippets when serving the page, inserting the HTML that results from the execution of each snippet. The advantage of this approach—and the reason for its popularity—is that you can get simple results very quickly. But what looks like fun and great productivity early on turns out to be a maintenance nightmare later. When you intermingle the presentation (the static parts of the HTML pages) and the business logic (the code snippets), it becomes very difficult to change either when the need arises. Web designers will not know how how to move the code around when redesigning the pages. This makes any redesign a costly affair involving frequent interaction between programmers and web designers. Finally, keep in mind that you are tied into a particular web server. For example, if you develop your application in ASP and later want to use Apache instead of Microsoft IIS, you are stuck.

The JSP technology that is the topic of this book overcomes these issues. JSP has the same advantages as servlets—in fact, JSP pages are servlets. You use the full power of the Java language, and not some scripting language, to implement your business logic. By using beans, XML transformations, and tag libraries, JSP lets you separate the presentation logic and business logic. For example, in a well-structured JSP application, you can have the same business logic with multiple interfaces, giving your users the choice to use a regular web browsers or a mobile phones that uses WAP (the wireless access protocol).

This book teaches you how to build robust and scalable web applications with JSP. It covers the JSP syntax, the features that JSP inherits from servlets such as session management, the interaction between servlets and beans, a number of useful Java topics such as JDBC (Java Database Connectivity) and XML. Finally, and most importantly, you will learn about application partitioning and deployment—these subjects make all the difference between a quick hack and a robust application that will withstand the test of time.

Unlike other books, this book takes a properly JSP-centric approach, in accordance with the recommendations that Sun Microsystems makes in their Java Enterprise blueprints. This is very appropriate and a major strength. Where other books start out with servlets and discuss JSP as a second method for web programming, this book shows you why JSP pages have a higher position in the food chain. A JSP page can do everything a servlet can, but where you have to do a lot of tedious programming and organizing when you use servlets, JSP has higher level capabilities that let you focus on your business problems instead.


Download Ebook: JavaFX™ Script; Dynamic Java™ Scripting for Rich Internet/Client-Side Applications (James L. Weaver)

JavaFX Script was revealed at JavaOne 2007 as the tool that will enable developers to create rich content using the JavaFX family of products from Sun Microsystems. JavaFX Script is very new, and still changing. Are you ready to JavaFX?


Download Ebook: Java Thread Programming (Paul Hyde)

Professional Java developers who've come as far as they can without exploiting threads will find their skills bumped up a few notches by the time they finish Paul Hyde's Java Thread Programming. In a five-and-a-half-page first chapter, the book gives a basic concept briefing, then gets down to business with an example-rich education from the starting thread through inter-thread communication, thread groups, thread pooling, threads and Swing, and more. You'll get an experienced voice on how to gracefully exit from a thread -- and find out when to use the lead-between-the-eyes SureStop class instead. You'll even find out when multiple threads aren't a good idea. If you're serious about learning what it takes to do Java really, really well, this book is a good place to invest your time.


Thursday, November 19, 2009

Download Ebook: Java RMI (William Grosso)

This book covers an enormous amount of ground, starting with streams and sockets and working its way through the basics of building scalable client-server architectures using RMI. While the order of chapters is a reasonable one, and one that has served me well in introducing RMI to my students at U.C. Berkeley Extension, it is nonetheless the case that skipping around can sometimes be beneficial. For example, Chapter 10, which discusses object serialization, really relies only on streams (from Chapter 1) and can profitably be read immediately after Chapter 4 (where the first RMI application is introduced).

The book is divided into three sections. Part I starts with an introduction to some of the essential background material for RMI. After presenting the basics of Java's stream and socket libraries, we build a simple socket-based distributed application and then rebuild this application using RMI. At this point, we've actually covered most of the basics of building a simple RMI application.

The rest of Part I (Chapters Chapter 5 through Chapter 9) presents a fairly detailed analysis of how introducing a network changes the various aspects of application design. These chapters culminate in a set of principles for partitioning an application into clients and servers and for designing client-server interaction. Additionally, they introduce an example from banking which is referred to repeatedly in the remainder of the book. After finishing the first section, you will be
able to design and build simple RMI applications that, while not particularly scalable or robust, can be used in a variety of situations.

Part II builds on the first by drilling down on the underlying technologies and discussing the implementation decisions that must be made in order to build scalable and secure distributed applications. That is, the first section focuses on the design issues associated with the clientserver boundary, and the second section discusses how to make the server scale. As such, this section is less about RMI, or the network interface, and more about how to use the underlying Java technologies (e.g., how to use threads). These chapters can be tough sledding™ this is the technical heart of the book.

Part III consists of a set of independent chapters discussing various advanced features of RMI. The distinction between the second and third sections is that everything covered in the second section is essential material for building a sophisticated RMI application (and hence should be at least partially understood by any programmer involved in the design or implementation of an RMI application). The topics covered in Part III are useful and important for many applications but are not essential knowledge.


Download Ebook: Java 3D Programming (Daniel Selman)

Java 3D Programming is aimed at intermediate to experienced Java developers. Previous experience in graphics programming (OpenGL and Swing, for example) will be very useful, but it's not a prerequisite. No book stands alone and you should make good use of the many online resources and books listed in appendix B and the bibliography. Readers new to Java 3D should definitely download Sun's excellent (free) Java 3D tutorial. This book is intended to serve as a companion to the Sun API documentation and the Java 3D tutorial.

The book has 18 chapters. Each chapter is fairly self−contained or explicitly references related chapters, allowing you to focus quickly on relevant material for your problem at hand.

Chapter 1 focuses on getting started with Java 3D, system requirements, running the examples in the book, plus a look at the strengths and weaknesses of Java 3D.

Chapter 2 introduces some of the fundamentals of 3D graphics programming, such as projection of points from 3D to 2D coordinates, lighting, and hidden surface removal.

Chapter 3 gets you started with Java 3D programming, from setting up your development environment and resources to running your first application.

Chapter 4 explains the fundamental data structure in Java 3D, the scenegraph. Aspects of good scenegraph design are described using an example application for discussion.

Chapter 5 is a reference to Java 3D's scenegraph nodes, along with usage instructions and examples.

Chapter 6 explains the elements of the Java 3D scenegraph rendering model and guides you in your choice of VirtualUniverse configuration.

Chapter 7 takes a step back and examines data models for 3D applications. Choosing a suitable data model involves understanding your interaction and performance requirements.

Chapter 8 is a reference to creating geometry to be rendered by Java 3D.

Chapter 9 covers the elements of the Java 3D Appearance class, used to control the rendered appearance of the geometric primitives in your scene.

Chapter 10 illuminates the Java 3D lighting model and shows you how to create powerful lighting for your scene.

Chapter 11 introduces the Java 3D behavior model, which allows you to attach code to the objects in your scene. Examples illustrate both keyboard and mouse behaviors for graphical user interfaces.

Chapter 12 expands upon the discussion of behaviors, covering the Interpolator behaviors, used to control geometry attributes using the Alpha class.

Chapter 13 describes how to write your own custom behaviors and register them with Java 3D for invocation. Example behaviors for debugging and complex physical animation as well as others are presented.

Chapter 14 explains how to increase the realism of your scenes by applying bitmaps to your geometry using the process of texture mapping.

Chapter 15 highlights some of the utility classes provided with Java 3D for operations such as triangulation and loading of input data.

Chapter 16 delves into more techniques valuable for interacting with 3D scenes, object interaction using the mouse for selection of 3D objects, and performing collision detection between 3D objects.

Chapter 17 shows, through example, how to build Java 3D applications that use the Swing packages for 2D user interface elements, and can be distributed as Java applets for use from a web browser.

Chapter 18 goes low−level to explain some of the implementation details of the Java 3D API. The aim is to give you a greater appreciation for what is going on behind the scenes and help you optimize your applications.


Wednesday, November 18, 2009

Download Ebook: Java Swing (Kirk Brown)

This book is best described as a programmer’s guide, serving both as a reference and a tutorial.


Saturday, November 14, 2009

Download Ebook: Java Message Service (Richard Monson-Haefel & David A. Chappell)

This book is a thorough introduction to Java Message Service (JMS), the standard Java application program interface (API) from Sun Microsystems that supports the formal communication known as "messaging" between networked computers. JMS provides a common interface to standard messaging protocols and to special messaging services in support of Java programs. Messaging involves crucial data exchange between computers, and is often used to coordinate programs in dissimilar systems or different programming languages.

Using the JMS interface, a programmer can invoke the messaging services of IBM's MQSeries, Progress Software's SonicMQ, and other popular messaging product vendors. JMS also supports messages that contain serialized Java objects or Extensible Markup Language (XML) pages. Java Message Service shows how to build applications using the point-to-point and publish-and-subscribe models; use features like transactions and durable subscriptions to make an application reliable; and use messaging within Enterprise JavaBeans. It introduces a new EJB type, the MessageDrivenBean, that is part of EJB 2.0, and discusses integration of messaging into J2EE.


Download Ebook: Java How to Program, Fourth Edition (Harvey M. Deitel & Paul J. Deitel)

The authoritative DEITEL LIVE-CODE introduction to programming with the Java 2 Platform, Standard Edition (J2SE)

Java has revolutionized software development with multimedia-intensive, platform-independent, object-oriented code for conventional, Internet-, Intranet- and Extranet-based applications and applets. This exciting new Fourth Edition of the world's best-selling Java textbook now has a companion volume Advanced Java 2 Platform How to Program which focuses on the Java 2 Platform, Enterprise Edition (J2EE), presents advanced J2SE features and introduces the Java 2 Platform, Micro Edition (J2ME).

Dr. Harvey M. Deitel and Paul J. Deitel are the founders of Deitel & Associates, Inc., the internationally recognized corporate training and content-creation organization specializing in Java, C++, C, Visual C#, Visual Basic, Visual C++, .NET, XML, Python, Perl, Internet, Web and object technologies. The Deitels are also the authors of the world's #1 C++ textbook C++ How to Program, 3/e and many other best sellers.

In Java How to Program, Fourth Edition the Deitels introduce the fundamentals of object-oriented programming in Java. The 4th edition includes an optional 180-page case study that introduces object-oriented design with the UML.


Download Ebook: SCJP Sun Certified Programmer for Java 6 Study Guide (Exam 310-065)

This book's primary objective is to help you prepare for and pass Sun Microsystem's SCJP certification for Java 6 or Java 5. The Java 6 and Java 5 exams are almost identical in scope, and they are both much broader than their predecessor, the Java 1.4 exam. For the remainder of this book we'll typically reference the Java 6 exam, but remember that other than the addition of the System. Console class and Navigable collections, the Java 5 and Java 6 exams are identical in scope. We recommend that you take the Java 6 exam and not the Java 5 exam, but if you do decide to take the Java 5 exam, this book is still appropriate.

The new exam's objectives touch on many of the more commonly used of Java's APIs. The key word here is "touch." The exam's creators intended that passing the exam will demonstrate that the candidate understands the basics of APIs such as those for file I/O and regular expressions. This book follows closely both the breadth and the depth of the real exam. For instance, after reading this book, you probably won't emerge as a regex guru, but if you study the material, and do well on the self tests, you'll have a basic understanding of regex, and you'll do well on the exam. After completing this book, you should feel confident that you have thoroughly reviewed all of the objectives that Sun has established for the exam.


Thursday, November 12, 2009

How to Install Java on Linux

In this tutorial will discuss about the installation of Java Development Kits (JDK) on Linux Ubuntu 9.04 with the manual, which is unpack the installer to do it. Here are the steps:

  • Download the latest JDK package from
  • Copy the JDK package to your Home Folder. We assume the file name: jdk-6u16-linux-i586.bin
  • Sign terminal and login as super user
paiman@salafy: ~ $ sudo su
  • Do unpack the file to the JDK
sh jdk-6u16-linux-i586.bin
  • License agrément will appear, type 'yes'
  • The process of unpacking will take place and when completed it will create a directory '/ usr/java/jdk1.6.0_16'. We call this directory as the value of the variable JAVA_HOME.
  • Up to here JDK already installed and you can install your favorite Java IDE, like NetBeans or Eclipse.
  • But if you want to be able to compile through terminal, you have to set CLASSPATH first.
  • The trick is to define the value of the variable JAVA_HOME and PATH:
export JAVA_HOME = / usr/java/jdk1.6.0_16
export PATH = $ JAVA_HOME / bin: $ PATH

  • To check if the value of the two variables have been updated, do this:
echo $ JAVA_HOME
echo $ PATH
If both displays output, then the two variables defining the success

  • Up to here CLASSPATH has been set and you are able to compile through terminal. To test it do:
  • But the problem is, when you close the terminal then you have to go back CLASSPATH settings. This certainly was not wearing. So, you need to update the file. Bashrc to add information about your CLASSPATH to be set
  • Open the file. Bashrc:
~ /. bashrc
if there is a message 'permission denied', then write it: nano ~ /. bashrc
  • At the end of the file to add information about the CLASSPATH and save:
JAVA_HOME = / usr/java/jdk1.6.0_16
PATH = $ JAVA_HOME / bin: $ PATH
  • And now, you can directly compile java file through the terminal.

How to Install Java on Windows

In studying Java, sometimes small things can really bother us. Especially for those of us just beginning to learn, even when creating "Hello World" error alone can make us dizzy. My experience at configure time to create my CLASSPATH mumet, fortunately there was an uncle Google. Praise the problem solved thanks to the permission of Allah, and I went on journey of learning Java.For that I want a little more reader friendly as well help in setting JAVA_HOME, PATH, and CLASSPATH. Not that I'm already proficient in Java, but from what I know that "science is useful is the knowledge that is useful for others". While I only writing for Windows 7 Operating System.

To be able to use JAVA we must have a JDK and JRE on our computers. JVM can be obtained by installing the JDK, first download the installation files from accordance with the appropriate platform. JDK is available for Linux, Solaris and Windows. For the JRE, is included when we download the JDK.

Directory containing the JDK has been properly installed on a computer known as JAVA_HOME. This variable JAVA_HOME was not really matter if we only use J2SE features, but very useful for development using J2EE, such as when using Apache Tomcat and others.

In the JDK is installed on our computers, there are java programs (for running programs) and javac (java compiler, to compile java programs) are in sub-bin directory under JAVA_HOME. To be able to compile and run Java programs from any directory, it must be added JAVA_HOME \ bin to the PATH environment variable name.

The steps to add the JAVA_HOME variable to the environment variable in Windows 7, as follows:
  1. Right-click Computer, then click Properties
  2. Select Advanced system settings
  3. After the System Properties window appears, select the Advanced tab
  4. Click Environment Variables, it will appear Environment Variables window
  5. To add JAVA_HOME, click New
  6. Type JAVA_HOME in the Variable name
  7. Insert the address of the directory where the JDK is installed in the Variable value, for example C:\Program Files\Java\jdk1.6.0_16
  8. Click OK
And then, we must create the PATH variable. The steps to create the PATH variable is essentially the same as the steps to create a variable JAVA_HOME, but to remember that the PATH variable is usually already there before. So for the PATH variable, do not need to create a new variable that will remove an existing one.

The steps as follows:
  1. Find and select the PATH variable in System Variables table of previously configured on the computer
  2. Click Edit, then add C:\Program Files\Java\jdk1.6.0_16\bin in the Variable value
  3. Click OK

Remember, the Windows operating system, can be include multiple locations or addresses to the environment variable like PATH variable with records must use a semicolon (;) as a separator. For example the value of the PATH variable:

C:\Program Files\Java\jdk1.6.0_16\bin;%SystemRoot%\system32;%SystemRoot

When finished configuring the PATH variable, test whether the configuration is working properly by running through the Command Prompt java.exe. At the prompt type java-version. If this kind of output appears the PATH configuration has worked well.

C:\Users\paiman>javac -version
javac 1.6.0_16

C:\Users\paiman>java -version
java version "1.6.0_16"
Java(TM) SE Runtime Environment (build 1.6.0_16-b01)
Java HotSpot(TM) Client VM (build 14.2-b01, mixed mode, sharing)

How to Learn Java

Java is an interesting technology, but widespread. It can be used to develop solutions to run on mobile devices so that the enterprise server. The extent of Java is often confused beginners in learning Java.

Not infrequently trapped in the direction that is not maximum, for example, open control software source, such as Struts, Turbine, or Hybernate than Java's own understanding. Or stuck to treat the JSP as a scripting language, like culture in the PHP.

Where do you begin to walk, where you must step on the way Your wanderings as a Java developer, preferably tailored to the objectives You. Do you want to develop applications for mobile phones, or to run in the enterprise server? This requires a different Java technologies for didalami. Java Platform Java as a platform for software development, roughly divided into 3 referrals:

1. J2SE (Java 2 Standard Edition)
For desktop applications.

2. J2EE (Java 2 Enterprise Edition)
For web applications, like JSP, Servlet, EJB, XML, web services.

3. J2ME (Java 2 Micro Edition)
For mobile applications, like MIDlets

How to learn Java?
  • Determine an objective, such as' I want to make an application for phone ', or' I want to make a portal with Java ', or' I want to be create desktop applications with the Java GUI '.
  • Of the objective, you can set the agenda to learn Java so that more directed and focused.
Java Programming Language

As a fundamental knowledge of Java you need to understand:
  • the concept of byte-code and Java Virtual Machine
  • syntax in the Java programming language as data types, flow control, handling exception
  • OOP in Java
Basic Java

For basic control of Java, between the libraries that need to be well understood are:
  • IO, especially related to how to access the file with Java, and the concept byte streams and character streams is needed to understand how Servlet or JSP work.
  • JDBC, associated with how to access the database with Java
Basic Java - Enrichment

The need for control of these additives depends on your objectives in
learn Java:
  • Networking, needed for example to develop client server applications, not Web-based, where you need to design their own communication protocol
  • AWT and Swing, required if you want to develop desktop applications with the Java GUI.
  • Applets, is required if you need a GUI application that runs on top browser.
These materials may not need to go into if you want to develop Web applications.

Web Applications

To be able to develop web applications, you need to learn:
  • Servlet, the basic technology in the development of web applications with Java.
  • JSP, a servlet development, best used for the presentation layer.
Web Applications - Enrichment

This technology will be useful to improve the quality of web-based software
You develop:
  • Model View Controller
Enterprise Applications --- Basic

You will be easier, though not required, understanding of enterprise Java technology
to understand:
  • RMI or Remote Method Invocation, is the basis of distributed applications in Java
  • JNDI or Java Naming and Directory Interface
  • JTA or the Java Transaction API
Enterprise Applications --- Main

The main technologies in enterprise applications with Java are:
  • EJB or Enterprise Java Bean is a key technology of the Java enterprise.
Advanced Enterprise Applications ---

These are technologies that are still in progress:
  • XML or eXtended Markup Language, used in the technology of the Web Service
  • Web Service, is an architecture in which two applications communicate with each other communications protocol called SOAP. Two applications that communicate with Web services can be developed with two programming languages different, and walked on two different platforms.
  • P2P or Peer-To-Peer, in Java was developed as Project Juxtapose (JXTA)
Mobile Applications

To be able to develop mobile applications, the technology needs to master:
  • MIDP or the Mobile Internet Device Profile
Mastery of Open Source

Possession of open source can provide its own power for Java developers. In
  • Library. As a library that allows software development, such as Hybernate, Velocity, Struts
  • Deployment. Not infrequently open source is also required for deployment environment, such as Tomcat, JBoss
  • Process. Or supporting software development processes such as Scarab, Ant

Why Do We Have To Learn Java?

Java is a language of object-oriented programming (OOP) that can run on different operating system platforms. Java development is not only focused on one operating system, but developed for different operating systems and is open source.

Java programming language itself is divided into 3 edition, namely:

1. J2SE (Java 2 Standard Edition)

Java 2 Standard Edition includes the core of the Java programming language, includes librarylibrary required core as IO, Networking, and JDBC.

2. J2EE (Java 2 Enterprise Edition)
Java 2 Enterprise Edition is a Java development for enterprise solutions, ranging from Web-based application with Servlet and JSP, distributed applications with EJB, as the integration of enterprise applications such as Web Service.

3. J2ME (Java 2 Micro Edition)

Java 2 Micro Edition is the development of Java for mobile devices, like mobile , Pocket PCs and PDAs. Development toward mobile devices requires Java to
adapt to the limited machine memory and processor.

Java advantages include:

1. Simple
Java programming language uses a syntax similar to C + + but the syntax of Java has improved a lot, especially eliminating the use of complex pointers and multiple inheritance. Java also uses automatic memory allocation and garbage collection memory.

2. Object oriented (Object Oriented)
Java using object-oriented programming makes the program can be made in modular and can be used again. Object-oriented programming models the real world into objects and make the interaction between these objects.

3. Can be easily distributed
Java was made to create distributed applications easily with the integrated networking libraries in Java.

4. Interpreter
Java programs are executed using the interpreter of Java Virtual Machine (JVM). This causes the Java source code that has been compiled to Java bytecodes can be run on a platform different.

5. Robust
Java mempuyai high reliability. The Java compiler has the ability to detect errors more thoroughly than other programming languages. Java has a runtime-Exception handling to help overcome the error in the programming.

6. Safe
As a programming language for Internet and distributed applications, Java has several security mechanisms to keep the application is not used to damage a computer system that runs the application.

7. Architecture Neutral
Java programs are platform independent. The program has just one version that can run on different platforms with a Java Virtual Machine.

8. Portable
Source code and Java programs can be easily carried to different platforms without having different recompiled.

9. Multithreading
Java has the ability to create a program that can do several jobs at once and simultaneously.

10. Dynamic
Java is designed to be run in a dynamic environment. Changes in a class by adding properties or method can be done without interfering with programs that use these classes.

Java important components include:
  • Java Virtual Machine (JVM)
JVM is an imaginary machine (virtual) working with applications like on a real machine. JVM specification provides hardware and platforms where Java code compilation occurs. Specification is what makes Java-based applications to be free from any platform for compiling the process completed by the JVM. Applications Java programs created with berekstensi text file. Java. This program is compiled to produce bytecode files berekstensi. Class. Bytecode is a set of instructions similar to machine code instructions. The difference is the machine code must run on a computer system where the compilation is intended, while walking on the java bytecode interpreter is available on all platforms and computer systems operating system.

  • Garbage Collection
Many other pemrogaman language that allows a programmer to allocate memory at run time. However, after using the memory allocation, there should be a way to put back the memory block so that other programs can use it. Java program to do garbage collection which means the program itself does not need to delete objects that are not used anymore. These facilities reduce the burden of memory management by the programmer and reduce or eliminate the source of the biggest mistakes contained in the language that allows dynamic allocation.

  • Security Code
Security code implemented in Java through the use of the Java Runtime Environment (JRE). Java uses 3-layer security model to protect the system from untrusted Java Code.

1. First, a class-loader handles the loading of Java classes into the runtime interpreter. This process includes safeguards to separate classes from the local disk with classes taken from the network.
2. Second, the bytecode Verifier read bytecode before running and ensure the bytecode meet the basic rules of the Java language.
3. Third, security management deal with the application-level security control whether the program has access to resources such as file systems, network ports, external processes and windowing system. After the whole process is finished running, then the program code is executed.

Wednesday, November 11, 2009

The History of Java

In 1991, a group of Sun engineers led by Patrick Naughton and James Gosling wants to design a computer language for consumer devices such as cable TV Box. Because the device does not have a lot of memory, language must be small and contain a tough code. Also, because different manufaktu-rmanufaktur choose different processor, then the language should be free from any manufacturer. The project code-named "Green".

The need for flexibility, small, wiry and code for platform-neutral leads the team studying Pascal implementation ever attempted. Niklaus Wirth, the creator of the Pascal language has designed a portable language that generates machine code for the intermediate hypothesis. This machine is often called virtual machine (virtual machine). This code can then be used on any machine that has the interpreter. Project Green uses virtual machines to address the major issues of neutral to target machines.

Because the people in the Green project-based C + + and Pascal was not the most syntax derived from C + +, and adopt object orientation and not a procedural. Language created originally named "Oak" by James Gosling who got inspiration from a tree located on the side of his office, but because the name itself is the name of Oak programming language that has been there before, and then replace it with JAVA SUN. JAVA name itself was inspired by the time they're enjoying a cup of coffee at a coffee shop who then inadvertently one of them mentioned the word connotes JAVA ore origin coffee. Finally they agreed to give the name of the programming language Java name.

The first product is project Green Star 7 (* 7), a remote control is very intelligent. Due to the market is still not interested in the intelligent consumer products is Green project must find other markets created by technology. At the same time, implementation of the WWW and the Internet is experiencing rapid development. On the other hand, members of the Green project also aware that the Java programming can be used on the Internet, thus leading to further implementation of the role of technology on the web.

Java has accommodated almost all the important features of programming languages that existed since the development of modern computing humans:
  1. From Simula, a language for the 65-year, the most affecting language Java and C + +. From this language adopted the basic formations of the object-oriented programming.
  2. From LISP - the language of 55 years. Adopted garbage collection facilities, as well as the ability to mimic generic list processing, although this facility rarely use it.
  3. From Algol - a language for the 60's, taken control structure has.
  4. From C + +, adopted syntax, some semantiks and exception handling Some of the language, strongly drawn type, and exception handling.
  5. From Objective C, taken interface facilities.
  6. From the Smalltalk language, taken single-root approach hiérarchie class, where the object is from the Eiffel language, assertion that the facility started to be applied in some JDK 1.4

What is Java?

Among the many software already exists, we often hear the term Java, called Java or J2ME (Java 2 Micro Edition), which is derived from the Java language, in which its functions is focused on creating applications in mobile environments. Java is a software technology, in which programming language included. Also Java is a platform that has a virtual machine and libraries needed to write and run a program.

Java initially developed in the computer environment by Sun Microsystems Inc.. with the aim to produce a simple computer language without having to be bound to a specific architecture. In 1995 Sun released a Java-based browser with the nickname of Hot Java, and then followed by Netscape decided to make a browser equipped with Java language. Afterwards, joined also the leading developers such as IBM and Microsoft.

The following year, Sun Microsystems Inc.. released Java Software Development Kit (JDK) first, which is JDK 1.1. Then continue to develop the programming that runs the applet in the browser into a world-class programming that is widely used for the development of a variety of applications.

Java programming language itself roughly divided into 3, namely the Java 2 Standard Edition (J2SE), Java 2 Enterprise Edition (J2EE) and Java 2 Micro Edition (J2ME). J2SE is used to develop desktop applications and applets. J2EE is used to develop applications based on client / server enterprise scale. And J2ME are applied to a variety of small devices with the amount of memory, storage capacity and limited user interface, such as mobile phones and PDAs.

Until now, there are two versions of the Java J2ME platform is commonly used in mobile phones is still MIDP 1.0 has a simple specification and provides the basic functionality for mobile applications, including basic user interface and network security. MIDP 2.0 and have added various features such as gaming, multimedia, support various types of connectivity, as well as OTA.