简体   繁体   中英

How to set File Path in Netbeans ide

I have created a desktop application in which I am using Jasper report design file (jrxml ). I put the jrxml file in the same folder where I have my java code. As the file path I used

FileInputStream fl = new FileInputStream("D:\\Sandeep MIS project21.02.2014\\Workspace for Hording\\HordingDept\\src\\HordingDept\\report2.jrxml");

But instead of this I want a simple

File file=new File("report2.jrxml");

My src folder is HordingDept . But using the simple path Netbeans shows an eror " file not found ". What should I do? Please help.

采用

File file=new File(System.getProperty("user.dir")+"\\src\\HordingDept\\report2.jrxml");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM