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 file access to deployed code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "file access to deployed code" Watch "file access to deployed code" New topic

file access to deployed code

Bill Shirley
Ranch Hand

Joined: Nov 08, 2007
Posts: 457
Can anyone hint me the best way to accessing a deployed jar as a resource?

I want to know the path of the jar my class was loaded in, so that I can parse the jar for annotated classes that may or may not yet be loaded.

JBoss 4.2.2

the system property java.class.path isn't getting me anywhere close:

the path i want to find (programatically, from the class) is similar to:

Bill Shirley - bshirley -
if (Posts < 30) JavaRanchFAQ);
Peter Johnson

Joined: May 14, 2008
Posts: 5852

Try this:




That will help locate a resource (xxxx) in the same directory as the class making this call.

JBoss In Action
Bill Shirley
Ranch Hand

Joined: Nov 08, 2007
Posts: 457
that's only useful for resources I know exist,

i would like to know what files are in the Jar,
I agree. Here's the link:
subject: file access to deployed code
jQuery in Action, 3rd edition