In the first part we looked at the requirements and prepared the media. If you have not downloaded and played the VR from that first part, do it now. Next you will make a VR for the cellphone with your own media. Discussion of advanced features is left for the last installment.
Prepare the Java Archive
- Copy the QTVR you prepared during part 1 and the PTViewerME2 Java archive into a new folder
- Start a command line prompt and change to that folder
- Extract the PTViewer Java archive with the following command
jar xf PTViewerME.jar
- Delete the PTViewerME.jar file itself
- Move MANIFEST.MF from inside the META-INF folder one level up
- Delete the META-INF folder
- Delete the .mov files that were in the archive
- Edit the file default.html
<title>Panorama</title><embed> name="Chiostro" file="chiostro.mov" autopan=0.5 order="0,2,1,3,4,5" </embed>
The embed tag can take many parameters. Of importance to us at this moment are file and order. Set the name of your QTVR in file, and make sure order is like above: the order of the left and right cubefaces is swapped in PTviewerME2 with respect to the QTVR format.
- Edit MANIFEST.MF
Manifest-Version: 1.0 MicroEdition-Configuration: CLDC-1.1 MIDlet-Name: Chiostro Created-By: 1.4.2_05 (Sun Microsystems Inc.) MIDlet-Permissions: javax.microedition.io.Connector.file.read MIDlet-Vendor: You MIDlet-1: Chiostro, PTViewer.png, PTViewerME MIDlet-Version: 1.0 MicroEdition-Profile: MIDP-2.0
Write down the MIDlet-Name as you will use it later for the deployment. Don’t worry about the rest, we’ll look at it in more detail later.
- Prepare a new Java archive
jar cfm Chiostro.jar MANIFEST.MF *
Deploy The Java Archive
Our Java midlet is now ready, let’s prepare it for deployment.
- Look up the size of the JAR file. In the example below it is exactly 82,978 bytes. This value is very important, write it down.
- Create a new file. The filename is the same as the JAR, but the extension is JAD, so in this case it is Chiostro.JAD. Start with the content of MANIFEST.MF and complete it to look like below. Details in this file are critical to midlet deployment. If a value is not right, the phone will indicate the MIDlet is corrupt and refuse to play it.
MIDlet-1: Chiostro, PTViewer.png, PTViewerME MIDlet-Jar-Size: 82978 MIDlet-Jar-URL: Chiostro.jar MIDlet-Name: Chiostro MIDlet-Permissions: javax.microedition.io.Connector.file.read MIDlet-Vendor: You MIDlet-Version: 1.0 MicroEdition-Configuration: CLDC-1.1 MicroEdition-Profile: MIDP-2.0
- In the MIDlet-Jar-Size line enter the exact size of the JAR that you looked up earlier
- The MIDlet-Jar-URL is the file name
- It is paramount that the lines that are present in both the MANIFEST.MF and the JAD file are exactly the same
Copy the pair of JAR/JAD files to your Java-enabled cellphone and enjoy.
If it does not work…
- Make sureboth the JAR and the JAD file are copied to the cellphone.
- Check again the JAD file, particularly the Jar-Size. If you re-worked your JAR, chances are that its size has changed.
- If the cellphone indicates an invalid application, check MANIFEST.MF and the JAD file for consistency.
- Make sure the MIDlet name matches the filenames for both JAR and JAD files.
- And if you need support hugin-ptx is where free panoramic software is discussed.