i have developed an invoice generate program. each pdf invoice include an image on top left corner, when i run the application on someone else's machine(not the developed machine), it doesn't show the image on top left corner of the pdf.
this is how I read the image:
Image companyLogo = Image.getInstance("images/amadeus14.png");
This is my option 1
within the project i have created a package and inside it i have made a folder called image. inside that folder i have put that image file and tried to access it in my program.
Image companyLogo = Image.getInstance("Resources/Images/HemasLogo.jpg");
this is my option 2 option
but it gives an error saying
java.io.FileNotFoundException: C:\\Users\\businesssupport\\Documents\\NetBeansProjects\\invoiceGenerator\\Resources\\HemasLogo.jpg (The system cannot find the path specified)
Looking at your previous questions this and this ,
System.getProperty("user.dir"))
) So, I can see 2 options:
to put the image inside a package before packing the application, then you will be able to read it from any computer without making any changes
Use a local folder. You will need to create a common folder for each installed computer, then manually copy the image on each computer, and read it like
Image companyLogo = Image.getInstance("C:\\\\myApp\\\\images\\\\amadeus14.png");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.