public class Which extends Object
Constructor and Description |
---|
Which() |
Modifier and Type | Method and Description |
---|---|
static URL |
classFileUrl(Class clazz)
Returns the URL of the class file where the given class has been loaded from.
|
static File |
jarFile(Class clazz)
Locates the jar file that contains the given class.
|
static File |
jarFile(URL resource) |
static URL |
jarURL(Class clazz)
Deprecated.
|
public static URL classFileUrl(Class clazz) throws IOException
IllegalArgumentException
- if failed to determine.IOException
public static URL jarURL(Class clazz) throws IOException
classFileUrl(Class)
IOException
public static File jarFile(Class clazz) throws IOException
Note that jar files are not always loaded from File
,
so for diagnostics purposes jarURL(Class)
is preferrable.
IllegalArgumentException
- if failed to determine.IOException
public static File jarFile(URL resource) throws IOException
IOException
Copyright © 2014. All rights reserved.