This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets 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: 17249

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 - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
I agree. Here's the link:
subject: Giving file path in jar
Similar Threads
Jasper Report and JAR file
How to setup a swing application
NoClassDefFoundError in jar file
Property File inside the jar
applet solution