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!novia!news-out.readnews.com!news-xxxfer.readnews.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 07:43:51 -0800 (PST) Organization: http://groups.google.com Lines: 52 Message-ID: <5431520.470.1322581431774.JavaMail.geo-discussion-forums@prij11> References: <85f06dad-9e66-42ef-a232-d98c72832318@cc2g2000vbb.googlegroups.com> Reply-To: comp.lang.java.programmer@googlegroups.com NNTP-Posting-Host: 173.164.137.214 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1322581434 2187 127.0.0.1 (29 Nov 2011 15:43:54 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 29 Nov 2011 15:43:54 +0000 (UTC) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=173.164.137.214; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T User-Agent: G2/1.0 X-Google-Web-Client: true Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:10327 www wrote: >> Now, I can make it work: >> >> java -classpath "/cygdrive/d/project/libs/*;." A.B.C.MainWindow >> >> by adding the pair of " on the parameter after -classpath AND libs/*, >> not libs only. Both corrections are needed to make it work. Well, duh. Except you forgot to switch to Windows nomenclature ("D:/", not "/cygdrive/= d/"). You need the quotes because bash sees the semicolon as a statement terminat= or. Remember? You could also have escaped the semicolon with a backslash = instead of using quotes. You need the asterisk for the reason stated upthread. Did you review the r= ules for classpath specification as two respondents suggested? It's very b= asic stuff - the JARs must be called out explicitly, or since recently with= a wildcard. You don't pick up JARs just by listing the directory. As sta= ted in the tutorials and documentation. Which you should study. > Sorry, I have to correct the command above. I can only make it work by > using relative path, not absolute path. In another words, I need to be > at /cygdrive/d/project/bin/ first, then use this command: >=20 > java -classpath "../libs/*;." A.B.C.MainWindow >=20 > The following command does not work and I don't understand why: >=20 > java -classpath "/cygdrive/d/project/libs/*;." A.B.C.MainWindow >=20 > The error message shows that A.B.C.MainWindow was found and loaded, > however, those JAR files were not found and loaded. I have added root > "/" to the classpath, and the error is the same: >=20 > java -classpath "/;/cygdrive/d/project/libs/*;." A.B.C.MainWindow Well, duh. Did you read the answer upthread for that? Someone already exp= lained this to you. You should read the answers that people here generousl= y provide for free at your request. "java" is a Windows program. It does not recognize Cygwin paths. Again we= tell you. You even got a link upthread for the "java" command and how it takes parame= ters. You should read the answers that people here generously provide for = free at your request. And the Java documentation. --=20 Lew