8.5 Application Systems
This section under major construction.
JavaServer Pages (JSP). A web-scripting technology similar to PHP and ASP. Can write Java code to display web pages.
JAR files. A Java Archive, or JAR for short, enables you to package together various files into a single archive. It is similar to a ZIP or tar file. To create an archive, type the following at the command line:
jar cf jar-file input-files
To extract all the files from the JAR, type:
jar xf jar-file
Alternatively, a Java program can directly access resources within a JAR file, provided the JAR file is in the classpath. As an example, cards.jar contains GIF images of the 52 playing cards, and Card.java accesses it to display images. Note that you must put the JAR file in your classpath and access the resources as URLs.
Executable JAR files. Another use of JAR files is to bundle together all of the resources for a program so that a user can download the JAR file and execute it (assuming they have the Java runtime environment installed). Here are instructions creating executable JAR files. Another option for Windows users is JSmooth, which makes a standard Windows EXE file from a Java JAR file.
Java Web Start. Java Web Start is a framework for distributing Java applications over the web. Unlike a JAR executable, the client launches an application from resources hosted on the Web instead of the local file system. This is useful if you want the user to always run the most up-to-date version of the application. Here are instructions for creating a Java Web Start application.
Applets. Java applets are automatically downloaded and launched in a Web browser and executed in a secure sandbox. One difficulty with applets is that certain browsers do not provide support for current versions of Java. Thus, you will need to instruct the browser to download an appropriate plugin if it is not already installed. appletviewer.