C9 IDE working with java buildpath

165 views Asked by At

Me and my friends are trying to collab on a java projects, so we found C9 IDE, and we found a small tutorial on how to set up java on it, but we are having many problems with it, Can someone help us figure out how to set the correct build path?

Picture of our setup

Here is the 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\\.bin", "CLASSPATH" : "$OUT_DIR:$CLASSPATH", "SRC_DIR": "src"},
  "selector": "source.java",
  "working_dir": "$project_path"
}

And here is the 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"
}

we are trying to get the src file to read so we can get the Main.class to be the class that it runs, any help with be must appreciated!

1

There are 1 answers

4
Ritesh  Karwa On

Try this :

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"
    }