This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: help on makefile


On Fri, 27 Aug 2004, Nicolas Roche wrote:

> Yung Leem wrote:
> > Hello to all cygwin experts,
> >
> > I am a newbie cygwin user that's having a problem compiling a java source.
> > I am running a makefile that's calling "javac -cp [some_dir]
> > /cygdrive/c/blah/myclass.java"
> > that's complaining about not being able to find that file.  Being familiar
> > with unix development,
> > I assumed that the shell process would spawn the javac process, but I think
> > my guess is wrong.

No, it's right, the program does get spawned by the shell.  What you seem
to mean is that you assumed that there would be a Cygwin javac program
that would understand the POSIX pathnames, which is an incorrect
assumption.

> > What really seems to happen is that javac gets called from Windows XP (the
> > system I am using) and javac (from windows xp process) tries to compile
> > that /cygdrive/c/blah/myclass.java file, and
> > obviously fails to find that file.  What are the options I have?
>
> your javac program is not a cygwin program so it won't understand the cygwin
> like path. One solution is to use cygpath -w to translate cygwin-like path to
> windows-like path.

Correct, see <http://cygwin.com/cygwin-ug-net/using-effectively.html>.
Or you can use the java wrapper scripts I posted earlier (see
<http://cygwin.com/ml/cygwin/2003-01/msg00174.html> or the wrappers/java
directory in the cygwin-apps CVS repository).  These wrappers make java*
look like the Unix java that understands Unix (POSIX) paths, both on the
command line, and in variables such as $CLASSPATH, and does translations
automatically.  One thing the scripts don't do is detect where your java
is installed, so you'll have to edit them to specify that location.

> > I am really freaking out that something like LD_LIBRARY_PATH,
> > CLASSPATH, or PATH variables use ":" colon as a delimeter, but windows
> > file systems recognize ":" as a drive name not as a delimeter. So
> > having something like "export
> > CLASSPATH=c:/windows:c:/temp:c:/blah:$CLASSPATH" will be a nightmare.
> > I need some advise.  Thanks in advance for answering my question.
>
> Cygwin handle very well the path separators. If you do in cygwin bash
> $ export CLASSPATH=c:/windows:c:/temp:c:/blah:$CLASSPATH

Not quite true.  First off, if the above were translated as a path (e.g.,
by "cygpath -wp", the colons (":") after the drive letters would be turned
into semicolons, with all the resulting havoc.  There are three solutions:
one is to set the CLASSPATH using Windows notation (don't forget to escape
the semicolons [";"], or the shell will interpret them as command
separators), the other is to use the /cygdrive/c notation instead of the
c: notation, and translate it using "cygpath -wp" (e.g.,
CLASSPATH="`cygpath -wp /cygdrive/c/windows:/cygdrive/c/temp:/cygdrive/c/blah`;$CLASSPATH"
), and the third is to use the abovementioned java wrapper scripts which
will do the above for you automatically.

> you can launch a windows shell from cygwin and see that the var have been
> translated correctly (: -> ;)

Only $PATH and a couple of other variables are translated in this way.
$CLASSPATH isn't one of them, as you can easily verify.
HTH,
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"Happiness lies in being privileged to work hard for long hours in doing
whatever you think is worth doing."  -- Dr. Jubal Harshaw

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]