Java: File not found exception

String file = "/c/Dir1/Dir2/abc.txt";      
BufferedReader br = new BufferedReader(new FileReader(file)); \c\Dir1\Dir2\abc.txt (The system cannot find the path specified)

My OS is Windows 7.
I am using cygwin, and i can see the /c/Dir1/Dir2/abc.txt   (unix style)
But in Eclipse, I am getting the above error.
However, if I use
File file = new File("C:\\Dir1\\Dir2\\abc.txt");      
This works fine. But is there a way for me to specify the file path in the unix style.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

File file = new File("C:/Dir1/Dir2/abc.txt");      

Open in new window

should work

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
renisenbbAuthor Commented:
Is there a way for me to specify the path in the Unix way like
Because eventually, i want my code to work on a unix box.
mccarlIT Business Systems Analyst / Software DeveloperCommented:
Because eventually, i want my code to work on a unix box.
Well then, wouldn't you just pass the file path as a parameter to your program (or have it in a properties file, or ..... many other configurable possibilities). That way you can pass "C:\Dir1\Dir2\abc.txt" to your program when running on Windows and then pass what ever the correct unix path is when you run it on the unix box.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.