Short Description...
QR (abbreviated as Quick Response) is the trademark for a type of matrix barcode (or two-dimensional or 2D barcode) first designed for the automotive industry in Japan. A barcode is a machine-readable optical label that contains information about the item to which it is attached.
A QR code consists of black modules (square dots) arranged in a square grid on a white background, which can be read by an imaging device (such as a camera, scanner, etc.) and processed using Reed-Solomon error correction until the image can be appropriately interpreted. The required data are then extracted from patterns that are present in both horizontal and vertical components of the image.
Output...
Lets Code...
Lets do some magic in JAVA to create own program to generate QR Code. If you are familiar with JAVA then it ok otherwise you must first follow some good tutorial of Java. They can be found at www.javatpoint.com, www.tutorialspoint.com etc
In JAVA creating a whole program to create QR Code is a little bit tricky to do but don't worry I am not going to teach you whole programming. Yes, we are going to use some pre-build libraries by ZXing (get on github).
QR (abbreviated as Quick Response) is the trademark for a type of matrix barcode (or two-dimensional or 2D barcode) first designed for the automotive industry in Japan. A barcode is a machine-readable optical label that contains information about the item to which it is attached.
A QR code consists of black modules (square dots) arranged in a square grid on a white background, which can be read by an imaging device (such as a camera, scanner, etc.) and processed using Reed-Solomon error correction until the image can be appropriately interpreted. The required data are then extracted from patterns that are present in both horizontal and vertical components of the image.
Output...
![]() |
Scan this code and Comment the secret written in it. |
Lets do some magic in JAVA to create own program to generate QR Code. If you are familiar with JAVA then it ok otherwise you must first follow some good tutorial of Java. They can be found at www.javatpoint.com, www.tutorialspoint.com etc
In JAVA creating a whole program to create QR Code is a little bit tricky to do but don't worry I am not going to teach you whole programming. Yes, we are going to use some pre-build libraries by ZXing (get on github).
Prerequisite...
- Netbeans (IDE) with JAVA latest SDK
- ZXing QR Code generator libraries (Download)
Libraries...
- qrgen-1.3.jar
- zxing-core-2.0.jar
- zxing-1.7.jar
Get them from official ZXing github repository or download them directly from HERE.
Lets Do it...
Step 1 :
Create a new JAVA project in Netbeans IDE and name it QRCodeGenerator.
Step 2
Expand the project folder on left of Netbeans IDE and right click on Libraries and select Add JAVR/Folder
Step 3
Move to the folder where you have downloaded jar files on the left and select all three file on the right box and click OK
Step 4
Write the following java code in main java file
/* * * QRCodeGenerator.java * */ package qrcodegenerator; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.util.Scanner; import net.glxn.qrgen.QRCode; import net.glxn.qrgen.image.ImageType; /** * @author anujsharma **/ public class QRCodeGenerator { /** * @param args the command line arguments * @throws java.io.FileNotFoundException */ public static void main(String[] args) throws FileNotFoundException, IOException { // TODO code application logic here Scanner sc = new Scanner(System.in); System.out.println("QR CODE Generator...."); System.out.println("********************************"); System.out.println("Enter The String to create QR : "); String details = sc.nextLine(); System.out.println("Enter the path to export QR File : "); String path = sc.nextLine(); ByteArrayOutputStream out = QRCode.from(details).to(ImageType.PNG).withSize(300, 300).stream(); File f = new File(path+"qr.png"); FileOutputStream fos = new FileOutputStream(f); fos.write(out.toByteArray()); fos.flush(); System.out.println("QR Code Created Successfully."); } }
Step 5
Thats it... Now run your file and get your QR Code generated
NOTE:::
User Inputs....
PATH : to produce QR Code at the location given.
Follow Us
Were this world an endless plain, and by sailing eastward we could for ever reach new distances