How do i get file path of my file in java enterprise application?
Posted
by Nitesh Panchal
on Stack Overflow
See other posts from Stack Overflow
or by Nitesh Panchal
Published on 2010-03-13T05:25:28Z
Indexed on
2010/03/13
5:35 UTC
Read the original article
Hit count: 218
java
Hello, I created java enterprise application and it consists of ejb module and web application. I have plain old xml file in source packages folder in package "common" in my ejb module. I want to pass this file path in File() constructor for one class in ejb module. How do i do it?
If i pass any of the below it doesn't work :-
new File("abc.xml"); //this take file from glassfish/domains/domain1 :(
new File("./abc.xml");
I don't want to pass hardcode path like /home/administrator/appname/module/etc..
I want the path relative from my ejb module. Please help me. I've tried all things.
Actually when i created a class in same folder and then try classname.getResource("abc.xml").getPath() it works fine. But what if i don't have any class in that folder. Waiting for your replies
© Stack Overflow or respective owner