This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes I/O and Streams and the fly likes How to change the current working directory in eclipse. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "How to change the current working directory in eclipse." Watch "How to change the current working directory in eclipse." New topic
Author

How to change the current working directory in eclipse.

Chan Ag
Bartender

Joined: Sep 06, 2012
Posts: 1000
    
  16
Hi,

My current code has the following line.



When I run the code that has this line, I get the following exception.

Import <something>: ..\logs\UPloaded_31_11_2013_14_38_11.csv (The system cannot find the path specified)
java.io.FileNotFoundException: ..\logs\UPloaded_31_11_2013_14_38_11.csv (The system cannot find the path specified)

I think ".." refers to the current working directory. I want to set my current working directory to a certain directory on my workspace for this project only.

Currently in my run configuration, under the arguments tab, in the working directory field I have this--> Default - $(workspace_loc:<something>_2014)

How can I supply another path in the other field, for example for abc/def/a, what should I specify there?

Thanks,
Chan

Currently for testing my changes, I have changed the above code as

Chan Ag
Bartender

Joined: Sep 06, 2012
Posts: 1000
    
  16
This is resolved. The mistake I was doing was, I was appending the dollar sign to the path. Just specifying the path without the dollar sign worked.

Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 2170
    
  47
I know you've already solved this but I thought I'd just add some information based on your original post.

I think ".." refers to the current working directory

No, '..' means go back one level ie move to the parent of the current directory.

Currently in my run configuration, under the arguments tab, in the working directory field I have this--> Default - $(workspace_loc:<something>_2014)

How can I supply another path in the other field, for example for abc/def/a, what should I specify there?

You click on the 'Other' radio button and then specify the directory you want to use as the current working directory.
Chan Ag
Bartender

Joined: Sep 06, 2012
Posts: 1000
    
  16
Oh yes, it's the same ".." we type while specifying the path. Sorry I got confused.

Thanks for correcting me, Tony.

Chan.
 
Consider Paul's rocket mass heater.
 
subject: How to change the current working directory in eclipse.
 
Similar Threads
Access is denied error message
deployment issue
Question related to Classpath when using the java and javac commands.
Web Application Configuration Question
Servlet