Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Correct Path not being Passed

Posted on 2006-11-10
8
Medium Priority
?
171 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
  • 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

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!

Question has a verified solution.

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

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

886 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