Re: java command-line main() file execution



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 *
.



Relevant Pages

  • Re: On Etch cant to remove a broken package
    ... This installation wasn't success. ... After that this package came to be broken. ... Please specify options before other \ ... subprocess post-removal script returned error exit status 1 ...
    (Debian-User)
  • Re: relocatable packages on HP-UX
    ... location in PSF for my package. ... As a user when testing installation if I specify the ... my package product files end ...
    (comp.sys.hp.hpux)
  • Re: relocatable packages on HP-UX
    ... I was using "swinstall". ... location in PSF for my package. ... As a user when testing installation if I specify the ... directory location during request script, ...
    (comp.sys.hp.hpux)
  • relocatable packages on HP-UX
    ... I am trying to create relocatable packages on HP-UX. ... location in PSF for my package. ... As a user when testing installation if I specify the ...
    (comp.sys.hp.hpux)
  • relocatable packages on HP-UX
    ... I am trying to create relocatable packages on HP-UX. ... location in PSF for my package. ... As a user when testing installation if I specify the ...
    (comp.sys.hp.apps)