Mac File Input in Java

thefil

macrumors newbie
Original poster
Jun 11, 2007
27
0
I'm coming from a Windows environment and I have a bit of a file input problem...

Code:
glass = new Scanner( new File("\Users\filipkrynicki\Mydia 4.0\build\classes\mydia40\db.m4"));
returns an error "illegal escape character"

*edit* I fixed that problem by doubling the \\s, but now it can't find the file. Am I doing something wrong?
 

Eraserhead

macrumors G4
Nov 3, 2005
10,410
10,573
UK
My guess would be the use of \ instead of /.

To avoid this kind of problem, consider using File.separator instead of assuming a specific separator.
Totally correct \ is only the Windows separator, / is used by OS X/Unix/Linux. To run it on both the System Property File.separator is the way to go.