Example for Java Swing GUI by XML > Distribution
Previous Page Contents Next Page
OOP XMLPanelEdit home page

Contact Us

Distribution

Prepare the distribution

Now we are in the last step! In this step, all the related files will be merged into the single JAR file for the distribution. The generated JAR file should be ready for starting your application. The users can start the example editor just by:

To make it possible, the following files should be merged into the single distribution JAR file: Up to the previous step, the first 3 files are already placed under the project directory and ready for to be merged. So, in this step, you will prepare the rest of them.

Property resource files

As described in the previous page, the XML file for Swing GUI need to be pointed by the property resource file. The name of the property resource file should start with the class name, and end with _language_COUNTRY.properties. For example, the property resource file for:

will be: Or, if you prepare the property resource for Japanese language, it will be: And the default property resource file is: Because you cannot prepare for the property resource files for all the Locales in the world, do not forget the default one.
For details about the suffix of the property resource file, please read the related section of Java Tutorial.
In this example, you need to prepare the property resource files for: The default property resource files for them are: These property resource files must specify the URL for the corresponding XML by xml_url property. All the default property resource files are already included under example directory of the distribution. Please explore them. As you notice, the properties other than xml_url are also specified.
The URL pointed by the value of xml_url will be the URL relative to project directory. Because it is the URL, not the file path, its file separator is always / (slash) independently from the file system. The URL does not includes \ (back-slash), regardless of the OS.
If you prepared the additional XML for the specific Locale, you need to prepare the property resource file for that Locale. And, the property resource file for that Locale should point your additional XML.

Manifest file

The manifest file can contain the information about JAR file and can be specified by jarcommand. If the fully qualified class name of the main class is specified in the manifest file, the main method of that class will be invoked automatically by java command. For example, the users can start the example editor just by:

In the example directory of the distribution, you will find mani.txt, which points: as the main class.

Abstract classes

Because your Swing application is always the subclass of one of:

, the classes (and the related ones) should be shipped with your subclass. They are included in runtime.jar, which you will find in the distribution. Please copy it to your project directory and rename it as you like. In this example, please copy runtime.jar into example directory, and rename it to text_editor.jar .

Let's ship your product

Now, all the required files are placed under example directory, which is the project directory of this example. To make the distribution file for this example, just type:


jar ufm text_editor.jar mani.txt com/ gui/ image/ *.properties

In case of Windows OS, the command will be:

jar ufm text_editor.jar mani.txt com\ gui\ image\ *.properties

By these commands, all the required files are merged into text_editor.jar. And, because mani.txt is specified as the manifest file, the users can start the example editor just by: What does this mean? Yes, you are ready for shipping your product. It is easy, isn't it?

Java and all Java-based trademarks and logos are trademarks or registered of Sun Microsystems, Inc. in the United States and other countries.


Previous Page Contents Next Page
OOP XMLPanelEdit home page

Contact Us


ALL CONTENTS COPYRIGHT 2002, Jun Inamori. All rights reserved.
Any questions and comments are welcome to Jun Inamori .