hudson.remoting
Class Which

java.lang.Object
  extended by hudson.remoting.Which

public class Which
extends Object

Locates where a given class is loaded from.

Author:
Kohsuke Kawaguchi

Constructor Summary
Which()
           
 
Method Summary
static File jarFile(Class clazz)
          Locates the jar file that contains the given class.
static File jarFile(URL resource)
           
static URL jarURL(Class clazz)
          Locates the jar file that contains the given class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Which

public Which()
Method Detail

jarURL

public static URL jarURL(Class clazz)
                  throws IOException
Locates the jar file that contains the given class.

Throws:
IllegalArgumentException - if failed to determine.
IOException

jarFile

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 purposes jarURL(Class) is preferrable.

Throws:
IllegalArgumentException - if failed to determine.
IOException

jarFile

public static File jarFile(URL resource)
                    throws IOException
Throws:
IOException


Copyright © 2004-2011. All Rights Reserved.