public String [ ] command ( ) throws IOException { List < String > cmd = new ArrayList < String > ( ) ; String executable = javaHome . getCanonicalPath ( ) + FileUtil . SEPARATOR + "bin" + FileUtil . SEPARATOR + "java" ; if ( OS . get ( ) . isWindows ( ) ) executable += ".exe" ; cmd . add ( executable ) ; String path = toString ( workingDir , prependBootClasspath ) ; if ( path . length ( ) > 0 ) cmd . add ( "-Xbootclasspath/p:" + path ) ; path = toString ( workingDir , bootClasspath ) ; if ( path . length ( ) > 0 ) cmd . add ( "-Xbootclasspath:" + path ) ; path = toString ( workingDir , appendBootClasspath ) ; if ( path . length ( ) > 0 ) cmd . add ( "-Xbootclasspath/a:" + path ) ; path = toString ( workingDir , classpath ) ; if ( path . length ( ) > 0 ) { cmd . add ( "-classpath" ) ; cmd . add ( path ) ; } path = toString ( workingDir , extDirs ) ; if ( path . length ( ) > 0 ) cmd . add ( "-Djava.ext.dirs=" + path ) ; path = toString ( workingDir , endorsedDirs ) ; if ( path . length ( ) > 0 ) cmd . add ( "-Djava.endorsed.dirs=" + path ) ; path = toString ( workingDir , libraryPath ) ; if ( path . length ( ) > 0 ) cmd . add ( "-Djava.library.path=" + path ) ; for ( Map . Entry < String , String > prop : systemProperties . entrySet ( ) ) { if ( prop . getValue ( ) == null ) cmd . add ( "-D" + prop . getKey ( ) ) ; else cmd . add ( "-D" + prop . getKey ( ) + "=" + prop . getValue ( ) ) ; } if ( initialHeap != null ) cmd . add ( "-Xms" + initialHeap ) ; if ( maxHeap != null ) cmd . add ( "-Xmx" + maxHeap ) ; if ( vmType != null ) cmd . add ( vmType ) ; if ( debugPort != - 1 ) { cmd . add ( "-Xdebug" ) ; cmd . add ( "-Xnoagent" ) ; cmd . add ( "-Xrunjdwp:transport=dt_socket,server=y,suspend=" + ( debugSuspend ? ' ' : ' ' ) + ",address=" + debugPort ) ; } cmd . addAll ( jvmArgs ) ; if ( mainClass != null ) { cmd . add ( mainClass ) ; cmd . addAll ( args ) ; } return cmd . toArray ( new String [ cmd . size ( ) ] ) ; }
Returns command with all its arguments