javac on cygwin

Igor Pechtchanski pechtcha@cs.nyu.edu
Mon Jan 13 03:01:00 GMT 2003


On Sat, 4 Jan 2003, David P. Caldwell wrote:

> Kevin:
>
> >Ok, I've searched for articles on getting a java
> >compiler working on cygwin. I got very vague info.
>
> >I've got the java JDK 1.4.1 from java.sun.com. Now
> >what do I do?
>
> Not sure what your background is, so I'm not sure how to answer.  Right now,
> you could be someone who doesn't know Java, someone who doesn't know Cygwin,
> someone who doesn't know UNIX ... so without sitting down and writing a
> script that would satisfy all three audiences (a combined Java/Cygwin/UNIX
> tutorial), I can't really answer your question.
>
> You might want to check out
>
> http://www.inonit.com/cygwin/
>
> Perhaps you can let us know specifically what you've tried and what happened
> so that we can assess your situation more accurately.
>
> -- David.

For what it's worth, I use the attached scripts as wrappers for java, jar,
javadoc and javac (the javac one is not extensively tested as I use a
Cygwin-compiled jikes for java compilation).  The only caveat is that
filenames passed as parameters to Java programs and custom doclet options
in javadoc are not converted.  You will need to change the *_EXEC values
close to the beginning of the scripts to conform to your system (I have
IBM JDK 1.3).

Hope this helps.  David, feel free to post them on the web page if needed.
I'd also appreciate any comments or bug reports.  Thanks.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

Oh, boy, virtual memory! Now I'm gonna make myself a really *big* RAMdisk!
  -- /usr/games/fortune
-------------- next part --------------
#!/bin/bash
#
# A wrapper for calling Java from Cygwin
# Author: Igor Pechtchanski <pechtcha@cs.nyu.edu>
#

ME="`basename $0`"
JAVA_EXEC="/cygdrive/c/Program Files/IBM/Java13/jre/bin/java.exe"
ARGS=""

while [ -n "$1" ]; do
   arg="$1"
   shift
   case "$arg" in
      -cp | -classpath)
         arg="$arg' '`cygpath -p -w "$1"`"
         shift
         ;;
      -Xbootclasspath*:*)
         arg="${arg%%:*}:`cygpath -p -w "${arg#*:}"`"
         ;;
   esac
   ARGS="$ARGS '$arg'"
done

eval "set -- $ARGS"

exec "$JAVA_EXEC" "$@"

-------------- next part --------------
#!/bin/bash
#
# A wrapper for calling Jar from Cygwin
# Author: Igor Pechtchanski <pechtcha@cs.nyu.edu>
#

ME="`basename $0`"
JAR_EXEC="/cygdrive/c/Program Files/IBM/Java13/bin/jar.exe"
ARGS=""
if [ -n "$1" ]; then
   firstarg="$1"; shift
   ARGS="$ARGS '$firstarg'"
   # Check for filename
   case "$firstarg" in
      *f*) arg="`cygpath -w "$1"`"
           shift
           ARGS="$ARGS '$arg'";;
   esac
   # Check for manifest
   case "$firstarg" in
      *m*) arg="`cygpath -w "$1"`"
           shift
           ARGS="$ARGS '$arg'";;
   esac
fi
# Change all filenames
while [ -n "$1" ]; do
   arg="$1"
   shift
   case "$arg" in
      -*) ;;
      *) arg="`cygpath -p -w "$1"`" ;;
   esac
   ARGS="$ARGS '$arg'"
done

eval "set -- $ARGS"

exec "$JAR_EXEC" "$@"

-------------- next part --------------
#!/bin/bash
#
# A wrapper for calling Javadoc from Cygwin
# Author: Igor Pechtchanski <pechtcha@cs.nyu.edu>
#

ME="`basename $0`"
JAVADOC_EXEC="/cygdrive/c/Program Files/IBM/Java13/bin/javadoc.exe"
ARGS=""

while [ -n "$1" ]; do
   arg="$1"
   shift
   case "$arg" in
      # Generic options
      -overview)
         arg="$arg' '`cygpath -w "$1"`"
         shift
         ;;
      -public | \
      -protected | \
      -package | \
      -private | \
      -help | \
      -1.1 | \
      -verbose)
         ;;
      -doclet | \
      -locale | \
      -encoding)
         arg="$arg' '$1"
         shift
         ;;
      -docletpath | \
      -sourcepath | \
      -classpath | \
      -bootclasspath | \
      -extdirs)
         arg="$arg' '`cygpath -p -w "$1"`"
         shift
         ;;

      # Java flags option
      -Jcp | -Jclasspath)
         arg="$arg' '`cygpath -p -w "$1"`"
         shift
         ;;
      -JXbootclasspath*:*)
         arg="${arg%%:*}:`cygpath -p -w "${arg#*:}"`"
         ;;
      -J*)
         ;;

      # Doclet options
      -d | \
      -helpfile | \
      -stylesheetfile)
         arg="$arg' '`cygpath -w "$1"`"
         shift
         ;;
      -use | \
      -version | \
      -author | \
      -splitindex | \
      -nodeprecated | \
      -nodeprecatedlist | \
      -nosince | \
      -notree | \
      -noindex | \
      -nohelp | \
      -nonavbar | \
      -serialwarn)
         ;;
      -windowtitle | \
      -doctitle | \
      -title)
         arg="$arg' '$1"
         shift
         ;;
      -header | \
      -footer | \
      -bottom)
         # Quote single quotes
         arg="$arg' '`echo "$1" | sed "s/'/'"'"'"'"'"'"'/g"`"
         shift
         ;;
      -link)
         arg="$arg' '$1"
         shift
         ;;
      -link)
         arg="$arg' '$1' '$2"
         shift
         shift
         ;;
      -group)
         arg="$arg' '$1' '$2"
         shift
         shift
         ;;
      -charset | \
      -docencoding)
         arg="$arg' '$1"
         shift
         ;;
   esac
   ARGS="$ARGS '$arg'"
done

eval "set -- $ARGS"

exec "$JAVADOC_EXEC" "$@"

-------------- next part --------------
#!/bin/bash
#
# A wrapper for calling Javac from Cygwin
# Author: Igor Pechtchanski <pechtcha@cs.nyu.edu>
#

ME="`basename $0`"
JAVAC_EXEC="/cygdrive/c/Program Files/IBM/Java13/bin/javac.exe"
ARGS=""

while [ -n "$1" ]; do
   arg="$1"
   shift
   case "$arg" in
      -classpath | \
      -sourcepath | \
      -bootclasspath | \
      -extdirs | \
      -d)
         arg="$arg' '`cygpath -p -w "$1"`"
         shift
         ;;
   esac
   ARGS="$ARGS '$arg'"
done

eval "set -- $ARGS"

exec "$JAVAC_EXEC" "$@"

-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


More information about the Cygwin mailing list