public class JWhich
extends Object
implements RemoteAccess
JWhich is a utility that takes a Java class name
and displays the absolute pathname of the class file that would
be loaded first by the class loader, as prescribed by the
class path.
JWhich also validates the class path and reports
any non-existent or invalid class path entries.
Usage is similar to the UNIX which command.
Example uses:
To find the absolute pathname ofMyClass.classnot in a package:java JWhich MyClassTo find the absolute pathname ofMyClass.classin themy.packagepackage:java JWhich my.package.MyClass
| Constructor and Description |
|---|
JWhich() |
| Modifier and Type | Method and Description |
|---|---|
static URL |
findClass(String className)
Returns the URL of the resource denoted by the specified
class name, as prescribed by the class path.
|
static void |
main(String[] args) |
static String |
msWhich(String className) |
static void |
printClasspath() |
static void |
setClasspath(String classpath) |
static void |
validate()
Validates the class path and reports any non-existent
or invalid class path entries.
|
static String |
which(String className)
Prints the absolute pathname of the class file
containing the specified class name, as prescribed
by the class path.
|
public static String which(String className)
className - Name of the class.public static String msWhich(String className)
throws Exception
Exceptionpublic static URL findClass(String className)
className - Name of the class.public static void validate()
Valid class path entries include directories, .zip
files, and .jar files.
public static void printClasspath()
public static void setClasspath(String classpath)
public static void main(String[] args)