Views

Java Standalone Applications

(This tutorial is a work in progress)

Introduction

Most developers are introduced to Java by creating a standalone Java application. Sometimes, called containerless applications these applications can be executed directly from the command line or from the desktop. In the enterprise, most Java applications run within a container, be it the cloud, a web server, or a full-featured enterprise server. This is not to say that standalone and containerless applications don't have their place. In fact, the trend for standalone applications that communicate with enterprise web services has been on the rise for some years now. This has been a significant impetus for the Java community to provide APIs and features that will keep Java relevant not only as a server technology, but also as a client capable of easily consuming those services.

Standalone Java clients have traditionally come in one of two flavors: a head-less application that runs from the command-line, or a Swing/AWT/SWT application providing more flexibilty for user interaction. Unfortunately, Swing, AWT, and SWT have all remained "traditional" user interface technologies whereas recent trends in user interfaces demand the dynamics and flexibility provided by rich web and media applications. There is good news, however, for those wanting to write modern web client applications in Java that support rich media on smart phones, tablets, and the desktop. One such technology showing considerable promise is JavaFX 2.2 (to be released with Java 8 as JavaFX 8). Unlike its predecessors, Swing, AWT, and SWT, JavaFX 2.2 brings the power of the modern rich media application and the modern web browser into the Java space. Moreover, it does not attempt to replace or compete with existing Swing or SWT applications, but rather serves to bridge the gap between, being capable of running on top of Swing or SWT. Since its introduction with Java 7, JavaFX 2.2 is rapidly growing a robust community, and all of the major Java IDEs now support JavaFX development. In addition, other languages that run on the JVM have also invested significant effort to support JavaFX application development.

Another trend with standalone Java clients is the containerless web application, or in other words, a web application and web server embedded within a standalone Java application. The WAM emulator which uses the embedded Jetty application server is just one example of how useful such applications can be. One of the tasks on the Stack Roadmap is to provide support for bundling Stack applications as containerless applications that can be run from the command-line or deployed to the cloud.