Package org.apache.hadoop.util
Class RunJar
java.lang.Object
org.apache.hadoop.util.RunJar
Run a Hadoop job jar.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringEnvironment key for the (user-provided) hadoop classpath.static final StringEnvironment key for the system classes.static final StringEnvironment key for disabling unjar in client code.static final StringEnvironment key for using the client classloader.static final PatternPattern that matches any string.static final intPriority of the RunJar shutdown hook. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidRun a Hadoop job jar.voidvoidUnpack a jar file into a directory.static voidUnpack matching files from a jar.static voidunJar(InputStream inputStream, File toDir, Pattern unpackRegex) Unpack matching files from a jar.static voidunJarAndSave(InputStream inputStream, File toDir, String name, Pattern unpackRegex) Deprecated.
-
Field Details
-
MATCH_ANY
Pattern that matches any string. -
SHUTDOWN_HOOK_PRIORITY
public static final int SHUTDOWN_HOOK_PRIORITYPriority of the RunJar shutdown hook.- See Also:
-
HADOOP_USE_CLIENT_CLASSLOADER
Environment key for using the client classloader.- See Also:
-
HADOOP_CLASSPATH
Environment key for the (user-provided) hadoop classpath.- See Also:
-
HADOOP_CLIENT_CLASSLOADER_SYSTEM_CLASSES
Environment key for the system classes.- See Also:
-
HADOOP_CLIENT_SKIP_UNJAR
Environment key for disabling unjar in client code.- See Also:
-
-
Constructor Details
-
RunJar
public RunJar()
-
-
Method Details
-
unJar
Unpack a jar file into a directory. This version unpacks all files inside the jar regardless of filename.- Parameters:
jarFile- the .jar file to unpacktoDir- the destination directory into which to unpack the jar- Throws:
IOException- if an I/O error has occurred or toDir cannot be created and does not already exist
-
unJar
public static void unJar(InputStream inputStream, File toDir, Pattern unpackRegex) throws IOException Unpack matching files from a jar. Entries inside the jar that do not match the given pattern will be skipped.- Parameters:
inputStream- the jar stream to unpacktoDir- the destination directory into which to unpack the jarunpackRegex- the pattern to match jar entries against- Throws:
IOException- if an I/O error has occurred or toDir cannot be created and does not already exist
-
unJarAndSave
@Deprecated public static void unJarAndSave(InputStream inputStream, File toDir, String name, Pattern unpackRegex) throws IOException Deprecated.Unpack matching files from a jar. Entries inside the jar that do not match the given pattern will be skipped. Keep also a copy of the entire jar in the same directory for backward compatibility. TODO remove this feature in a new release and do only unJar- Parameters:
inputStream- the jar stream to unpacktoDir- the destination directory into which to unpack the jarunpackRegex- the pattern to match jar entries againstname- name.- Throws:
IOException- if an I/O error has occurred or toDir cannot be created and does not already exist
-
unJar
Unpack matching files from a jar. Entries inside the jar that do not match the given pattern will be skipped.- Parameters:
jarFile- the .jar file to unpacktoDir- the destination directory into which to unpack the jarunpackRegex- the pattern to match jar entries against- Throws:
IOException- if an I/O error has occurred or toDir cannot be created and does not already exist
-
main
Run a Hadoop job jar. If the main class is not in the jar's manifest, then it must be provided on the command line.- Parameters:
args- args.- Throws:
Throwable- error.
-
run
- Throws:
Throwable
-