• Post Reply Bookmark Topic Watch Topic
  • New Topic

Files.copy() command is not working  RSS feed

 
Yohan Weerasinghe
Ranch Hand
Posts: 507
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Please have a look at the following code


In the above code," Files.copy(file[i], "C:/JAVAY/Copied", REPLACE_EXISTING); " command generates errors and I can't figures out why...Please help me...Thanks...
 
Paul Clapham
Sheriff
Posts: 22379
42
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would start by reading the error messages...
 
Yohan Weerasinghe
Ranch Hand
Posts: 507
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:I would start by reading the error messages...


Hi paul, thanks for your reply. Actually I read the error messages but I couldn't find a solutions so that's why I came here. Actually what it generates is a runtime error, I am posting it below.

Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: Uncompilable source code - Erroneous sym type: java.nio.file.Files.copy
at FileChooserCheck.actionPerformed(FileChooserCheck.java:66)


Please help...
 
Rob Spoor
Sheriff
Posts: 21052
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Before you run your application from your IDE, make sure that there are no more compiler errors. Fix all of them before trying again.
 
Yohan Weerasinghe
Ranch Hand
Posts: 507
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply Rob Spoor....


Please have a look at the following code. The previous code generated errors because I haven't use the Path class, it is fixed in here



OK, now this is very painful ... This code works fine, but it simply creates a FILE called "JAAVAA", not a directory. If I create a directory by my self, then the program will generates "File / Folder exists" error. If I use "Replace_Existing" option in the copy() command, it will simply convert the folder in to a file. I was so confused so I renamed "JAAVAA" to "JAAVAA.txt" to see what will happen. In this case, the program copied and pasted the content of files I selected from the JFileChooser into this text file.

Anyway, this is not what I need. This is the sixth try of the tenth test drive of an application I am gonna create (ohh man, how many test drives left ), and in my real application I need to COPY AND PASTE IMAGE FILES to the desired location. What I need is copy and paste the whole file, not the content...


Please help me...............
 
Yohan Weerasinghe
Ranch Hand
Posts: 507
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

No matter, I did that!!! Please have a look at the following code




I did that!! Thanks for all of your help .. Marking this thread as solved...
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!