public Command get() {
    Command command = Command.build("java");
    command.addLiteral("-server");

    for (Map.Entry<String, String> define : defines.entrySet()) {
      command.addLiteral("-D" + define.getKey() + "=" + define.getValue());
    }

    StringBuilder cp = new StringBuilder();
    for (ClasspathEntry entry : classpath) {
      if (cp.length() != 0) {
        cp.append(":");
      }
      String s = entry.path.getAbsolutePath();
      if (entry.wildcard) {
        // TODO: Adding * is gross
        s += "/*";
      }
      cp.append(s);
    }

    // TODO: This is not nice either
    if (cp.length() == 0) {
      cp.append(".");
    } else {
      cp.append(":.");
    }

    command.addLiteral("-cp").addQuoted(cp.toString());

    if (jar != null) {
      command.addLiteral("-jar").addFile(jar);
    } else {
      command.addQuoted(mainClass);
    }

    for (Argument argument : arguments) {
      command.addArgument(argument);
    }

    return command;
  }
Ejemplo n.º 2
0
 public String toString() {
   StringBuilder sb = new StringBuilder("Nomin Mapper\nParsed mappings:\n");
   for (ParsedMapping pm : mappings) sb.append(pm).append("\n");
   return sb.toString();
 }