Hey, I'm trying to copy a exe file from one location to another. It seems simple, but I have failed to find anything about it besides coping the contents in txt files, but that does nothing for executable.
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
Hey, I'm trying to copy a exe file from one location to another. It seems simple, but I have failed to find anything about it besides coping the contents in txt files, but that does nothing for executable.
Show what you've tried.
Well, I don't even know where to start, all the examples I've seen gone like this
private static void copyFileUsingFileStreams(File source, File dest) throws IOException { InputStream input = null; OutputStream output = null; try { input = new FileInputStream(source); output = new FileOutputStream(dest); byte[] buf = new byte[1024]; int bytesRead; while ((bytesRead = input.read(buf)) > 0) { output.write(buf, 0, bytesRead); } } finally { input.close(); output.close(); } }
--- Update ---
Well, Now I feel stupid, it was just a typo on my end
And if you use Java 7: Files (Java Platform SE 7 )