Simple Java QR Code Generator Example

You may also like...

2
Leave a Reply

avatar
1 Comment threads
1 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
2 Comment authors
Memorynotfound.comCaleb Bankole Olojo Recent comment authors
  Subscribe  
newest oldest
Notify of
Caleb Bankole Olojo
Guest
Caleb Bankole Olojo

It doesn’t work for me. Keeps throwing error.

Exception in thread “main” java.lang.NoSuchMethodError: com.google.zxing.Writer.encode(Ljava/lang/String;Lcom/google/zxing/BarcodeFormat;IILjava/util/Map;)Lcom/google/zxing/common/BitMatrix;
at net.glxn.qrgen.QRCode.createMatrix(QRCode.java:206)
at net.glxn.qrgen.QRCode.writeToStream(QRCode.java:202)
at net.glxn.qrgen.QRCode.stream(QRCode.java:180)
at parkingSoft.QrTest2.main(QrTest2.java:18)

Please help. Thanks

Memorynotfound.com
Guest
Memorynotfound.com

For those getting the NoSuchMethodError, you probably didn’t include the correct dependencies to your project.
Make sure the net.glxn.qrgen: javase:2.0 is on your classpath.
This version includes
– com.google.zxing:javae:3.1.0
– com.google.zxing:core:3.1.0
– net.glxn.grgen:core:2.0
– org.jfree:jfreesvg:2.1

Cheers,
Memorynotfound