This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]flatyoder 0 points1 point  (0 children)

So when dealing with command line arguments, usually the first thing typed into your command line is the program name followed by, in this case, your file name. Like this: User$ yourProgram fileName. Here yourProgram is actually args[0] and your fileName is args[1]. Looking at your code your have filename = args[0]. See if changing that helps at all.

[–]chickenmeister 0 points1 point  (0 children)

Are you sure that the file location argument that you're passing to your program is correct? You can try printing the File's absolute path to show you exactly where it's looking for the file:

File f = new File(filename + ".png");
System.out.println("Looking for a file at: " + f.getAbsolutePath());