Tag Cloud

Showing posts with label zxing. Show all posts
Showing posts with label zxing. Show all posts

Friday, May 20, 2011

Building Zxing to Use in Blackberry Java Development

Zxing is a open source tools to read/writer various format of Barcode. Currently I'm using it for my blackberry java application.

This tutorials is about how to build zxing core using Ant.
  1. Dowloand zxing from http://code.google.com/p/zxing/
  2. Download Apache Ant http://ant.apache.org/
  3. Extract the Apache ant to a folder e.g. C:\apache-ant-1.8.2
  4. Extract the zxing (I'm using version 1.6) to a folder e.g C:\zxing-1.6
  5. Type this to build zxing core.jar

    C:\zxing-1.6> ant -f core/build.xml

    Make sure ant.bat is accessible from System Path, or you can type full directory such as
    C:\apache-ant-1.8.2\bin\ant instead of ant.
  6. Build zxing j2me.jar
    Make sure you have set the WTK-home in the build.properties
    (check C:\zxing-1.6\build.properties)

    WTK-home=D:\\Java_ME_platform_SDK_3.0

    (this is the location of Java ME SDK 3.0 installation folder)

    Set the location of Proguard.jar

    proguard-jar=D:\\proguard4.6\\proguard4.6\\lib\\proguard.jar



    Note: notice that in Java ME SDK 3.0 untuk JSR135 Mobile Media API (MMAPI) using JSR135_1.1 version, and there's no JSR135_1.2 version.

    So, edit build.xml for javame build (check C:\zxing-1.6\javame\build.xml)
    REPLACE jsr135_1.2.jar with jsr135_1.1.jar

    Then type in the console: 

    C:\zxing-1.6> ant -f javame/build.xml -lib D:\Java_ME_platform_SDK_3.0\lib;D:\proguard4.6\lib
  7. Generate zxing for rim client (rim build)

    zxing-1.6 using preverify1.1.exe, but Java ME SDK 3.0 only have preverify.exe

    edit rim/build.xml
    Find text preverify1.1, and replace with preverify

    Type in the console:

    C:\zxing-1.6> ant -f rim/build.xml


    Note: -lib in the ant command is used for specifying the classpath. For multiple classpath, we can use semicolon (;)
    See http://ant.apache.org/manual/running.html for more details