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 Java in General and the fly likes Windows File Paths 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 » Java in General
Bookmark "Windows File Paths" Watch "Windows File Paths" New topic

Windows File Paths

Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3703

Is there a quick way in java to determine if two file paths are equivalent on a windows based system if their format is different such as:

C:\Program Files\MyFile.exe

I've tried using File getCanonicalPath() but it didn't work.
[ September 19, 2006: Message edited by: Scott Selikoff ]

My Blog: Down Home Country Coding with Scott Selikoff
Joel McNary

Joined: Aug 20, 2001
Posts: 1817

I didn't have a "MyFile.exe" to test it out with, but this worked. (Java 1.4.2_04)

Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3703

Maybe I made a mistake debugging/testing, I'll try it again.
It is sorta covered in the JavaRanch Style Guide.
subject: Windows File Paths
Similar Threads
why java doesnt allow "\" ?
File.getName() in Unix
Running system command
create a file