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.

Results 1 to 4 of 4

Thread: How to make Netbeans know about java.nio.file copyTo?

  1. #1
    Junior Member
    Join Date
    Mar 2011
    Posts
    2
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default How to make Netbeans know about java.nio.file copyTo?

    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.


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: How to make Netbeans know about java.nio.file copyTo?

    Have a look at the API for Path - Java Platform SE 7 b133 Currently the doc is subject to change, but I see no reference to the copyTo method you are trying to use.

  3. The Following User Says Thank You to copeg For This Useful Post:

    jedast (March 15th, 2011)

  4. #3
    Junior Member
    Join Date
    Mar 2011
    Posts
    2
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: How to make Netbeans know about java.nio.file copyTo?

    Yes! Thank you much. I got my information about copyTo from:

    Copying a File or Directory (The Java™ Tutorials > Essential Classes > Basic I/O)

    Could that be a document describing future plans or ?

    Thanks again,
    Jeff

  5. #4
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: How to make Netbeans know about java.nio.file copyTo?

    At this time java7 is still under development, and in fact the API page states at the top
    Please note that the specifications and other information contained herein are not final and are subject to change. The information is being made available to you solely for purpose of evaluation.
    So beware of using methods referenced in the docs that don't exist, or methods that exist but can't be found by the compiler (if that made any sense )

  6. The Following User Says Thank You to copeg For This Useful Post:

    jedast (March 15th, 2011)

Similar Threads

  1. How to make java search for a file?
    By StarKannon in forum Java Theory & Questions
    Replies: 1
    Last Post: February 2nd, 2011, 01:36 PM
  2. [SOLVED] i cant make a java jar file which can search data from mysql
    By talha07 in forum JDBC & Databases
    Replies: 6
    Last Post: January 20th, 2011, 06:09 AM
  3. How to execute a Java program independent of Netbeans.
    By ShaunB in forum Java Theory & Questions
    Replies: 4
    Last Post: January 19th, 2010, 06:23 AM
  4. quite small (make the changelog non-static, i.e. load its content from a file)
    By Abdallah in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: November 30th, 2009, 09:00 PM
  5. Java ME / Netbeans : Device Name
    By Drakenmul in forum Java ME (Mobile Edition)
    Replies: 0
    Last Post: July 27th, 2009, 02:37 PM