Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!nx01.iad01.newshosting.com!newshosting.com!69.16.185.21.MISMATCH!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Lew Newsgroups: comp.lang.java.programmer Subject: Re: Java classpath question and how to run a program from command line? Date: Tue, 29 Nov 2011 12:08:12 -0800 (PST) Organization: http://groups.google.com Lines: 21 Message-ID: <32418883.575.1322597293001.JavaMail.geo-discussion-forums@preu18> References: <85f06dad-9e66-42ef-a232-d98c72832318@cc2g2000vbb.googlegroups.com> <5431520.470.1322581431774.JavaMail.geo-discussion-forums@prij11> <89680c27-0ff8-4c84-b390-6b54ceb5e4cf@cc2g2000vbb.googlegroups.com> Reply-To: comp.lang.java.programmer@googlegroups.com NNTP-Posting-Host: 2620:0:1000:2404:224:d7ff:fe69:5838 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1322597295 4476 127.0.0.1 (29 Nov 2011 20:08:15 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 29 Nov 2011 20:08:15 +0000 (UTC) In-Reply-To: <89680c27-0ff8-4c84-b390-6b54ceb5e4cf@cc2g2000vbb.googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2620:0:1000:2404:224:d7ff:fe69:5838; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T User-Agent: G2/1.0 X-Google-Web-Client: true Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:10332 www wrote: > After learning that, there is one more correction in .bashrc file: > using ":" not ";" to separate the two: > > export CLASSPATH="/cygdrive/d/project/libs/*:/cygdrive/d/project/bin" > Now, no matter which directory I am at, this command will run my > program: > > java -classpath `cygpath -wp $CLASSPATH` A.B.C.MainWindow It's usually a bad idea to use CLASSPATH. Java tries to read it by default, so you already made a mistake by applying cygpath after setting the variable instead of before. export CLASSPATH=`cygpath -wp "/cygdrive/d/project/libs/*:/cygdrive/d/project/bin"` Besides that, using it in conjunction with -cp is silliness. Just use -cp. CLASSPATH is usually too global. -- Lew