Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #10324
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.42!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!74.125.64.80.MISMATCH!postnews.google.com!gl2g2000vbb.googlegroups.com!not-for-mail |
|---|---|
| From | www <xsli2@yahoo.com> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Java classpath question and how to run a program from command line? |
| Date | Tue, 29 Nov 2011 06:14:44 -0800 (PST) |
| Organization | http://groups.google.com |
| Lines | 48 |
| Message-ID | <ed80ba1f-864b-4fda-b619-abcd90f6ce2c@gl2g2000vbb.googlegroups.com> (permalink) |
| References | <85f06dad-9e66-42ef-a232-d98c72832318@cc2g2000vbb.googlegroups.com> |
| NNTP-Posting-Host | 205.156.36.56 |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | quoted-printable |
| X-Trace | posting.google.com 1322576170 13480 127.0.0.1 (29 Nov 2011 14:16:10 GMT) |
| X-Complaints-To | groups-abuse@google.com |
| NNTP-Posting-Date | Tue, 29 Nov 2011 14:16:10 +0000 (UTC) |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | gl2g2000vbb.googlegroups.com; posting-host=205.156.36.56; posting-account=oo44OQoAAABMDvaRlaO3SeQ5MVbxqLdH |
| User-Agent | G2/1.0 |
| X-Google-Web-Client | true |
| X-Google-Header-Order | HUALESNKRC |
| X-HTTP-UserAgent | Mozilla/5.0 (Windows NT 6.1; rv:8.0) Gecko/20100101 Firefox/8.0,gzip(gfe) |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:10324 |
Show key headers only | View raw
On Nov 28, 4:50 pm, www <xs...@yahoo.com> wrote:
>
> Now in Cygwin command window, I am at /cygdrive/d/project/bin, I typed
> the command below, but it didn't work:
>
> java -classpath /cygdrive/d/project/libs;. A.B.C.MainWindow
>
The output from the failing command above is showing the following
only:
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-d32 use a 32-bit data model if available
-d64 use a 64-bit data model if available
-client to select the "client" VM
-server to select the "server" VM
...
[truncated]
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.
Now, I still have another puzzle: I want to set CLASSPATH beforehand,
so I don't need to type "-classpath xxxx". In .bashrc file, I have:
export CLASSPATH="/cygdrive/d/project/libs/*;/cygdrive/d/project/bin"
run ". .bashrc", no complains. If I understand package concept
correctly, now, no matter which directory I am, I can type this
command:
java A.B.C.MainWindow
To my surprise, it says:
Error: Could not find or load main class A.B.C.MainWindow
I don't get it. Since CLASSPATH points to /cygdrive/d/project/bin
already, searching A.B.C.MainWindow should find /cygdrive/d/project/
bin/
A/B/C/MainWindow.class. Why it cannot find it?
Thank you again for all your help.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Java classpath question and how to run a program from command line? www <xsli2@yahoo.com> - 2011-11-28 13:50 -0800
Re: Java classpath question and how to run a program from command line? Robert Klemme <shortcutter@googlemail.com> - 2011-11-28 23:08 +0100
Re: Java classpath question and how to run a program from command line? markspace <-@.> - 2011-11-28 14:21 -0800
Re: Java classpath question and how to run a program from command line? Lew <lewbloch@gmail.com> - 2011-11-28 15:58 -0800
Re: Java classpath question and how to run a program from command line? www <xsli2@yahoo.com> - 2011-11-29 06:14 -0800
Re: Java classpath question and how to run a program from command line? www <xsli2@yahoo.com> - 2011-11-29 06:54 -0800
Re: Java classpath question and how to run a program from command line? Lew <lewbloch@gmail.com> - 2011-11-29 07:43 -0800
Re: Java classpath question and how to run a program from command line? www <xsli2@yahoo.com> - 2011-11-29 09:22 -0800
Re: Java classpath question and how to run a program from command line? Lew <lewbloch@gmail.com> - 2011-11-29 12:08 -0800
Re: Java classpath question and how to run a program from command line? Roedy Green <see_website@mindprod.com.invalid> - 2011-11-29 13:57 -0800
csiph-web