Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

getRuntime().exec(cmd) createprocess error=2 when trying to copy

807603Jan 2 2008 — edited Jan 3 2008
Hi there,

Using .exe and copy methods have been covered quite allot in these forums, but I cant quite find one that shows me why this isnt working:

when I run the following code (on a windows machine)
String cmd="COPY \"" +origiFTPlocation+ "\\\\"+zipfilename+ "\" \""
+ finalLocation +  "\""; 
				
try{
	Process run = Runtime.getRuntime().exec(cmd);
	run.waitFor();
	}catch(Exception e){System.out.print(e.getMessage());			
	}
cmd = COPY "C:\\Documents and Settings\\psd_tmp4\\My Documents\\JavaProjX\\OWF\\origiFTPlocation\\age_v0_i0_ao.zip" "C:\\Documents and Settings\\psd_tmp4\\My Documents\\JavaProjX\\OWF\\finalLocation"
I get the following error:
can not tun program "COPY": createprocess error=2, the sytem cannot find the file specified
but this works fine when copying and pasting into comand line???

I have tried converting to single slashes but get the same

Edited by: Mr_Tuition on Jan 2, 2008 8:21 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 31 2008
Added on Jan 2 2008
12 comments
658 views