?
Solved

Correct Path not being Passed

Posted on 2006-11-10
8
Medium Priority
?
166 Views
Last Modified: 2010-03-31
I am trying to copy a file from one location to another but my file path seems to be getting "changed" on the way.

I start off with: ThreadProcessFiles processThread = new ThreadProcessFiles(new File(fileList[0]).getAbsolutePath());

But the output in the called class looks like: C:\Documents and Settings\username\workspace\ProjectTestImage-001.tif

Which property should I be passing to have the correct link to the file in the Windows platform?

0
Comment
Question by:lasutton
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
8 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 17916635
>>But the output in the called class looks like: C:\Documents and Settings\username\workspace\ProjectTestImage-001.tif

What is wrong with that and why?
0
 

Author Comment

by:lasutton
ID: 17916648
The actual location of the original file is C:\Input\TestImage-001.gif.

0
 

Author Comment

by:lasutton
ID: 17917204
My problem was as follows:

When using a ".list" of a directory, the string does not contain the path of the files created.  As the path returns a "null" value the .get..Path.. values return the directory of the running application.  

So the directory name needs to be prefixed to the file name found.

                  File foundFile = new File(directoryToMonitor + File.separatorChar + fileList[0] );
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 92

Expert Comment

by:objects
ID: 17918058
>                File foundFile = new File(directoryToMonitor + File.separatorChar + fileList[0] );

could also be done using:

File dir = new File(directoryToMonitor);

               File foundFile = new File(dir, fileList[0] );
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 1500 total points
ID: 17918848
>>the .get..Path.. values return the directory of the running application.  

You'll find it's not that directory but the one from where it's being run
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 17930211
:-)
0
 
LVL 92

Expert Comment

by:objects
ID: 17936733
> You'll find it's not that directory but the one from where it's being run

the directory of the running appication *is* the directory where it is being run from :-D
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 17936744
?
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn different types of Android Layout and some basics of an Android App.
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This video teaches viewers about errors in exception handling.
Suggested Courses

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question