I want to use java third party qr code libary https://github.com/kenglxn/QRGen library for generating qr code.
Please guide me as i don't know how to integrate java library in jruby.
I want to use java third party qr code libary https://github.com/kenglxn/QRGen library for generating qr code.
Please guide me as i don't know how to integrate java library in jruby.
The trick in this case is to find how to properly import the 3rd party libs.
build.xml for ant:
ivy.xml for ivy:
Now typing
ant retrieve
will download and store 5 jars inlib
subfolder.If you do not have a dependency manager, here are the 5 jars urls you need to download manually and you need to move to a subfolder called
lib
:I strongly advise you to use a java dependency manager if you wish one day to upgrade the revisions of the java libraries used in this code snippet.
Next step is to use the following ruby snip.rb code in the same folder. :
Please note: jruby and java.io.tmpdir do not play well together in this particular jar case, as any call to QRcode creation with
#file()
will store file in java.io.tmpdir, whereever it is located. You've little control on the file location.So I modified the original code answer to use the stream instead and create files with finer control.
You can verify all files generated with this useful URL: http://zxing.org/w/decode.jspx