From CMD.exe, I can run xjc as follows:

xjc "c:/schema.xsd" -p abc -d "temp"

From git Bash, I can run xjc as follows:

xjc "/c/schema.xsd" -p abc -d "temp"

As far as Cygwin goes, I can get it work only if I call xjc.exe using the CMD.exe syntax.

This is problematic because the script that ran into this problem relies on ${PWD} to get the path to the current directory, which resolves to "/c", not "c:/".

Even with a hack to replace "/c" with "c:/", I'd still like to know why xjc accepts a unix path when called by git Bash but not by Cygwin.

1 Answer 1


The problem is two-fold:

  1. you are using a windows executable that expects windows paths and
  2. bash expands paths to its own native cygwin paths.

In cygwin, a correct path for c:\schema.xsd would translate into /cygdrive/c/schema.xsd (not /c/schema.xsd, unless you created a symlink.) Why git-bash (is that the one shipped by msysgit?) allows you to use /c/schema.xsd as valid path, is beyond me.

When you call xcj with one file as parameter (that bash/cygwin recognizes), it will receive the filehandle and not its path. If it's just a string however, that string will be passed as parameter to the application without further parsing and string expansion.

You can either approach this issue by trying to use cygpath (see using-cygwin-effectively and cygpath-info) to pass on the correct windows path or, if it's only one file, try to pass on the correct (unix/cygwin) file path.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .