This is the mail archive of the 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: Shell Question Re: Cygwin Product

Hi, Scott,

You are mixing environments when you use a bash shell to run java. Your java system is Windows based and expecting Windows conventions for paths, which are different from UNIX style. Also, path separators for one system have a different meaning on the other.

UNIX shells generally use the semicolon as a command separator:

$ ls; pwd

To get the new item into the classpath requires quoting. There are several ways to do so:


Any one of these should work.

Also, when working with files in other directories, you may find you need to translate the UNIX path you're using into a windows path before java will correctly recognize it. You would use the cygpath command to do this. When I was doing this for a java class I took, I created a function to run java with the correct setup. I don't have it with me anymore, but the general idea was:

function java
	# Run java with converted paths, $1 MUST be a UNIX style path.
	/your/path/to/java $(cygpath -w $1)

This does not take into consideration issues of multiple arguments, possible options for java or paths that are already in Windows format, or any error conditions. You'll need to add those.


Scott Purcell wrote:

I have been using the Cygwin product for a couple of months on my Win2000 box. I am having trouble understanding a few issues (or possible) limitations.

My box has a single C:/ drive. So whenever I use the cygwin shell window, I have to type paths such as:
rm -r /cygdrive/c/tmptrash

I have found myself using cygwin for some things and the cmd window for other things. Today I was compiling some java classes in which I always use the cygwin shell. (bash).
javac com/skp/package/

But I cannot run the class after I compile it.
When I do the above, it never shows me any of the system out commands.

Also, when I am dealing with classpaths I am having issues:

spurcell@DSGSTL-PC-1523 /

spurcell@DSGSTL-PC-1523 /
It shows me the classpaths but with "PC" type backslashes. And when I try to add a new path, it never shows up in my update of classpath

(shows the above without the new somejar.jar)

Anyway, I believe I am not using cygwin like it should be. Could anyone take a few minutes out of their day to assist me?


-- Unsubscribe info: Problem reports: Documentation: FAQ:

-- Bob McGowan Staff Development Engineer VERITAS Software

-- Unsubscribe info: Problem reports: Documentation: FAQ:

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