Java Custom Runner Stdin/ Scanner input

runner
customization
java

#1

I have updated the base custom java runner but I am not able to supply stdin while using the scanner util. Looking for direction. Any help is appreciated?

`{
  "cmd": [
    "bash",
    "-c",
    "echo $file | sed -r 's_.*/src/__g' | sed -r 's_\\.java__g'  | sed -r 's_/_._g' | xargs java -cp $(echo $file | sed -r \"s_/src/.*_/_g\")bin "
  ],
  "info": "\\033[01;34mRunning\\033[00m \\033[01;31m$file_name\\033[00m\n",
  "selector": "source.java",
  "working_dir": "$file_path"
}`

Custom runner c++
#2

Answered own question. Add ā€œ-iā€ to bash init.

{ "cmd": [ "bash", "-c", "-i", "echo $file | sed -r 's_.*/src/__g' | sed -r 's_\\.java__g' | sed -r 's_/_._g' | xargs java -cp $(echo $file | sed -r \"s_/src/.*_/_g\")bin " ], "info": "\\033[01;34mRunning\\033[00m \\033[01;31m$file_name\\033[00m\n", "selector": "source.java", "working_dir": "$file_path" }


Custom runner file cannot be found
#3

Docs on Runners just in case someone searches this post:

:wink:


#4

Sorry for the spam. Looks like I was getting a false positive ???
Here is a version I have found to work across scenarios.
(xargs was the issue)

// Create a custom Cloud9 runner - similar to the Sublime build system
// For more information see https://docs.c9.io/custom_runners.html
{
  "cmd": [
    "bash",
    "-c",
    "java -cp $(echo $file | sed -r \"s_/src/.*_/bin_g\") $(echo $file | sed -r \"s_.*/src/__g\" | sed -r \"s_\\.java__g\"  | sed -r \"s_/_._g\")"
  ],
  "info": "\\033[01;34mRunning\\033[00m \\033[01;31m$file_name\\033[00m\n",
  "selector": "source.java",
  "working_dir": "$file_path"
}