by David Caldwell
26 December 2002
Programmers Who Know Java But Are New To Cygwin
Why can't I get Java to recognize my CLASSPATH environment variable or -classpath command-line argument? (Or other path or file
arguments?)
Java is a Windows program, and as such, doesn't recognize Cygwin-specific paths. So /cygdrive/c/foo/...
is
useless to java.exe
. If your Java software uses file paths, you'll need to convert them to Windows-style path
names using the cygpath
tool included with Cygwin.
cygpath
takes a UNIX-style path as an argument and returns a Windows-style path. Here's an example:
$ cygpath -wp /cygdrive/c:/cygdrive/c/classes
c:\;c:\classes
So, when calling Java programs (say, from within shell scripts), you'd need to write your command-line like this:
java -classpath `cygpath -wp $CLASSPATH` [arguments]
Programmers Who Know Cygwin But Are New To Java
Why can't I get the libgcj
implementation of [some feature: AWT/Swing/regex/threads/etc.] working under Cygwin?
I don't know, but there are a couple of possibilities -- the implementation isn't done yet, and Cygwin isn't a supported
platform. Check the gcj
status page for details.
Note that Win32 is a supported platform using the Mingw libraries, so in theory your feature (if implemented at all) should
work using the -mno-cygwin
command-line option for gcc
.
Other Questions
Why Am I Having Trouble Using JNI With Cygwin Tools?
We have some more extensive articles on that topic. The first
article contains a step-by-step recipe for calling native code from a Java program, and the
second contains the steps necessary for starting a Java virtual machine within a native
program.
Question not answered? Perhaps it will become "frequently asked" if you ask it.