code: public static boolean isCommandLine() {
          String output = AccessController.doPrivileged(new PrivilegedAction<String>() {
              @Override
              public String run() {
                  return System.getProperty("wlp.process.type");
              }
          });
          boolean value = true;
          if (output != null && ("server".equals(output) || "client".equals(output))) {
              value = false;
          }
          if (logger.isLoggable(Level.FINE)) {
              logger.fine("value: " + value);
          }
          return value;
      }
docs: Returns true when the value of wlp.process.type is neither server nor client.
  false otherwise.