hudson.remoting
Class Which

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

public class Which
extends java.lang.Object

Locates where a given class is loaded from.

Author:
Kohsuke Kawaguchi

Constructor Summary
Which()
           
 
Method Summary
static java.io.File jarFile(java.lang.Class clazz)
          Locates the jar file that contains the given class.
static java.io.File jarFile(java.net.URL resource)
           
static java.net.URL jarURL(java.lang.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 java.net.URL jarURL(java.lang.Class clazz)
                           throws java.io.IOException
Locates the jar file that contains the given class.

Throws:
java.lang.IllegalArgumentException - if failed to determine.
java.io.IOException

jarFile

public static java.io.File jarFile(java.lang.Class clazz)
                            throws java.io.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:
java.lang.IllegalArgumentException - if failed to determine.
java.io.IOException

jarFile

public static java.io.File jarFile(java.net.URL resource)
                            throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2012. All Rights Reserved.