This piece of code work on my ubuntu box, when I import it onto Eclipse on my window, it complains:
This is the line that it complains
fileImg return null after this line, mean either directory is not exist or there is some IO error. So I print out the path of "dir" which is the folder "image" in the same directory as my source code, and I get a valid path. So the directory do exist. "dir" reference the directory. So what could be the problem? Here is my code
Sorry, it was a stupid mistake, i have the folder in the wrong location. I have the source file and image folder inside src folder, you know I want them to be in the same level. However, Eclipse does not think current level is where the source file is, to Eclipse, current level is the same level as src folder, where the project file is. That why it could not see the "image folder"
Yes... if you hadn't mentioned that you were a Unix user, I would have mentioned the possibility of differences in the current working directory. But Unix users generally know that concept. Anyway, you got it fixed so that's the main thing.
"I know this defies the law of gravity... but I never studied law." -B. Bunny Defiant tiny ad: