Nov 25

No, it has nothing to do with armed conflict. Making WAR files is the Java way of packaging, distributing, and deploying web applications. While JAR stands for “Java archive”, WAR stands for “Web application archive”, or simply “Web archive”. In fact, the JAR and WAR formats are both gzipped directories that include a manifest. While a JAR file typically contains a collection of class files, a WAR file contains the entire content that goes into a Java Web application. More precisely, a WAR file contains all the static content, directories, JSPs, beans and classes, libraries, as well as the web.xml deployment descriptor. If you unpack a WAR file, you get a directory structure that mirrors the document root of a deployed application in a web container, such as Tomcat. I recently had to create a Web application in Eclipse. I realised that despite having worked with Eclipse for five years, this is something I never did before, because in the past I used Netbeans for creating web applications. But it’s just as easy in Eclipse. Here are is how:

To create a Java web project, you need to have the following software installed: a Java JDK, a recent version of Eclipse that contains the WTP Web Tools Platform module for Eclipse, and a web container or an application server, such as Tomcat, JBoss, WebSphere, etc.

1…Select File/New/Project from the menu. The following dialogue appears:

webapp-img01.png

2…Select Dynamic Web Project from the list and click on the Next button.
webapp-img02.png

3…Type a name for the new project and select a file system location for it. In the Target Runtime option, specify the web container or application server you using. This server is used to build and deploy your web application. If the drop-down box does not contain the desired server, click New… and select one of the predefined configurations (see Step 4). If you have already defined a Target Runtime, you can skip ahead to Step 6. The Dynamic Web Module version option specifies the architecture you are going to use in the web project. Select the latest version for a new project. Unfortunately, this cannot be changed later. By clicking the Modify… button in the Configuration section, you can select “facets” for your web application. What Eclipse calls “facets” are various building blocks and APIs, such as Java Server Faces, Java Persistence API, etc., that add functionality to your application.

webapp-img03.png

4…The New… button in the Target Runtime section opens a dialogue that lets you select the server on which the application is developed and deployed, which is probably the most important aspect of your configuration. Eclipse offers a number of common configurations for popular servers. If you cannot find your server in this list, click on the Download additional server adapters link and chances are that your server is listed. Make sure that the Create a new local server option is checked, so that you can find the server in the Eclipse server view later on.

webapp-img04.png

5…Once you specified the server type, you need to provide some details about it, such as the installation directory of the server, or the server root, and the JRE you want the server to run on. Click Finish when done.

webapp-img05.png

6…Finally, the dynamic web project wizard prompts you for some basic configuration data. The Context Root is the name that the web container matches with the  location where the application is deployed and simultaneously constitutes the root URL for the web application. The Content Directory specifies the name of the directory that contains the web application files. The Java Source Directory specifies the name of the directory that contains Java source code files. These settings are only relevant to the development machine. Make sure that the Generate deployment descriptor option is checked in order to automatically create the web.xml file. In most cases, you can probably accept the default settings and click Finish.

webapp-img06.png

7…Voilá. You have created a web application, or rather the framework for its development in Eclipse. The new project should now be visible in the Navigator view. There aren’t any files yet, except the ones which were generated automatically by Eclipse. The next step would be to write your web application, and possibly incorporating the application framework of your choice. Piece of cake.

webapp-img07.png

8…The Server view should display the server you have chosen for your project. If everything went OK, you can start and stop the server from this view. The server can be started in normal mode, debug mode, or profiling mode. Debug mode needs to be selected if you want to define breakpoints in your Java code. While you edit sources, such as JSP files, servlets, bean classes, static content, etc., Eclipse automatically redeploys these resources to the running server as soon as you save them. You can view your web application in a separate browser window and receive debug output in Eclipse’s Console view.

webapp-img08.png

9…After you have written your formidable web application, it’s time to share it with the world, or in more technical terms, to distribute and deploy it. The process of creating a distributable WAR file is extremely simple. Select File/Export from the Eclipse menu and click on the WAR file option in the Web category.

webapp-img09.png

10…After clicking the Next button, specify the web project to be packaged, the file destination, and the target server. Although the latter is not a mandatory option, it is probably an important one. The selected server is likely to be the same as the one chosen in Step 3. Click Finish and there you have your masterpiece in a handy WAR format.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Technorati
  • Facebook
  • Mixx
  • Google
  • YahooMyWeb
  • Slashdot
  • LinkedIn
  • blogmarks
  • Live
  • description
  • StumbleUpon
  • Ma.gnolia
  • MisterWong
  • NewsVine
  • Reddit
  • Spurl
  • Yigg
  • E-mail this story to a friend!
Nov 18

Pocket PCs suck! Well, they do at least suck when they don’t work as they are supposed to. …which is pretty often in my experience. To be fair, I must say that Pocket PCs are great as long as they do work. Since a Pocket PC is like a miniature computer, it offers a functional range and programmability that surpasses almost any other mobile device. Unfortunately, this leads to complexity, and complexity leads to bugs which in turn leads to malfunctioning devices. I’ve been using Pocket PCs for two years now and have developed sort of a love-hate relationship. Probably the culprit is the Windows Mobile operating system. Windows Mobile, although already in version 6, evokes bad memories of the buggy Microsoft operating systems of the nineties. Only that this isn’t the nineties. After ten or fifteen years of consumer mobile phones, we have come to expect mobile devices to work flawlessly. In fact, I am relying on my Pocket PC for many day-today tasks. I use it as a phone, alarm clock, notepad, camera, phone book, and mp3 player and more. My HP iPaq Business Navigator also has an assisted GPS, but I came to see the latter as a toy function. Due to usability issues I hardly bother to fiddle with it.

However, the question I am asking myself now is – isn’t this device just an expensive toy? Where is the robustness that should come with a “business” device . I have put in a good deal of time just to keep my pocket PC working. My HP PPC has seen the service shop twice, once because of a faulty memory chip, and another time because it didn’t boot anymore until the shop installed a firmware upgrade. In addition to that, I have spent a fair number of hours with configuration and trouble-shooting because one or another function was broken. Once I get a working configuration with all the software installed, I use Spb Backup to create a complete backup of the system. Spb Backup is a real life-saver. It backs up all configuration data, user data, applications and system data. Should the device give up its ghost or display odd behaviour (believe me, every Pocket PC will do that at some point), I can perform a factory reset and restore the backup to recreate the former status of the device easily. But even with this tool, the amount of maintenance required seems a little excessive. A gadget that carries the name “Business Navigator” should be expected to work like a business device, namely reliably. Unfortunately, I can’t say that for the HP iPaq and neither for the other Pocket PCs I’ve owned and used. As previously mentioned, I am not blaming the hardware manufacturers. The OS seems to be the crux.

Real business users would probably be better off with a smartphone that requires less messing around. A Pocket PC is more suited to -shall I put it this way- the technically inclined person.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Technorati
  • Facebook
  • Mixx
  • Google
  • YahooMyWeb
  • Slashdot
  • LinkedIn
  • blogmarks
  • Live
  • description
  • StumbleUpon
  • Ma.gnolia
  • MisterWong
  • NewsVine
  • Reddit
  • Spurl
  • Yigg
  • E-mail this story to a friend!