public abstract class MainClassFinder
extends java.lang.Object
public static main method by performing a breadth first
search.| Constructor and Description |
|---|
MainClassFinder() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
findMainClass(java.io.File rootDirectory)
Find the main class from a given directory.
|
static java.lang.String |
findMainClass(java.util.jar.JarFile jarFile,
java.lang.String classesLocation)
Find the main class in a given jar file.
|
static java.lang.String |
findSingleMainClass(java.io.File rootDirectory)
Find a single main class from the given
rootDirectory. |
static java.lang.String |
findSingleMainClass(java.io.File rootDirectory,
java.lang.String annotationName)
Find a single main class from the given
rootDirectory. |
static java.lang.String |
findSingleMainClass(java.util.jar.JarFile jarFile,
java.lang.String classesLocation)
Find a single main class in a given jar file.
|
static java.lang.String |
findSingleMainClass(java.util.jar.JarFile jarFile,
java.lang.String classesLocation,
java.lang.String annotationName)
Find a single main class in a given jar file.
|
public static java.lang.String findMainClass(java.io.File rootDirectory)
throws java.io.IOException
rootDirectory - the root directory to searchnulljava.io.IOException - if the directory cannot be readpublic static java.lang.String findSingleMainClass(java.io.File rootDirectory)
throws java.io.IOException
rootDirectory.rootDirectory - the root directory to searchnulljava.io.IOException - if the directory cannot be readpublic static java.lang.String findSingleMainClass(java.io.File rootDirectory,
java.lang.String annotationName)
throws java.io.IOException
rootDirectory. A main class
annotated with an annotation with the given annotationName will be
preferred over a main class with no such annotation.rootDirectory - the root directory to searchannotationName - the name of the annotation that may be present on the main
classnulljava.io.IOException - if the directory cannot be readpublic static java.lang.String findMainClass(java.util.jar.JarFile jarFile,
java.lang.String classesLocation)
throws java.io.IOException
jarFile - the jar file to searchclassesLocation - the location within the jar containing classesnulljava.io.IOException - if the jar file cannot be readpublic static java.lang.String findSingleMainClass(java.util.jar.JarFile jarFile,
java.lang.String classesLocation)
throws java.io.IOException
jarFile - the jar file to searchclassesLocation - the location within the jar containing classesnulljava.io.IOException - if the jar file cannot be readpublic static java.lang.String findSingleMainClass(java.util.jar.JarFile jarFile,
java.lang.String classesLocation,
java.lang.String annotationName)
throws java.io.IOException
annotationName will be preferred over a main
class with no such annotation.jarFile - the jar file to searchclassesLocation - the location within the jar containing classesannotationName - the name of the annotation that may be present on the main
classnulljava.io.IOException - if the jar file cannot be read