C9 IDE使用java buildpath

时间:2015-06-12 04:02:32

标签: java collaboration

我和我的朋友正在尝试合作开发java项目,所以我们找到了C9 IDE,我们找到了一个关于如何在其上设置java的小教程,但我们遇到了很多问题,有人可以帮助我们弄清楚如何设置正确的构建路径?

Picture of our setup

这是My Builder.build文件:

{
  "cmd": [
    "sh",
    "-c",
    "mkdir -p $OUT_DIR; find $SRC_DIR -name \"*.java\" -print | xargs javac -sourcepath $SRC_DIR -d \"$OUT_DIR\"; echo '\\033[01;34mDone!\\033[00m'"
  ],
  "info": "\\033[01;34mBuilding\\033[00m \\033[01;31m$project_name\\033[00m",
  "env": {"OUT_DIR": "$project_path\\.bin", "CLASSPATH" : "$OUT_DIR:$CLASSPATH", "SRC_DIR": "src"},
  "selector": "source.java",
  "working_dir": "$project_path"
}

这是My Runner.run

{
  "cmd": [
    "sh",
    "-c",
    "echo $file | sed -r 's/.*\\/src\\///g' | sed -r 's/\\.java//g'  | sed -r 's/\\//\\./g' | xargs java"
  ],
  "info": "\\033[01;34mRunning\\033[00m \\033[01;31m$file_name\\033[00m\n",
  "env": {"OUT_DIR": "$project_path\\.bin", "CLASSPATH" : "$OUT_DIR:$CLASSPATH"},
  "selector": "source.java",
  "working_dir": "$project_path"
}

我们正在尝试将src文件读取,以便我们可以将Main.class作为它运行的类,任何帮助都必须得到赞赏!

1 个答案:

答案 0 :(得分:0)

试试这个:

My Builder.build file:
     {
          "cmd": [
            "sh",
            "-c",
            "mkdir -p $OUT_DIR; find $SRC_DIR -name \"*.java\" -print | xargs javac -sourcepath $SRC_DIR -d \"$OUT_DIR\"; echo '\\033[01;34mDone!\\033[00m'"
          ],
          "info": "\\033[01;34mBuilding\\033[00m \\033[01;31m$project_name\\033[00m",
          "env": {"OUT_DIR": "$project_path\\java", "CLASSPATH" : "$OUT_DIR:$CLASSPATH", "SRC_DIR": "java"},
          "selector": "source.java",
          "working_dir": "$project_path"
        }

My Runner.run
    {
      "cmd": [
        "sh",
        "-c",
        "echo $file | sed -r 's/.*\\/src\\/java\\///g' | sed -r 's/\\.java//g'  | sed -r 's/\\//\\./g' | xargs java"
      ],
      "info": "\\033[01;34mRunning\\033[00m \\033[01;31m$file_name\\033[00m\n",
      "env": {"OUT_DIR": "$project_path\\java", "CLASSPATH" : "$OUT_DIR:$CLASSPATH"},
      "selector": "source.java",
      "working_dir": "$project_path"
    }