public static void imRes(String pat) {
try {
BufferedImage bckimg = ImageIO.read(new File(\"c:/s/deneme.jpg\"));
File s = new File(pa
Change /
for \
if you are using windows.
A more cross-platform approach would be substitute
C:
for File.listRoots()[0]
and every /
for File.separator
.
Read more on the File api documentation
EDIT
(I didn't read this line, sorry)
This code was running properly untill i try to read an image from the source package
In order to get a file from inside your jar package, one must use the getClass().getResource()
method.
Example:
application-package:
|-Main.java
|-resources
|-image.jpg
For the above directory structure:
BufferedImage im = ImageIO.read(new File(getClass().getResource("/resources/image.jpg").toURI()));
Would do the trick.