wood burning stoves 2.0
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

Win a copy of REST with Spring (video course) this week in the Spring forum!
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 - frazerbilt.com
if (Posts < 30) you.read( 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,
It is sorta covered in the JavaRanch Style Guide.
subject: file access to deployed code
It's not a secret anymore!