Package com.logicaldoc.util.exec
Class JavaLauncher
- java.lang.Object
-
- com.logicaldoc.util.exec.JavaLauncher
-
public class JavaLauncher extends Object
JavaLauncher Provides an easy way to launch java applications.
-
-
Constructor Summary
Constructors Constructor Description JavaLauncher()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Process
exec(String mainClass, String classpath, String[] jvmargs, String[] properties)
Launch a java program.static Process
execJar(String pathToJar, String[] jvmargs)
Execute a java jar file that contains a manifest.static String
findJVM()
Find a suitable JVM on the user's system.static void
main(String[] args)
Demo - Launch a java program.
-
-
-
Method Detail
-
exec
public static Process exec(String mainClass, String classpath, String[] jvmargs, String[] properties) throws Exception
Launch a java program.- Parameters:
mainClass
- - class with main methodclasspath
- - the java classpathjvmargs
- - arguments for the jvmproperties
- - any system properties- Returns:
- the launched process
- Throws:
Exception
- An error happened during execution
-
execJar
public static Process execJar(String pathToJar, String[] jvmargs) throws Exception
Execute a java jar file that contains a manifest.- Parameters:
pathToJar
- - absolute path to your jarjvmargs
- - arguments for the java virtual machine- Returns:
- Process The launched process
- Throws:
Exception
- An error happened during execution
-
findJVM
public static String findJVM()
Find a suitable JVM on the user's system.- Returns:
- - path to java binary
-
main
public static void main(String[] args)
Demo - Launch a java program.- Parameters:
args
- the invocation arguments
-
-