I'm new to Java, experienced with C. I am using Netbeans 7.0 Beta 2 on a windows XP PC as my IDE for JDK7. I have successfully tested several small apps. Now I want to write an app using JDK7 java.nio.file copyTo functionality.
Here is the code I am starting with
package filecopy; import static java.nio.file.StandardCopyOption.*; import java.nio.file.Paths; import java.nio.file.Path; import java.io.IOException; import java.nio.file.StandardWatchEventKind.*; public class FileCopy { public static void main(String[] args) { Path fromFilePath = Paths.get("C:\\aaaaa.jpg"); Path toFilePath = Paths.get("C:\\Documents and Settings\\Owner\\Desktop.aaaaa.jpg"); fromFilePath.copyTo(toFilePath, REPLACE_EXISTING, COPY_ATTRIBUTES); return; } }
The line "fromFilePath.copyTo(toFilePath, REPLACE_EXISTING, COPY_ATTRIBUTES);" is flagged in error with the message:
cannot find symbol
symbol: method copyTo(java.nio.file.Path,java.nio.file.StandardCo pyOption,java.nio.file.StandardCopyOption)
location: interface java.nio.file.Path
I would be very appreciative if anyone would suggest what I should do to make copyTo known to the IDE.