public abstract class MainClassFinder extends Object
public static main
method by performing a breadth first
search.Constructor and Description |
---|
MainClassFinder() |
Modifier and Type | Method and Description |
---|---|
static String |
findMainClass(File rootDirectory)
Find the main class from a given directory.
|
static String |
findMainClass(JarFile jarFile,
String classesLocation)
Find the main class in a given jar file.
|
static String |
findSingleMainClass(File rootDirectory)
Find a single main class from the given
rootDirectory . |
static String |
findSingleMainClass(File rootDirectory,
String annotationName)
Find a single main class from the given
rootDirectory . |
static String |
findSingleMainClass(JarFile jarFile,
String classesLocation)
Find a single main class in a given jar file.
|
static String |
findSingleMainClass(JarFile jarFile,
String classesLocation,
String annotationName)
Find a single main class in a given jar file.
|
public static String findMainClass(File rootDirectory) throws IOException
rootDirectory
- the root directory to searchnull
IOException
- if the directory cannot be readpublic static String findSingleMainClass(File rootDirectory) throws IOException
rootDirectory
.rootDirectory
- the root directory to searchnull
IOException
- if the directory cannot be readpublic static String findSingleMainClass(File rootDirectory, String annotationName) throws 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
classnull
IOException
- if the directory cannot be readpublic static String findMainClass(JarFile jarFile, String classesLocation) throws IOException
jarFile
- the jar file to searchclassesLocation
- the location within the jar containing classesnull
IOException
- if the jar file cannot be readpublic static String findSingleMainClass(JarFile jarFile, String classesLocation) throws IOException
jarFile
- the jar file to searchclassesLocation
- the location within the jar containing classesnull
IOException
- if the jar file cannot be readpublic static String findSingleMainClass(JarFile jarFile, String classesLocation, String annotationName) throws 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
classnull
IOException
- if the jar file cannot be read