Package hudson.remoting
Class Which
- java.lang.Object
-
- hudson.remoting.Which
-
public class Which extends Object
Locates where a given class is loaded from.- Author:
- Kohsuke Kawaguchi
-
-
Constructor Summary
Constructors Constructor Description Which()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method 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.
-
-
-
Method Detail
-
classFileUrl
@NonNull public static URL classFileUrl(Class<?> clazz) throws IOException
Returns the URL of the class file where the given class has been loaded from.- Parameters:
clazz
- Class- Returns:
- URL of the class file
- Throws:
IllegalArgumentException
- if failed to determine the URL.IOException
- Since:
- 2.24
-
jarURL
@Deprecated public static URL jarURL(Class<?> clazz) throws IOException
Deprecated.- Throws:
IOException
-
jarFile
@NonNull public static File jarFile(Class<?> clazz) throws IOException
Locates the jar file that contains the given class.Note that jar files are not always loaded from
File
, so for diagnostics purposesjarURL(Class)
is preferrable.- Parameters:
clazz
- Class- Returns:
- JAR File, which contains the class.
- Throws:
IllegalArgumentException
- if failed to determine the class File URL.IOException
-
jarFile
public static File jarFile(URL resource) throws IOException
- Throws:
IOException
-
-