public static List<String> buildCommand(final String className,final String additionalClasspath,final Properties systemProperties,final List<String> jvmOptions){
  final List<String> javaCommandLine=new ArrayList<String>();
  final File javaBinDir=new File(System.getProperty("java.home"),"bin");
  final File javaCommand=new File(javaBinDir,"java");
  javaCommandLine.add(javaCommand.getPath());
  final String dashServerArg=getDashServerArg(javaBinDir);
  if (dashServerArg != null) {
    javaCommandLine.add(dashServerArg);
  }
  if (jvmOptions != null) {
    for (    final String jvmOption : jvmOptions) {
      javaCommandLine.add(jvmOption);
    }
  }
  javaCommandLine.add("-classpath");
  javaCommandLine.add(buildClasspath(additionalClasspath));
  if (systemProperties != null) {
    for (    final Object key : systemProperties.keySet()) {
      javaCommandLine.add("-D" + key + "="+ systemProperties.getProperty(key.toString()));
    }
  }
  javaCommandLine.add(className);
  return javaCommandLine;
}

public static List < String > buildCommand ( final String className , final String additionalClasspath , final Properties systemProperties , final List < String > jvmOptions ) { final List < String > javaCommandLine = new ArrayList < String > ( ) ; final File javaBinDir = new File ( System . getProperty ( "java.home" ) , "bin" ) ; final File javaCommand = new File ( javaBinDir , "java" ) ; javaCommandLine . add ( javaCommand . getPath ( ) ) ; final String dashServerArg = getDashServerArg ( javaBinDir ) ; if ( dashServerArg != null ) { javaCommandLine . add ( dashServerArg ) ; } if ( jvmOptions != null ) { for ( final String jvmOption : jvmOptions ) { javaCommandLine . add ( jvmOption ) ; } } javaCommandLine . add ( "-classpath" ) ; javaCommandLine . add ( buildClasspath ( additionalClasspath ) ) ; if ( systemProperties != null ) { for ( final Object key : systemProperties . keySet ( ) ) { javaCommandLine . add ( "-D" + key + "=" + systemProperties . getProperty ( key . toString ( ) ) ) ; } } javaCommandLine . add ( className ) ; return javaCommandLine ; }
builds a command line containing all basic arguments required by java
