我在程序中,只能写绝对路径
SAXBuilder sb = new SAXBuilder();
Document doc = sb.build(new FileInputStream("E:\\workspace\\Demo\\src\\jdom\\disks.xml"));
如果使用相对路径
Document doc = sb.build(new FileInputStream(".\\disks.xml"));
就会报错:Exception in thread "main" java.io.FileNotFoundException: .\disks.xml (系统找不到指定的文件。)请教高手们,只能用绝对路径吗?如果可以用相对路径,该怎么办呢?