Mac OSX上eclipse中的filenotfound问题

Mac OSX上eclipse中的filenotfound问题,eclipse,macos,filenotfoundexception,Eclipse,Macos,Filenotfoundexception,嗨 我有一个java类,它在windows中运行良好,但在MacOSXSnowLeopard中运行不好。我在两个操作系统上都使用Eclipse。在Mac OSX上,其抛出文件未找到异常 基本上,我尝试使用BufferedReader和FileReader读取文件,并将文件放入\resources中\ import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; imp

嗨 我有一个java类,它在windows中运行良好,但在MacOSXSnowLeopard中运行不好。我在两个操作系统上都使用Eclipse。在Mac OSX上,其抛出文件未找到异常

基本上,我尝试使用BufferedReader和FileReader读取文件,并将文件放入\resources中\

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class ReadFileContents {

    /**
     * @param args
     */
    public static void main(String[] args) {

        BufferedReader br = null;
        String line = "";
        try {
            br = new BufferedReader(new FileReader("resources\\abc"));
            while((line = br.readLine())!= null)
            {
                System.out.println("Read :::  "+line+"  From File.");
            }
        } catch (FileNotFoundException fne) {
            fne.printStackTrace();
        }catch (IOException ioe) {
            ioe.printStackTrace();
        }

    }

}
在Mac上,它正在提供

java.io.FileNotFoundException: resources\abc (No such file or directory)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:106)
    at java.io.FileInputStream.<init>(FileInputStream.java:66)
    at java.io.FileReader.<init>(FileReader.java:41)
    at ReadFileContents.main(ReadFileContents.java:18)
java.io.FileNotFoundException:resources\abc(没有这样的文件或目录)
在java.io.FileInputStream.open(本机方法)
位于java.io.FileInputStream。(FileInputStream.java:106)
位于java.io.FileInputStream。(FileInputStream.java:66)
位于java.io.FileReader。(FileReader.java:41)
位于ReadFileContents.main(ReadFileContents.java:18)

我是否需要在eclipse中进行任何特殊配置才能使其正常工作…

Mac使用前斜杠:
“resources/abc”
。(这实际上也适用于Windows。只有命令行解释器需要反斜杠。)