Command command using wildcards in arg in Visual Studio Code

I am using Visual Studio Code 0.9.2 for OS X Yosemite to edit a .java file.

I am trying to compile this file using the following tasks.json file:

{ "version": "0.1.0", "command": "javac", "isShellCommand": true, "echoCommand": true, "showOutput": "always", "args": ["-d","${workspaceRoot}\/target","${workspaceRoot}\/src\/*.java"] } 

Performing this task redirects the following command to the output window:

 running command$ javac -d /Users/caoimheboers/Desktop/JLab11/target /Users/caoimheboers/Desktop/JLab11/src/*.java 

... which is good, however the result of the task is then reported as:

 javac: file not found: /Users/caoimheboers/Desktop/JLab11/src/*.java Usage: javac <options> <source files> use -help for a list of possible options 

I tried the following:

  • Copy the javac echo command (including all arguments) from the Output window and paste it into the command line in the terminal window. Result. One .java file in the / src folder compiles and a .class file appears in the / target folder. This indicates that the syntax of the javac command (including all arguments) is correct in the tasks.json file.

  • In the tasks.json file, replace the wildcard with the name of a single .java file in the / src folder. Result: the VS Code task works fine and creates a .class file in the / target folder. This means that everything about the command in the tasks.jason file is OK, except for the wildcard character.

Any ideas on what I'm doing wrong?

+7
javac visual-studio-code macos
source share
1 answer

I also experienced this, it was a mistake. There is currently a new terminal that is fixing this error. Try changing the JSON schema tasks to the new version 2.0.0, reload the window, and everything will be fine:

 { "version": "2.0.0", "command": "javac", "isShellCommand": true, "echoCommand": true, "showOutput": "always", "args": ["-d","${workspaceRoot}/target","${workspaceRoot}/src/*.java"] } 

Related issue: https://github.com/Microsoft/vscode/issues/16865

You do not need to hide the slash character.

0
source share

All Articles