JMU CS349 - Developing Multimedia
Gallery Help Policies Solutions Study-Aids Syllabus Tools
Programming Assignment 4


1 Purpose

The primary purpose of this assignment is to help you review (and demonstrate that you have acquired) the knowledge and skills required to: create a program with a simple graphical user interface (GUI), use the application architecture that you will be using for the remainder of the semester, deploy an application as an executable .jar file, and include/use resources in am executable .jar file.

2 Background

As you know, WeatherBits is a (fictitious) company that is developing and commercializing applications that will use localized, high-resolution weather forecasts. For this assignment, you must implement an application that can be used to display weather observations and forecasts.

3 Documents

WeatherBits uses a heavyweight process (as opposed to an agile process) so they have created a fairly detailed set of specifications. They are described in the following document:

4 Submission

There is a two part submission process for this assignment.
  1. You must submit (using Gradescope) a .zip file containing all of the code necessary to build your application. Gradescope will only be checking to ensure that your code complies with the course style guide. Hence, you may only submit to Gradescope five times. If you can't get your code to comply with the course style guide within five submissions, you will receive a grade of 0 on the assignment.
  2. You must also submit (using Canvas) an executable .jar file named TextApplication.jar (that must NOT contain any of the classes in multimedia2.jar ). Your code must be compiled to run under Java 21 (not higher).

5 Grading

You will receive one of four grades on this assignment -- 100, 75, 50, or 0. You will receive a grade of 100 if your code is essentially correct (i.e., a limited number of system tests do not cause any failures). You will receive a grade of 75 if you appear to have devoted significant effort to the assignment but your code has small defects. You will receive a grade of 50 if you devoted a reasonable amount of effort to the assignment but your code has major defects. You will receive a grade of 0 otherwise and/or if the code you submit to Gradescope code contains any style defects.

Gradescope will assign a maximum grade of 25 (based solely on style). Points will then be awarded manually based on the criteria discussed in the previous paragraph.

6 Help

You might find the following tips/hints helpful.

6.1 Compiling

From the command line, you can compile to a particular version of Java using the -source 21 and -target 21 options. In Eclipse, you can accomplish the same thing by setting the compiler compliance level. See the Departmental Wiki for help (or search the WWW for the terms "Eclipse" "java" "compiler" "compliance").

6.2 Handling Exceptions

You have probably developed the very bad habit of printing stack traces to standard output (i.e., System.out) in catch blocks. That's a particularly problematic practice for GUI applications because they do not have a console.

Instead, you should invoke the showMessageDialog() method in the JOptionPane class, passing it the error messages you want it to display.

6.3 Multimedia Library

The library code you need is available from the course "Help" page. Make sure you understand the difference between using the source code and using the .jar file and why you might want to do both at different times.

For help adding the .jar file containing the .class files to an Eclipse project, see the Departmental Wiki.

6.4 The Manifest

You must include a manifest file (named TextApplication.mf) in TextApplication.jar that contains something like the following:
Manifest-Version: 1.2
Main-Class: weatherbitmaps.TextApplication
Class-Path: multimedia2.jar
    
(Note: Manifests must end with a newline character.)

6.5 Creating the .jar File

You can create the TextApplication.jar file either from an IDE or from a terminal/shell.

From the command line, you should use a command something like the following (from the directory above the .class files):

jar -cvfm TextApplication.jar TextApplication.mf gui measurement resources weather weatherbitmaps
    

Obviously, you should understand all of the arguments before you behave like a lemming.

From Eclipse, you should use a process like the one described on the CS Department's wiki.

6.6 Testing the .jar File

When you test the application, make sure you do so in a "clean" directory. That is, copy TextApplication.jar and multimedia2.jar to a directory that contains nothing else (to make sure that those are the only files being used). You could otherwise be using .class files or the .txt file from the local file system and not know it.

You should then be able to click/double-click (depending on your OS) the executable .jar file to run the application. (Of course, you may first have to associate .jar files with the appropriate executable, in this case, java and/or make the file executable.)

From the command line, you can execute the application using either java -jar TextApplication.jar or java -cp TextApplication.jar weatherbitmaps.TextApplication (because the manifest instructs the interpreter to use multimedia2.jar).

Depending on how you read in the weather files, you may need to include the complete path to the file.

Copyright 2025