delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/05/08/12:14:32

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <3EBA81F2.8020701@veritas.com>
Date: Thu, 08 May 2003 09:12:34 -0700
From: Bob McGowan <rmcgowan AT veritas DOT com>
Organization: VERITAS Software, Inc.
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030312
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Shell Question Re: Cygwin Product
References: <34385CBC5E8E664EB0007814636AB36A20FA1A AT exchange1 DOT dimensions DOT com>
In-Reply-To: <34385CBC5E8E664EB0007814636AB36A20FA1A@exchange1.dimensions.com>

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:

	CLASSPATH="${CLASSPATH};C:/somejar.jar"
	CLASSPATH=${CLASSPATH}';C:/somejar.jar'
	CLASSPATH=${CLASSPATH}\;C:/somejar.jar

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.

Bob

Scott Purcell wrote:
> Hello,
> 
> 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/abc.java
> 
> But I cannot run the class after I compile it.
> java com.skp.package.abc
> 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 AT DSGSTL-PC-1523 /
> $ echo $CLASSPATH
> .;C:\lib\xmlrpc-1.1.jar;C:\lib\xerces.jar;C:\lib\saxpath.jar;C:\lib\jaxen-core.j
> ar;C:\lib\jaxen-jdom.jar;C:\lib\jdom.jar;C:\lib\servlet.jar;C:\lib\altercast_sdk
> .jar;C:\projects\src\java_src;C:\projects\enklav\WEB-INF\classes;C:\lib\oracle.j
> ar;C:\lib\javamail.jar;C:\lib\jspsmart.jar;
> 
> spurcell AT 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
> CLASSPATH=${CLASSPATH};C:/somejar.jar
> 
> echo $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?
> 
> Sincerely
> Scott
> 
> 
> --
> 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/

-- 
Bob McGowan
Staff Development Engineer
VERITAS Software
rmcgowan AT veritas DOT com


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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019