This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Java in General and the fly likes any way to find out the physical location of the class file at runtime? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "any way to find out the physical location of the class file at runtime?" Watch "any way to find out the physical location of the class file at runtime?" New topic
Author

any way to find out the physical location of the class file at runtime?

chris
Greenhorn

Joined: Mar 18, 2003
Posts: 14
hi,

I wanna know there is a way to find out the physical location of the class file at runtime??

I tried "(new File(".")).getCanonicalPath()", but it returns only the "root" directory of where "javaw" is executed:
"/user/domains/mydomain" what I need is something like:
"/user/my_project/webapp/WEB-INF/classes/test/framework/testClass"!!

appreciate any help!
Jean-Francois Briere
Ranch Hand

Joined: Mar 03, 2004
Posts: 101
I wonder why you want that kind of information.
The Java class may be a file located in a zip, jar, war, ear, folder or else or could even not be a file at all.
Anyway you could try something like this:

Regards
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: any way to find out the physical location of the class file at runtime?
 
Similar Threads
Taglib Question (enthruware)
Storing InputStream object to Application scope in servlet and retrieving
Struts2 checkbox problem
How to find the executing directory of my class?
Reading from a file from inside a jar