File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JBoss/WildFly and the fly likes Giving file path in jar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Giving file path in jar" Watch "Giving file path in jar" New topic

Giving file path in jar

Sunil Huilgol

Joined: Jan 22, 2006
Posts: 8
Hello ranchers,
I have given a relative path of a file in my code(a remote session bean).when i deploy my jar file and run the client somehow the working direcyory changes to JBOSS_HOME/bin and whatever path i had given in my code is not considered. I have the file i want to use in the jar.So how to get access to a the file(is is an XSD file) and why does the working directory change?

Thanks in advance
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

I think you need to use getResourceAsStream(). You won't be able to do any File operations in JBoss because of security.


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
jQuery in Action, 3rd edition
subject: Giving file path in jar
It's not a secret anymore!