jrlynch1 0 Newbie Poster

Hello!

I am working through some program to auto-print files to a post script printer via the LPR command. The entire program is running, going through directories, finding the files, then deleting the files. Before deleting the files, though, I added in a section to try and print the files but it does not work for me. Here is a snippet:

try
		 {
			String command = "LPR -S"+printer+" -P1 -d \""+path+"\\"+temp+"\"";
			System.out.println(command); 
			Process child = Runtime.getRuntime().exec(command);
		 }
		catch(IOException e)
		 {
			System.out.println("Print error.");
		 }

Maybe I am just completley mis-understanding the runtime class? I read through it and its my impression that I can execute a command line statement in there, such as stopping a service or, in this case, LPRing a file out. I have a System.out to prove that the command is correct, as I can copy+paste it out and into a command line and the file prints.

Or maybe I am taking a complete wrong approach? I don't NEED to be using LPR, I just thought this would be the simplest way...

If there are better suggestions I am very open to reworking this completely!!!

TIA!!!