Cygpath utility issue

So, I got the Cygwin started without any issue. However, when I execute the command to compile java code, it complains NoClass Def Found exception. Cygwin can’t find ant.jar in the classpath. I looked at the classpath, it was defintely wrong. Previous “.” was translated into “c;” and all other directories are prefixed with Cygwin home directory.

I found that there are some issues with new version of Cygwin utility command “cygpath”. I used –path –windows to convert the CLASSPATH to Cygwin format, but it didn’t work. Only solution that I found was to use two steps approach. First, convert CLASSPATH to Unix path, then convert Unix path to Windows path.

Environment.function.sh

function Classpath.build()
{
local aPath=$1
local tempPath=””

osType=$(uname -s)
#
# Now make sure it is converted to work with Cygwin
#
case ${osType} in
CYGWIN* )
# This is required since Java is running in windows and not CYGWIN
tempPath=”$(cygpath –path –unix ${aPath})”
pathValue=”;$(cygpath –path –mixed ${tempPath})”
;;
* )
pathValue=”:${aPath}”
;;
esac

echo “${pathValue}”
}

This works beautifully and now all the jar files are loaded into the CLASSPATH.

* in front of path and unix are double dash

Advertisements

One thought on “Cygpath utility issue

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s