Wanted: Help translating classpath from CMD.EXE to bash

2005-10-31 Thread Siegfried Heintze
Can someone help me translate this to bash? It works with CMD.EXE. java and
javac are programs for sun that are not cygwin based so I believe they want
windows style file specifications and not cygwin/bash/unix style file
specifications.

Here is the CMD.EXE script:

SET
CLASSPATH=.;c:\dev\xalan\xalan-j_2_7_0\samples\xsltcservlet.jar;c:\dev\xalan
\xalan-j_2_7_0\samples\xsltcejb.jar;c:\dev\xalan\xalan-j_2_7_0\samples\xsltc
brazil.jar;c:\dev\xalan\xalan-j_2_7_0\samples\xsltcapplet.jar;c:\dev\xalan\x
alan-j_2_7_0\samples\xalansamples.jar;c:\dev\xalan\xalan-j_2_7_0\serializer.
jar;c:\dev\xalan\xalan-j_2_7_0\xalan.jar;c:\dev\xalan\xalan-j_2_7_0\xercesIm
pl.jar;c:\dev\xalan\xalan-j_2_7_0\xml-apis.jar;c:\dev\xalan\xalan-j_2_7_0\xs
ltc.jar
javac -g ApplyXPathDOM.java
java ApplyXPathDOM foo.xml /doc/name[1]/@last

Woops -- I did not intend it to wrap!

Thanks,
Siegfried


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



Re: Wanted: Help translating classpath from CMD.EXE to bash

2005-10-31 Thread Wayne Willcox
If I understand your question you can convert paths to and from
dos by using the cygpath command.

On Mon, Oct 31, 2005 at 10:29:56AM -0700, Siegfried Heintze wrote:
 Can someone help me translate this to bash? It works with CMD.EXE. java and
 javac are programs for sun that are not cygwin based so I believe they want
 windows style file specifications and not cygwin/bash/unix style file
 specifications.
 
 Here is the CMD.EXE script:
 
 SET
 CLASSPATH=.;c:\dev\xalan\xalan-j_2_7_0\samples\xsltcservlet.jar;c:\dev\xalan
 \xalan-j_2_7_0\samples\xsltcejb.jar;c:\dev\xalan\xalan-j_2_7_0\samples\xsltc
 brazil.jar;c:\dev\xalan\xalan-j_2_7_0\samples\xsltcapplet.jar;c:\dev\xalan\x
 alan-j_2_7_0\samples\xalansamples.jar;c:\dev\xalan\xalan-j_2_7_0\serializer.
 jar;c:\dev\xalan\xalan-j_2_7_0\xalan.jar;c:\dev\xalan\xalan-j_2_7_0\xercesIm
 pl.jar;c:\dev\xalan\xalan-j_2_7_0\xml-apis.jar;c:\dev\xalan\xalan-j_2_7_0\xs
 ltc.jar
 javac -g ApplyXPathDOM.java
 java ApplyXPathDOM foo.xml /doc/name[1]/@last
 
 Woops -- I did not intend it to wrap!
 
 Thanks,
 Siegfried
 
 
 --
 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/

-- 
Slowly and surely the unix crept up on the Nintendo user ...
Wayne Willcox  I will not eat green eggs and ham
[EMAIL PROTECTED] I will not eat them Sam I Am!!
A wise person makes his own decisions, a weak one obeys public opinion.
-- Chinese proverb

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



Re: Wanted: Help translating classpath from CMD.EXE to bash

2005-10-31 Thread Igor Pechtchanski
On Mon, 31 Oct 2005, Siegfried Heintze wrote:

 Can someone help me translate this to bash? It works with CMD.EXE. java
 and javac are programs for sun that are not cygwin based so I believe
 they want windows style file specifications and not cygwin/bash/unix
 style file specifications.

 Here is the CMD.EXE script:

 SET 
 CLASSPATH=.;c:\dev\xalan\xalan-j_2_7_0\samples\xsltcservlet.jar;c:\dev\xalan\xalan-j_2_7_0\samples\xsltcejb.jar;c:\dev\xalan\xalan-j_2_7_0\samples\xsltcbrazil.jar;c:\dev\xalan\xalan-j_2_7_0\samples\xsltcapplet.jar;c:\dev\xalan\xalan-j_2_7_0\samples\xalansamples.jar;c:\dev\xalan\xalan-j_2_7_0\serializer.jar;c:\dev\xalan\xalan-j_2_7_0\xalan.jar;c:\dev\xalan\xalan-j_2_7_0\xercesImpl.jar;c:\dev\xalan\xalan-j_2_7_0\xml-apis.jar;c:\dev\xalan\xalan-j_2_7_0\xsltc.jar
 javac -g ApplyXPathDOM.java
 java ApplyXPathDOM foo.xml /doc/name[1]/@last

