}
public Commandline createCommandLine( List<String> classPath, boolean useJar, boolean shadefire )
throws SurefireBooterForkException
{
Commandline cli = new Commandline();
cli.setExecutable( jvmExecutable );
if ( argLine != null )
{
cli.createArg().setLine( stripNewLines( argLine ) );
}
if ( environmentVariables != null )
{
for ( String key : environmentVariables.keySet() )
{
String value = environmentVariables.get( key );
cli.addEnvironment( key, value );
}
}
if ( getDebugLine() != null && !"".equals( getDebugLine() ) )
{
cli.createArg().setLine( getDebugLine() );
}
if ( useJar )
{
File jarFile;
try
{
jarFile = createJar( classPath );
}
catch ( IOException e )
{
throw new SurefireBooterForkException( "Error creating archive file", e );
}
cli.createArg().setValue( "-jar" );
cli.createArg().setValue( jarFile.getAbsolutePath() );
}
else
{
cli.addEnvironment( "CLASSPATH", StringUtils.join( classPath.iterator(), File.pathSeparator ) );
final String forkedBooter = ForkedBooter.class.getName();
cli.createArg().setValue( shadefire ? new Relocator().relocate( forkedBooter ) : forkedBooter );
}
cli.setWorkingDirectory( workingDirectory.getAbsolutePath() );
return cli;
}