Re: java command-line main() file execution
- From: Ian Shef <invalid@xxxxxxxxxxxxx>
- Date: Mon, 16 Jan 2006 19:39:32 GMT
Greger <boss@xxxxxxxxxxxxxx> wrote in news:dqals3$36p$1@phys-
news4.kolumbus.fi:
> bb wrote:
>
>> I have a class file with a main method in the following directory:
>> C:\tea\emat\web\WEB-INF\classes\emat\com\edi
>> The name of the file is: Edi210Parser. The class has a main method.
>> I've developed and tested the file under Eclipse, which has shielded me
>> from the classpath and command-line args.
>>
>> I've defined the file in the Windows classpath setting as:
>> C:\tea\emat\web\WEB-INF\classes\emat\com\edi;
>>
>> For the life of me I can't remember how to run the file from a Windows
>> command-line. I've tried the following:
>> c:>java -classpath emat\com\edi\Edi210Parser out.txt (to read the input
>> file that exists in the same directory)
>>
>> I've changed directories to the place where the file is:
>> C:\tea\emat\web\WEB-INF\classes\emat\com\edi and run:
>> c:\tea\emat\web\WEB-INF\classes\emat\com\edi>java Edi210Parser out.txt
>> and
>> c:\tea\emat\web\WEB-INF\classes\emat\com\edi>java
>> emat.com.edi.Edi210Parser out.txt
>>
>> The closest I've come to getting it right is:
>> c:\tea\emat\web\WEB-INF\classes\emat\com\edi>java -classpath
>> EdiParser210 out.txt
>> which results in:
>> Exception in thread "main" java.lang.NoClassDefFoundError: out/txt,
>> which makes no sense at this point but shows (or seems to) that the
>> class was found.
>>
>> Any help would be appreciated....
>
> what package is your class in?
>
You told Java wheere to find your class ( -classpath ...).
You didn't specify what class to use, so out.txt was used. This means
class txt in package out, which should be located at out\txt (which Java
will report as out/txt). This, of course, was wrong, and thus the
Exception.
Please specify the class that contains your main method.
Do NOT suffix the name with ".class" !
--
Ian Shef 805/F6 * These are my personal opinions
Raytheon Company * and not those of my employer.
PO Box 11337 *
Tucson, AZ 85734-1337 *
.
- References:
- java command-line main() file execution
- From: bb
- Re: java command-line main() file execution
- From: Greger
- java command-line main() file execution
- Prev by Date: Apache redirection problem
- Next by Date: Product Announcement: Managing Architecture using Lightweight Dependency Models
- Previous by thread: Re: java command-line main() file execution
- Next by thread: [ANN] Solex Web application testing tool 0.5.3 released
- Index(es):
Relevant Pages
|
|