As someone mentioned, you can use cygpath -p to convert a POSIX-style
path into a Win32-style one.

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).

SHAMELESS_PLUG
Or, since you're doing XML processing in Java, you might find XJ
(http://www.research.ibm.com/xj/) useful.  There's a prototype on IBM
alphaWorks (a free download), and it works under Cygwin.
/SHAMELESS_PLUG

HTH,
Igor
-- 
http://cs.nyu.edu/~pechtcha/
  |\  _,,,---,,_[EMAIL PROTECTED]
ZZZzz /,`.-'`'-.  ;-;;,_[EMAIL PROTECTED]
 |,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/



RE: Wanted: Help translating classpath from CMD.EXE to bash

2005-10-31 Thread Siegfried Heintze
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?

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

 
 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? What kind of wrappers are these? I have
never heard of bash wrappers before. (hmmm... bash wrappers, sounds like a
new genre of music! -- maybe something like slam dancing?)

How about an example? That would probably suffice.

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

Siegfried


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



Re: Wanted: Help translating classpath from CMD.EXE to bash

2005-10-31 Thread Larry Hall (Cygwin)

On 10/31/2005, Siegfried Heintze wrote:

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?

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


If you're running from bash or any other Cygwin shell, then the path is
already in POSIX form.  'javac' won't understand this, since it is a
Windows program.  'cygpath' is the way to convert between POSIX paths and
Windows/DOS, forward and back.  In your case, you want POSIX-Windows/DOS
conversion.  See 'man cygpath' for more details.

--
Larry Hall  http://www.rfk.com
RFK Partners, Inc.  (508) 893-9779 - RFK Office
838 Washington Street   (508) 893-9889 - FAX
Holliston, MA 01746

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



RE: Wanted: Help translating classpath from CMD.EXE to bash

2005-10-31 Thread Igor Pechtchanski
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/
  |\  _,,,---,,_[EMAIL PROTECTED]
ZZZzz /,`.-'`'-.  ;-;;,_[EMAIL PROTECTED]
 |,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/



RE: Wanted: Help translating classpath from CMD.EXE to bash

2005-10-31 Thread Siegfried Heintze
I figured it out. This does work after all:

CLASSPATH=.\;c\:\\dev\\xalan\\xalan-j_2_7_0\\samples\\xsltcservlet.jar\;c\:\
\dev\\xalan\\xalan-j_2_7_0\\samples\\xsltcejb.jar\;c\:\\dev\\xalan\\xalan-j_
2_7_0\\samples\\xsltcbrazil.jar\;c\:\\dev\\xalan\\xalan-j_2_7_0\\samples\\xs
ltcapplet.jar\;c\:\\dev\\xalan\\xalan-j_2_7_0\\samples\\xalansamples.jar\;c\
:\\dev\\xalan\\xalan-j_2_7_0\\serializer.jar\;c\:\\dev\\xalan\\xalan-j_2_7_0
\\xalan.jar\;c\:\\dev\\xalan\\xalan-j_2_7_0\\xercesImpl.jar\;c\:\\dev\\xalan
\\xalan-j_2_7_0\\xml-apis.jar\;c\:\\dev\\xalan\\xalan-j_2_7_0\\xsltc.jar
export CLASSPATH
javac -g ApplyXPathDOM.java


One has to escape the colons and the semi colons. I don't understand why I
have to escape the colons too -- but it works.

Thanks for the example for the java/bash wrappers -- I think I understand
now.

Siegfried

-Original Message-
From: Igor Pechtchanski [mailto:[EMAIL PROTECTED] 
Sent: Monday, October 31, 2005 9:06 PM
To: Siegfried Heintze
Cc: cygwin@cygwin.com
Subject: RE: Wanted: Help translating classpath from CMD.EXE to bash

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/
  |\  _,,,---,,_[EMAIL PROTECTED]
ZZZzz /,`.-'`'-.  ;-;;,_[EMAIL PROTECTED]
 |,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/