java - Absolute/Relative path to files in Eclipse -


i working on assignment need use xml file in project. file in folder created called res. res folder under project folder. myproject --> res --> myxmlfile.xml

the .java file calling xml file in src folder. myproject --> javaresources --> src --> edu.unsw.comp9321.assignment1(package) --> myjavafile.java

i wondering how should refer file in java code if want code work when run project on computer?

when use relative path appears searching folder eclipse installed, opposed workspace folder project exists.

this have @ moment:

file fxmlfile = new file("c:/users/giridhaar/workspace/comp9321assignment1/res/xml/musicdb.xml"); 

thank help.

this should work :

file fxmlfile = new file("res/xml/musicdb.xml"); 

Comments

Popular posts from this blog

c# - Unity IoC Lifetime per HttpRequest for UserStore -

Change the color of an oval at click in Java AWT -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -