public void executeRemoteCommand(
     String initialWorkingDirectory,
     String command,
     String[] environment,
     IProgressMonitor monitor)
     throws CoreException {
   IServer s = ServerCore.findServer(serverId);
   IShellService service = findShellService(s);
   try {
     if (singleUseShell == null || !singleUseShell.isActive()) {
       singleUseShell = service.launchShell(initialWorkingDirectory, environment, monitor);
     } else if (initialWorkingDirectory != null) {
       // allow for a null working directory to ensure no command is run here
       singleUseShell.writeToShell("cd " + initialWorkingDirectory);
     }
     singleUseShell.writeToShell(command);
   } catch (RuntimeException re) {
     String className = service.getClass().getName();
     if (className.endsWith(".DStoreShellService")) {
       throw new CoreException(
           new Status(
               IStatus.ERROR,
               org.jboss.ide.eclipse.as.rse.core.RSECorePlugin.PLUGIN_ID,
               "no remote daemon installed. Please install a remote daemon or use an RSE server configured for ssh rather than dstore"));
     }
   } catch (SystemMessageException sme) {
     Status s2 =
         new Status(
             IStatus.ERROR,
             org.jboss.ide.eclipse.as.rse.core.RSECorePlugin.PLUGIN_ID,
             sme.getMessage(),
             sme);
     throw new CoreException(s2);
   }
 }