Menu

#35 hellow world exam does not work

open
nobody
None
5
2018-07-05
2010-09-25
Eugene
No

barbecue 1.5. betta.
Hellow word exam in stand-alone application, MyEclipse project environment causes
Exception in thread "main" java.lang.NullPointerException
at net.sourceforge.barbecue.BarcodeImageHandler.saveImage(Unknown Source)
at net.sourceforge.barbecue.BarcodeImageHandler.saveJPEG(Unknown Source)
at BarCode.main(BarCode.java:34)
It is on the line
BarcodeImageHandler.saveJPEG(barCode,file);
of example source.

jar files barbecue-1.5-beta1 and idom

Is it because of my Windows Vista 64bit? Is there another reason?
How I can get source code of net.sourceforge.barbecu to recompile?
The entire exam source sode and output is below

=======
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");
System.out.println(file);

try {
//2 create the bar code using a String (your data)
Barcode barCode=BarcodeFactory.createCode128("Hello World !!!");
System.out.println(barCode);
//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();
}

}
}

======================
\home\kas\barcode
Hello World !!!
Exception in thread "main" java.lang.NullPointerException
at net.sourceforge.barbecue.BarcodeImageHandler.saveImage(Unknown Source)
at net.sourceforge.barbecue.BarcodeImageHandler.saveJPEG(Unknown Source)
at BarCode.main(BarCode.java:34)

Discussion

  • Eugene

    Eugene - 2010-09-26

    I found a cure. Sorry for disturbing you.
    It was the file name issue.
    Please close the ticket,

     
  • Rajeesh TD

    Rajeesh TD - 2018-07-05

    Hi Eugene,
    i have a similar problem, can you spcify detailed about your file name issue.how you could solve it?

     

Log in to post a comment.