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.
|
@Nonnull public static URL classFileUrl(Class clazz) throws IOException
clazz - ClassIllegalArgumentException - if failed to determine the URL.IOException@Deprecated public static URL jarURL(Class clazz) throws IOException
classFileUrl(Class)IOException@Nonnull 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.
clazz - ClassIllegalArgumentException - if failed to determine the class File URL.IOExceptionpublic static File jarFile(URL resource) throws IOException
IOExceptionCopyright © 2004–2018. All rights reserved.