« July 22, 2006 | Main | October 10, 2006 »

September 6, 2006

Building a TINI application with Xcode

This post explains how I build applications for the TINI using Xcode. It was written for Xcode 2.4.

  • Create a new Java Tool project in Xcode. The description says “This project builds a library or application as a JAR file.”

  • Double-click the main and only target under Targets. The target editor opens. We will need to do the following:

    • add tiniclasses.jar to the search path for Java classes;
    • tell javac to target version 1.1 of the virtual machine;
    • tell Xcode to generate a class hierarchy instead of a Java archive (JAR file).
  • In Search Paths, drag and drop the tiniclasses.jar file (from the TINI SDK) under Java Classes, or select Java Classes, click the + button and select the tiniclasses.jar file in the file dialogue. This adds the TINI classes to the class path.

  • In Java Compiler Settings, change Target VM Version to 1.1 and Source Version to 1.3. The TINI runs a 1.1 virtual machine and a source version of 1.3 seems to be required in order to compile version 1.1 classes.

  • In Java Archive Settings, change Product Type to Class Hierarchy. This will create a folder containing the class files, on which we can subsequently run the TINIConvertor tool, instead of a JAR file.

The final step is to call the TINIConvertor tool through a shel script build phase, in order to build the TINI executable:

  • Right-click on the last build phase in the left pane of the target editor (most likely Copy Files) and select New Build Phase — New Shell Script Build Phase. A Run Script build phase will be added to the end of the build phase list.

  • In the Script text field of the new build phase, paste the following script:

    TINIPATH=$LOCAL_LIBRARY_DIR/TINI/bin
     
    java -classpath "$TINIPATH/tini.jar" TINIConvertor \
        -f "$CLASS_FILE_DIR" -d "$TINIPATH/tini.db" \
        -o "$TARGET_BUILD_DIR/$PRODUCT_NAME.tini"
    

    Replace the value for TINIPATH with the actual path to your copy of the TINI SDK, i.e. the folder that contains tini.jar and tini.db. We use $CLASS_FILE_DIR to locate the class files, $TARGET_BUILD_DIR to locate the build directory and $PRODUCT_NAME to name the executable.

That’s it. Unfortunately, it seems that you have to go through these steps for both the Debug and Release build configurations. You can now build your project and if all goes well, a .tini file should land in your build/Debug or build/Release folder. If not, drop me a note.

Sony Ericsson bitten by Auto Smart-Ass Formatter

I contacted Sony Ericsson support today, and here’s a bit of the automatic response I received (emphasis mine):

Nous vous remercions d’avoir contacté le Sony Ericsson Call Center. Votre demande a été enregistrée et porte la référence « CaseIDonlyTag ». Le Sony Ericsson Call Center vous contactera le plus rapidement possible.

Yes, apparently when you write in French, Word/Outbreak automatically adds non-breaking spaces inside the guillemets and it screws up your template tags.

Fortunately, Auto Formatter is one of the many Microsoft bugs that has a preference to fix it.

Do not meddle in the affairs of Coding Ninjas, for they are subtle and quick to anger.