Java classpath question and how to run a program from command line?
- From: www <xsli2@xxxxxxxxx>
- Date: Mon, 28 Nov 2011 13:50:14 -0800 (PST)
Hi:
Sorry. I am confused about how to run a Java class from command line(I
can run it from Eclipse). I use Cygwin on Windows 7.
This Java source file is /cygdrive/d/project/src/A/B/C/
MainWindow.java
The class file(MainWindow.class) is located at /cygdrive/d/project/bin/
A/BC/MainWindow.class (compiled by Eclipse)
MainWindow.java package is:
package A.B.C;
The following JAR files are also needed to run the program: /cygdrive/
d/project/libs/*.jar
In Cygwin command window, "echo $CLASSPATH" does not show anything, so
CLASSPATH has not been set.
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
Can you help me on how to run it from the command line?
I also tried to set up CLASSPATH in .bashrc file beforehand:
export CLASSPATH=/cygdrive/d/project/libs/;/cygdrive/d/project/bin
I am confused: should I separate them by ";" or ":" ?
I tried both ways, none of them is working: ". .bashrc" command
complains or no complains, but MainWindow still cannot be run.
Thank you very much.
.
- Follow-Ups:
- Re: Java classpath question and how to run a program from command line?
- From: Roedy Green
- Re: Java classpath question and how to run a program from command line?
- From: www
- Re: Java classpath question and how to run a program from command line?
- From: Lew
- Re: Java classpath question and how to run a program from command line?
- From: Robert Klemme
- Re: Java classpath question and how to run a program from command line?
- Prev by Date: Re: General Consulting Advice Urgently Needed
- Next by Date: Re: Java classpath question and how to run a program from command line?
- Previous by thread: How to set up automatic GUI JUnit test?
- Next by thread: Re: Java classpath question and how to run a program from command line?
- Index(es):
Relevant Pages
|