ith all the hype that servlets, JSPs, EJBs, and distributed J2EE applications have received, the art of creating a basic interactive command line Java application has been lost. Although fancy Swing-driven GUIs or browser-based clients are great for the end users of your company's software development packages, they aren't really necessary for in-house tools or utilities that you write to aid your development process. Very often, writing a Swing or browser-based interface for a maintenance or development tool is overkill in the first place and also cumbersome to maintain. What you need for these situations is something that's quick, efficient, and easily scaled to accommodate new features. What you need is an interactive command line interface.
Although more advanced Java users will have more cause to use this technique, the material discussed in this article is fundamental in nature. Beyond having a basic understanding of the Java i/o classes, no special knowledge or background is necessary to understand this material. Two complete examples are provided at the end:one general example, and one more advanced example.
When Swing and browser-based GUIs are overkill, how can Java be used to develop a simple, efficient user interface?
The process of creating an interactive command line Java application is not a complicated one. There are three distinct steps involved in building this type of application:
- Determining the need
- Writing the code
- Pulling everything together