#1712 The fanlaunch will not work on cygwin

saltnlight5 Tue 29 Nov 2011

When trying out in Cygwin, the following work:

$FAN_HOME/bin/fan.exe -version

But if I try this it failed with ClassNotFoundException:

$FAN_HOME/bin/fan -version

I think the problem is in the last line in $FAN_HOME/bin/fanlaunch script, which has this:

"$FAN_JAVA" $osFlags $JAVA_OPTIONS $libPath -cp "$FAN_CP":"$CLASSPATH" -Dfan.home="$FAN_HOME" "$FAN_MAIN" "$@"

Noticed the hardcoded : is used between FAN_CP and CLASSPATH. In cygwin, you need ; to work.

brian Tue 29 Nov 2011

Okay, thanks for reporting. I don't have enough Bash experience to know how people typically handle that in a standard way, but if someone wants to provide a patch that would very welcome.

saltnlight5 Tue 29 Nov 2011

For a quick fix, I just replaced that line with this and it works:

if $cygwin; then
  "$FAN_JAVA" $osFlags $JAVA_OPTIONS $libPath -cp "$FAN_CP;$CLASSPATH" -Dfan.home="$FAN_HOME" "$FAN_MAIN" "$@"
else
  "$FAN_JAVA" $osFlags $JAVA_OPTIONS $libPath -cp "$FAN_CP":"$CLASSPATH" -Dfan.home="$FAN_HOME" "$FAN_MAIN" "$@"
fi

Another cleaner solution might be a PATH_SEP variable and set to : or ; on the top when cygwin is detected, and then you could use original last line with the variable instead of duplicating the line.

brian Wed 30 Nov 2011

Thanks for fix, although I'd hate to duplicate the most important line. I looked thru a couple other scripts to see how they handled it and didn't see any elegant solutions that I understood - but I know there must be some patterns out there.

StephenViles Fri 17 Feb 2012

This will be fixed in the next build (changesets: 1, 2, 3). References:

Note that you must still convert any paths in command-line arguments using `cygpath -w <arg>`. Example from #1765:

$ rel/bin/fan `cygpath -w rel/adm/bootstrap.fan`

Edit: corrected link to topic 1765.

Login or Signup to reply.