1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
|
README for libdmtx Java wrapper version 0.7.2 - September 4, 2009
-----------------------------------------------------------------
The libdmtx Java wrapper was written by Pete Calvert and is
distributed as part of the libdmtx package.
1. Installing libdmtx-java on GNU/Linux
-----------------------------------------------------------------
libdmtx does not need to be installed system-wide to build the
Java wrapper, but it does need to be compiled in the grandparent
directory. If using the "make" command, this and other
prerequisites will be met simply by running:
$ make
To build and run the test programs:
$ make check
$ export CLASSPATH=.:$CLASSPATH
$ export LD_LIBRARY_PATH=native:$LD_LIBRARY_PATH
$ javac GUIExample.java
$ java GUIExample
If your system runs SELinux then you may need to either switch to
Permissive mode, disable it entirely, or assign a security
context that allows Java to load the native/libdmtx.so library.
2. Installing libdmtx-java on Windows
-----------------------------------------------------------------
Assuming that you have followed all of the instructions for
compiling the main code in Windows (using MinGW and MSYS), you
need to alter the Makefile so that it generates windows/java
friendly DLLs. Change the CFLAGS line to read:
CFLAGS=-shared -fpic -Wl,--add-stdcall-alias
Also change the output name, "NATIVE_SO", to be the windows name
of the file the provided java code will look for:
NATIVE_SO=native/dmtx.dll
Then navigate into the /wrapper/java folder in msys and execute
$ make check
MinGW needs to be java enabled to complete this properly
(I think) - you can do this most easily by simply running the
install file for MinGW again and checking the box for java, if
you didn't do so on original installation. You can also edit the
fstab file to point /java to your windows copy of java, though if
you go this route you'll need to edit the Makefile to point to
the appropriate include directories. Once you've generated the
dll, copy it (from the /wrapper/java/native folder) to wherever
in Windows you're actually running the dmtx code from (i.e.
netbeans project root directory) and viola! you now have access
to the DMTXImage and DMTXTag classes.
3. Installing libdmtx-java on OS X
-----------------------------------------------------------------
OS X is Darwin based, and doesn't use standard malloc.h. You need
to change
#include <malloc.h>
to
#include <stdlib.h>
in native/org_libdmtx_DMTXImage.c
Also, the option for building a library is -dynlib, not -shared,
and the include files are in a funny place, so the relevant lines
in my makefile are now:
CFLAGS=-dynamiclib -fPIC
INCLUDE=-I ../.. \
-I /System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers/
(This was on 10.5, Intel)
Also, it didn't like looking in LD_LIBRARY_PATH for the native libs, so to test it I ran:
$ java -Djava.library.path=native GUIExample ../../test/rotate_test/images/test_image07.png
(I believe the -D stye is more modern and portable)
4. This Document
-----------------------------------------------------------------
This document is derived from the wiki page located at:
http://libdmtx.wikidot.com/libdmtx-java-wrapper
If you find an error or have additional helpful information,
please edit the wiki directly with your updates.
|