I was stuck here for last all night. In my project, I need to read the xml file and use the relative path.(like String location = "AuctionItem.xml"; File f = new File(location); below)
String location = "AuctionItem.xml";
File f = new File(location);
Document doc = builder.parse(f);
It worked well if I used a java text file.
public static void main(String[] arg){
File f = new File("AuctionItem.xml");
System.out.println(AuctionItemsControl.getValue().size());
// here the method below is call the function which has the relative path.
}
However, when I used them in my project by jsp, it gave a error : java.io.FileNotFoundException:/Users/XXX/Documents/Tool/web/eclipse/Eclipse.app/Contents/MacOS/AuctionItem.xml (No such file or directory)