Class JarTool


  • public class JarTool
    extends java.lang.Object
    A utility that provides convenience methods for working with Java jar files similar to the way they would be used on the command line.
    • Constructor Summary

      Constructors 
      Constructor Description
      JarTool()
      Create an instance with default state.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ProcessIO execute​(java.lang.String... commands)
      Execute a jar file in the JVM.
      ProcessIO run​(java.lang.String... commands)
      Run the jar tool.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JarTool

        public JarTool()
        Create an instance with default state.
    • Method Detail

      • run

        public ProcessIO run​(java.lang.String... commands)
        Run the jar tool. Not to be confused with "executing a jar file". There's a different, more appropriately-named method for that.
        Parameters:
        commands - The commands the jar tool will run. DO NOT prepend the commands with the jar command. That would be telling the jar command to run itself.
        Returns:
        A composite result of the run.
      • execute

        public ProcessIO execute​(java.lang.String... commands)
        Execute a jar file in the JVM. Not to be confused with "running the jar tool". There's a different, more appropriately-named method for that.
        Parameters:
        commands - The commands that will be passed to the Main-Class of the jar that will be executed. DO NOT prepend the commands with the neither the java command nor the -jar command. That would be telling java to run itself.
        Returns:
        A composite result of the execution.