You might try the windows way and use the short name for the path. Probably 
something like PROGRA~1. From cmd, you can type dir /x to get a listing of the 
current directories short names. I don't know how cygwin handles them but I'd 
imagine it resolved directory names similar to how cmd does. 

- "Luda" Chris

On Aug 8, 2011, at 9:58 AM, Travis Paul <[email protected]> wrote:

> Anyone familiar with Cygwin?
> I am trying to run a java program in a shell script, but I'm having problem 
> getting cygwin to hold the path of the java.exe in a variable.
> 
> I'm ultimately trying to do something like: $java_exe -jar foo.jar
> 
> I've tried everything (I think) to escape the space in "Program Files" but it 
> doesn't  like any of them.
> 
> $ java_exe=/cygdrive/c/Program\ Files/Java/jre6/bin/java.exe
> $ $java_exe
> -bash: /cygdrive/c/Program: No such file or directory
> 
> 
> $ java_exe="/cygdrive/c/Program Files/Java/jre6/bin/java.exe"
> $ $java_exe
> -bash: /cygdrive/c/Program: No such file or directory
> 
> 
> $ java_exe=/cygdrive/c/"Program Files"/Java/jre6/bin/java.exe
> $ $java_exe
> -bash: /cygdrive/c/Program: No such file or directory
> 
> 
> $ java_exe=`cygpath "C:\Program\040Files\Java\jre6\bin\java.exe"`
> $ $java_exe
> -bash: /cygdrive/c/Program/040Files/Java/jre6/bin/java.exe: No such file or 
> directory
> 
> 
> $ java_exe=`cygpath -u "C:\Program Files\Java\jre6\bin\java.exe"`
> $ $java_exe
> -bash: /cygdrive/c/Program: No such file or directory
> 
> 
> it's definetly there...
> 
> $ /cygdrive/c/Program\ Files/Java/jre6/bin/java.exe -version
> java version "1.6.0_22"
> 
> I started to think I might have to escape the variable to use it with 
> something like ${java_exe// /\\ } but that didn't work.
> Since I can access it from a command (but not a variable) a symbolic link 
> might work, but I feel like this is not supposed to be this complicated, I 
> have to be doing something wrong.
> 
> _______________________________________________
> Fwlug mailing list
> [email protected]
> http://mail.fortwaynelug.org/mailman/listinfo/fwlug_fortwaynelug.org
> 
> This is a public list and all posts are archived publicly. Please keep this 
> in mind before posting.

_______________________________________________
Fwlug mailing list
[email protected]
http://mail.fortwaynelug.org/mailman/listinfo/fwlug_fortwaynelug.org

This is a public list and all posts are archived publicly. Please keep this in 
mind before posting.

Reply via email to