Sandy
Sandy

Reputation: 15

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.

Upvotes: 0

Views: 3901

Answers (1)

Rahul
Rahul

Reputation: 3509

use

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

Upvotes: 1

Related Questions