Wanted: Help translating classpath from CMD.EXE to bash

Igor Pechtchanski pechtcha@cs.nyu.edu
Tue Nov 1 04:06:00 GMT 2005


On Mon, 31 Oct 2005, Siegfried Heintze wrote:

> Thanks Igor!
>
> > As someone mentioned, you can use "cygpath -p" to convert a POSIX-style
> > path into a Win32-style one.
>
> I think I need to go the other way. Given a CLASSPATH variable in
> windows, how do I convert it to cygwin? Do I use ":" to separate the
> elements, or do I use "\;". If I use ":", what about the windows device
> names?

I should've been clearer, and said "you can use 'cygpath -p' to convert
*between* a POSIX-style path and a Win32-style one".  "cygpath -[u]p" (the
"u" is optional) will convert from a Win32 path to a POSIX one, whereas
"cygpath -wp" will convert from a POSIX path to a Win32 one.  For more
details, see "man cygpath", as Larry said.

> It seems to me this should have worked, but it does not:
>  * CLASSPATH=.\;c:\\dev\\xalan\\xalan-j_2_7_0\\xsltcservlet.jar\;others
>  * export $CLASSPATH
>  * echo ${CLASSPATH}
>  * javac myprogram.java

What exactly didn't work here?  What were the errors?

> > Alternatively, you can try using my java wrapper scripts that will do
> > the translation automatically for you (the scripts can be found at
> > <http://cygwin.com/cgi-bin/cvsweb.cgi/wrappers/java/?cvsroot=cygwin-apps>;
> > you'll need to edit the scripts to point them to your Java
> > installation directory).
>
> OK, is there any documentation?

Nope.  I haven't really had time to package them properly.  I won't be
able to write full-fledged documentation, but I'm willing to answer
questions and accept documentation patches against the CVS repository
above.  Care to help out?

> What kind of wrappers are these?

They are wrappers around the "java", "javac", etc, executables.  Just make
sure they precede the real executables in the PATH.  They will basically
invoke the real ones, having translated the known path arguments to POSIX
format.  They will not translate all arguments -- if you pass filenames to
your Java program, you're responsible for translating those.  But they
help (a lot, actually -- I use them constantly on my machine).

> I have never heard of bash wrappers before. (hmmm... bash wrappers,
> sounds like a new genre of music! -- maybe something like slam dancing?)

They are wrapper programs written in bash.

> How about an example? That would probably suffice.

Sure.  You can run

/usr/local/bin/java -classpath /home/me/jars/a.jar:/home/me/classes SomeClass

And it'll call the Windows Java executable with the right paths.

> Well, even if I get Igor's bash wrappers to work, I'm kinda curious why
> my attempt did not.

You'll have to provide more details on what exactly didn't work in your
attempt.
HTH,
	Igor
P.S. If you decide to try XJ after all, I'd be interested in your feedback
off-list.
-- 
				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!

If there's any real truth it's that the entire multidimensional infinity
of the Universe is almost certainly being run by a bunch of maniacs. /DA

--
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/



More information about the Cygwin mailing list