Mail Archives: cygwin/2001/03/03/14:01:07
--=====================_10675828==_
Content-Type: text/plain; charset="us-ascii"; format=flowed
David,
Not only do you not need a distinct JDK for Cygwin, there is in fact no
such thing.
You'll need to manage POSIX / Windows discrepancies when using the JDK
tools. That means path names must be Windows format and the CLASSPATH
environment must be semicolon-separated. Unlike PATH, Cygwin will not
effect the transformation automatically for you, you must yourself apply
cygpath when it's necessary to convert form POSIX / Cygwin file names and
PATH-like variables.
I've attached a couple of scripts I use to make it possible to invoke the
JDK tools using POSIX names and paths. The "wrapper" script converts file
name and path arguments (using some heuristics you may have to change) from
POSIX to Windows format then invokes the actual JDK tool with the Windows
formatted arguments. MkWrappers creates links (symbolic or hard, according
ot an option) for each of the individual JDK tools. CygWrapper is the
script that transforms the arguments and then invokes the real JDK tool.
I find these very handy for Cygwin-based Java development. Good luck!
Randall Schulz
Teknowledge Corp.
Palo Alto, CA USA
At 10:29 3/3/2001, David A. Cobb wrote:
>HI, I do what little "real" work I do these days running in the Cygwin
>[1.1.8] environment from Xemacs--i686-pc-Cygwin--21.1.13 and the JRE
>from the Xemacs.org package repository. I seem to be having a problem
>because the JRE expects Windows-syntax in CLASSPATH
>"C:/JDK-1.3/bin/classes;etc;etc" rather than
>"\usr\local\i686-pc-Cygwin\jre-1.3\classes:etc:etc" or the like.
>
>Do I need to download and install TWO JDK's, one windows-type for use
>when I'm only in Windows and one X*nix type recompiled for Cygwin for
>use when I'm working? Or could JDE "fake it" by doing the Cygpath
>conversions behind the curtain? Or, maybe, I don't really know what I'm
>doing?
>
>--
>David A. Cobb
--=====================_10675828==_
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: attachment; filename="MkWrappers"
#!/bin/sh
# Create JDK 1.3 wrapper scripts
# Use symbolic links if the file system does not support hard links
# (Hard links will exhibit a small performance advantage
# and they require somewhat less disk space.)
#
# FAT file systems don't support hard links.
# NTFS does
# Cygwin simulates symlinks on FAT and NTFS
# Unix file systems do.
#
# The CVS repository includes all the link targets as distinct files.
# This does not impede use or performance, but is very redundant.
# Running this script, with the appropriate value for useSymlinks
# will overwrite the distinct files with links. After doing this
# care must be exercised if a CVS commit is done.
showUsage() {
echo "MkWrappers: Usage: MkWrappers [ -h | -s ]"
echo " Options:"
echo " -r Remove existing wrapper script links"
echo " -s Use symbolic links (default)"
echo " -h Use hard links (not recommended for Cygwin on an FAT file system)"
}
removeWrappers=0
useSymlinks=1
exitCode=0
for arg; do
case "$arg" in
-r)
removeWrappers=1
;;
-s)
useSymlinks=1
;;
-h)
useSymlinks=0
;;
*)
echo "MkWrappers: Unknown option: \"$arg\"" >&2
showUsage >&2
exit 1
;;
--help)
showUsage
exit 0
;;
esac
done
if [ $removeWrappers -ne 0 ]; then
rm -f appletviewer
rm -f extcheck
rm -f idlj
rm -f jar
rm -f jarsigner
rm -f java
rm -f javac
rm -f javadoc
rm -f javah
rm -f javap
rm -f javaw
rm -f jdb
rm -f keytool
rm -f native2ascii
rm -f oldjava
rm -f oldjavac
rm -f oldjavaw
rm -f oldjdb
rm -f policytool
rm -f rmic
rm -f rmid
rm -f rmiregistry
rm -f serialver
rm -f tnameserv
rm -f unregbean
else
if [ $useSymlinks -ne 0 ]; then
ln -s -f CygWrapper appletviewer
ln -s -f CygWrapper extcheck
ln -s -f CygWrapper idlj
ln -s -f CygWrapper jar
ln -s -f CygWrapper jarsigner
ln -s -f CygWrapper java
ln -s -f CygWrapper javac
ln -s -f CygWrapper javadoc
ln -s -f CygWrapper javah
ln -s -f CygWrapper javap
ln -s -f CygWrapper javaw
ln -s -f CygWrapper jdb
ln -s -f CygWrapper keytool
ln -s -f CygWrapper native2ascii
ln -s -f CygWrapper oldjava
ln -s -f CygWrapper oldjavac
ln -s -f CygWrapper oldjavaw
ln -s -f CygWrapper oldjdb
ln -s -f CygWrapper policytool
ln -s -f CygWrapper rmic
ln -s -f CygWrapper rmid
ln -s -f CygWrapper rmiregistry
ln -s -f CygWrapper serialver
ln -s -f CygWrapper tnameserv
ln -s -f CygWrapper unregbean
else
ln -f CygWrapper appletviewer
ln -f CygWrapper extcheck
ln -f CygWrapper idlj
ln -f CygWrapper jar
ln -f CygWrapper jarsigner
ln -f CygWrapper java
ln -f CygWrapper javac
ln -f CygWrapper javadoc
ln -f CygWrapper javah
ln -f CygWrapper javap
ln -f CygWrapper javaw
ln -f CygWrapper jdb
ln -f CygWrapper keytool
ln -f CygWrapper native2ascii
ln -f CygWrapper oldjava
ln -f CygWrapper oldjavac
ln -f CygWrapper oldjavaw
ln -f CygWrapper oldjdb
ln -f CygWrapper policytool
ln -f CygWrapper rmic
ln -f CygWrapper rmid
ln -f CygWrapper rmiregistry
ln -f CygWrapper serialver
ln -f CygWrapper tnameserv
ln -f CygWrapper unregbean
fi
fi
--=====================_10675828==_
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: attachment; filename="CygWrapper"
#!/bin/bash
# Process Cygwin / POSIX arugments to transform them into Windows native form
. cygblend.bfd
. pathops.bfd
# Get the base name of the target
targetName="${0##*/}"
# Remove the directory in which the wrapper scripts reside from $PATH
pathRemove PATH "$(toCygPATH "$(cygpath -p -w "$TKS_CYG")")"
pathRemove PATH "."
pathRemove PATH ""
# Transform Cygnus file name and PATH-style
# arguments into their native form
nativeArgs=()
for arg; do
# JavaDoc -group arguments include a colon-separated list of package names
if echo "$arg" |egrep -q '([a-z]+.\*)+(:[a-z]+.\*)*'; then
nativeArgs[${#nativeArgs[@]}]="$arg"
else
# Options and Windows-format file names and PATH-style arguments
case "$arg" in
-* \
| [a-zA-Z]:* \
| *\;* \
| \;* \
| *\; \
| *[\<\>]*)
nativeArgs[${#nativeArgs[@]}]="$arg"
;;
# Cygnus and POSIX format file and directory names
*/* \
| /* \
| */)
nativeArgs[${#nativeArgs[@]}]="$(toLocName "$arg")"
;;
# Cygnus format PATH-style arguments
*:* \
| :* \
| *:)
nativeArgs[${#nativeArgs[@]}]="$(toLocPATH "$arg")"
;;
# Others -- unchanged
*)
nativeArgs[${#nativeArgs[@]}]="$arg"
;;
esac
fi
done
# Invoke the wrapped Windows native tool
if [ "$targetName" = "CygWrapper" ]; then
echo "$targetName" "${nativeArgs[@]}"
else
exec "$targetName" "${nativeArgs[@]}"
fi
--=====================_10675828==_
Content-Type: text/plain; charset=us-ascii
--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple
--=====================_10675828==_--
- Raw text -