Hallo zusammen,
veruche grade mit dem Barbecue Libaries ein BarCode program unter Windows zu starten.
Dies klappt jedoch nicht. Könnte ihr mir helfen?
Fehlermeldung:
Exception in thread "main" java.lang.NullPointerException
at net.sourceforge.barbecue.BarcodeImageHandler.saveI mage(Unknown Source)
at net.sourceforge.barbecue.BarcodeImageHandler.saveJ PEG(Unknown Source)
at BarCode.main(BarCode.java:32)
Screenshot:
BarCode.jpg
veruche grade mit dem Barbecue Libaries ein BarCode program unter Windows zu starten.
Dies klappt jedoch nicht. Könnte ihr mir helfen?
Code:
import java.io.File; import net.sourceforge.barbecue.Barcode; import net.sourceforge.barbecue.BarcodeException; import net.sourceforge.barbecue.BarcodeFactory; import net.sourceforge.barbecue.BarcodeImageHandler; import net.sourceforge.barbecue.output.OutputException; /** * * @author Kaesar ALNIJRES * */ public class BarCode { /** * @param args */ public static void main(String[] args) { //1 get a File reference to save the bar code image File file=new File("/home/kas/barcode"); try { //2 create the bar code using a String (your data) Barcode barCode=BarcodeFactory.createCode128("Hello World !!!"); //3 save the generated bar code to the above file as jpeg image BarcodeImageHandler.saveJPEG(barCode,file); } catch (OutputException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (BarcodeException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
Exception in thread "main" java.lang.NullPointerException
at net.sourceforge.barbecue.BarcodeImageHandler.saveI mage(Unknown Source)
at net.sourceforge.barbecue.BarcodeImageHandler.saveJ PEG(Unknown Source)
at BarCode.main(BarCode.java:32)
Screenshot:
BarCode.jpg
Comment