Closed vinaygopinath closed 4 months ago
Could you please add documentation to the README on how to use the Java wrapper? I see build.xml in the java subfolder. Is this wrapped intended to be used by the Ant build system?
The process so far has been to understand enough about JNI to create the wrappers and provide a simple example console app:
make -C src/c-lib -j `nproc`
cd src/java
ant example
LD_LIBRARY_PATH=../c-lib/build java -Djava.library.path=. -classpath .:libgs1encoders.jar Example
This is mainly to show that art of the possible, and it is for developers to determine what's necessary to integrate with their project's build system. The lack of documentation is acknowledged.
Reading through https://github.com/gs1/gs1-syntax-engine/pull/4, it sounds like publishing a multi-architecture JAR on Maven is/was being considered. Is that still on the cards? I wasn't able to find this library on Maven Central.
Packaging up the library for distribution may indeed to preferable to vendoring in the JNI (and perhaps also the Syntax Engine code itself).
I've provided details about the status of this in PR #4.
This is mainly to show that art of the possible, and it is for developers to determine what's necessary to integrate with their project's build system. The lack of documentation is acknowledged.
The Java wrapper build system has been amended to create a JNI library that statically links the GS1 Syntax Engine by default, which simplifies (manual) distribution. It is no longer necessary to install the Syntax Engine as a separate shared library in order for a project to use the wrapper.
To build the Java JNI library:
make -C src/c-lib -j `nproc`
ant -f src/java/build.xml test
Then use the resulting src/java/libgs1encoders.{jar,so}
files into your project as local dependencies, as you would with any other JNI library, remembering to set your classpath to include the .jar
file and java.library.path
to find the .so
file.
Also ensure that there is an instance of the Syntax Dictionary (gs1-syntax-dictionary.txt
) in your project's runtime working directory, otherwise the library will fall back to the compiled in default.
Brief information is provided here: https://github.com/gs1/gs1-syntax-engine/blob/main/src/java/build.xml#L19-L45
Could you please add documentation to the README on how to use the Java wrapper? I see
build.xml
in the java subfolder. Is this wrapped intended to be used by the Ant build system?For context, I'm trying to use the Java wrapper from a Gradle-based Android project. @terryburton Reading through #4, it sounds like publishing a multi-architecture JAR on Maven is/was being considered. Is that still on the cards? I wasn't able to find this library on Maven Central.