public IHostShell createStartupShell(
     String initialWorkingDirectory,
     String command,
     String[] environment,
     IProgressMonitor monitor)
     throws CoreException, SystemMessageException {
   resetStartupShell();
   IServer s = ServerCore.findServer(serverId);
   IShellService service = findShellService(s);
   try {
     IHostShell hs = service.runCommand(initialWorkingDirectory, command, environment, monitor);
     listener =
         new IHostShellOutputListener() {
           public void shellOutputChanged(IHostShellChangeEvent event) {
             IHostOutput[] lines = event.getLines();
             String[] lines2 = new String[lines.length];
             for (int i = 0; i < lines.length; i++) {
               lines2[i] = lines[i].getString();
             }
             writeToConsole(lines2);
           }
         };
     startupShell = hs;
     startupShell.addOutputListener(listener);
     return hs;
   } catch (SystemMessageException sme) {
     throw sme;
   } catch (RuntimeException re) {
     throw new CoreException(
         new Status(
             IStatus.ERROR,
             org.jboss.ide.eclipse.as.rse.core.RSECorePlugin.PLUGIN_ID,
             re.getMessage(),
             re));
   }
 }