1. 使用SwetakeQRCode在Java项目中生成二维码
http://swetake.com/qr/ 下载地址
或着 http://sourceforge.jp/projects/qrcode/downloads/28391/qrcode.zip这个是日本人写的,生成的是我们常见的方形的二维码
可以用中文
如:5677777ghjjjjj
有朋友问我要这个图片生成的代码,我就在网上搜索然后整理了一个类,首先要把SwetakeQRCode的jar包qrcode.jar放在工程的编译路径下,这个包的下载地址就是上面给出的SwetakeQRCode的官http://.google.zxing.qrcode.QRCodeWriter;public class QRCodeEvents { public static void main(String []args)throws Exception{ String text = "你好"; int width = 100; int height = 100; String format = "png"; Hashtable hints= new Hashtable(); hints.put(EncodeHintType.CHARACTER_SET, "utf-8"); BitMatrix bitMatrix = new MultiFormatWriter().encode(text, BarcodeFormat.QR_CODE, width, height,hints); File outputFile = new File("new.png"); MatrixToImageWriter.writeToFile(bitMatrix, format, outputFile); }}
以上就是对Java 生成二维码的工具的资料整理,后续继续补充相关资料,谢谢大家对本站的支持!