Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## ccl.util
Class ClassPathUtil

    java.lang.Object
      |
      +--ccl.util.ClassPathUtil

public class ClassPathUtil
extends java.lang.Object

An utility class to find files or directories related to the Java class path or inside jar archives.

Constructor Summary
`ClassPathUtil()`

Method Summary
`static java.lang.String` | `getAbsoluteClassFileName(java.lang.String sFullClassName_, java.lang.String sClasspath_)` Finds the location in the file system of a java class file.
`static java.lang.String` | `getApplicationHome(java.lang.Object oClass)` This method searches in the current classpath for the given object.
`static java.lang.String` | `getClassOrJarFileName(java.lang.String sFullClassName_)` Either the absolut file name and path is given back or the java archive file name which contains this class is given back.
`static java.lang.String` | `getClassOrJarFileName(java.lang.String sFullClassName_, java.lang.String sClasspath_)` Either the absolut file name and path is given back or the java archive file name which contains this class is given back.
`static java.lang.String` | `getJarFileName(java.lang.String sFullClassName_)` Provide a classname (e.g.
`static java.lang.String` | `getJarFileName(java.lang.String sFullClassName_, java.lang.String sClasspath_)` Provide a classname (e.g.
`static java.lang.String` | `jwhich(java.lang.String sClassName_, java.lang.String sClasspath_)` Like which for unix, finds the location of a given java class, e.g.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ClassPathUtil

    public ClassPathUtil()

Method Detail

### getAbsoluteClassFileName

    public static java.lang.String getAbsoluteClassFileName(java.lang.String sFullClassName_,
                                                            java.lang.String sClasspath_)

  Finds the location in the file system of a java class file.

  Returns:
    null could not be found in the given classpath or if class is hidden in a jar file. In this case use 'getJarFileName()'.

### getJarFileName

    public static java.lang.String getJarFileName(java.lang.String sFullClassName_)
                                           throws java.io.IOException,
                                                  java.util.zip.ZipException

  Provide a classname (e.g. ccl.jcf.JCFUtil) and a classpath, and you will get the jar file location which contains this class (e.g. lib/ccl.jar).

  Throws:
    `java.io.IOException` - if a file operation failed.
    `java.util.zip.ZipException` - if any zip operation failed.

### getJarFileName

    public static java.lang.String getJarFileName(java.lang.String sFullClassName_,
                                                  java.lang.String sClasspath_)
                                           throws java.io.IOException,
                                                  java.util.zip.ZipException

  Provide a classname (e.g. ccl.jcf.JCFUtil) and a classpath, and you will get the jar file location which contains this class (e.g. lib/ccl.jar).

  Throws:
    `java.io.IOException` - if a file operation failed.
    `java.util.zip.ZipException` - if any zip operation failed.

### getClassOrJarFileName

    public static java.lang.String getClassOrJarFileName(java.lang.String sFullClassName_)
                                                  throws java.io.IOException,
                                                         java.lang.ClassNotFoundException,
                                                         java.util.zip.ZipException

  Either the absolut file name and path is given back or the java archive file name which contains this class is given back.

  Throws:
    `java.lang.ClassNotFoundException` - if the given class could not be found.
    `java.io.IOException` - if a file operation failed.
    `java.util.zip.ZipException` - if any zip operation failed.

### getClassOrJarFileName

    public static java.lang.String getClassOrJarFileName(java.lang.String sFullClassName_,
                                                         java.lang.String sClasspath_)
                                                  throws java.io.IOException,
                                                         java.lang.ClassNotFoundException,
                                                         java.util.zip.ZipException

  Either the absolut file name and path is given back or the java archive file name which contains this class is given back.

  Throws:
    `java.lang.ClassNotFoundException` - if the given class could not be found.
    `java.io.IOException` - if a file operation failed.
    `java.util.zip.ZipException` - if any zip operation failed.

### jwhich

    public static java.lang.String jwhich(java.lang.String sClassName_,
                                          java.lang.String sClasspath_)

  Like which for unix, finds the location of a given java class,
  e.g. jwhich ccl.util.Test
  -> /home/clemens/bunin/ccl/lib/ccl.jar
  or
  -> /home/clemens/bunin/ccl/classes/ccl/util/Test.class .

  Returns:
    null if nothing was found.

### getApplicationHome

    public static java.lang.String getApplicationHome(java.lang.Object oClass)

  This method searches in the current classpath for the given object. That class should be either in a jar file which is located inside a lib directory or as a pure class file under a classes directory. The directory containing either the classes or the lib directory will be returned as the applicaton home directory. If this is not found, null is returned.

  Parameters:
    `oClass` - An instantiated class which belongs to the application.
  Returns:
    null if no home directory was found.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD