Re: Help with "main" error

From: Anthony Borla (ajborla_at_bigpond.com)
Date: 12/14/03


Date: Sun, 14 Dec 2003 05:03:25 GMT


"news" <j@j.cm> wrote in message
news:uFRCb.1839$D66.1494@nwrdny03.gnilink.net...
> I use the command line as follows:
>
> c:\j2sdk1.4.2_03\bin\java d:\personal\java-ChartGen\TestChart.class
>
> The full error message is as follows:
>
> Exception in thread "main" java.lang.NoClassDefFoundError:
> d:\personal\java-ChartGen\TestChart/class
>
> I thought it may be the CLASSPATH, but all my class files
> are located in the same folder and I used the switch -classpath
> but the same error comes up.
>

You shouldn't be using the '.class' extension on the command-line. The JVM
expects a classname, so you would be better off doing:

  c:\j2sdk1.4.2_03\bin\java d:\personal\java-ChartGen\TestChart

Alternatively:

* Set your PATH [similar to setting the CLASSPATH as
   I earlier described] to include the location of the J2SDK
   binaries

       set PATH=%path%;c:\j2sdk1.4.2_03\bin

* Now you can just change directory to the '.class'
   file location:

      d: <ENTER>
      cd d:\personal\java-ChartGen\TestChart <ENTER>

* You may now invoke the application thus:

      java -cp . TestChart

* Of course, if your application is 'packaged up', you may
   need to do:

      d: <ENTER>
      cd \ <ENTER>

   and invoke the application thus:

     java personal.java-ChartGen.TestChart

I hope this helps.

Anthony Borla

P.S.

The following link may be of help:

    http://mindprod.com/jgloss/classpath.html



Relevant Pages

  • Re: Help with "main" error
    ... > I use the command line as follows: ... > The full error message is as follows: ... > I thought it may be the CLASSPATH, but all my class files are located in the ...
    (comp.lang.java)
  • Re: Help with "main" error
    ... > I use the command line as follows: ... > The full error message is as follows: ... > I thought it may be the CLASSPATH, but all my class files are located in the ...
    (comp.lang.java.help)
  • Re: Help with "main" error
    ... > I use the command line as follows: ... > The full error message is as follows: ... > I thought it may be the CLASSPATH, ...
    (comp.lang.java.help)
  • Re: Help with "main" error
    ... I use the command line as follows: ... The full error message is as follows: ... I thought it may be the CLASSPATH, but all my class files are located in the ...
    (comp.lang.java)
  • Re: Help with "main" error
    ... I use the command line as follows: ... The full error message is as follows: ... I thought it may be the CLASSPATH, but all my class files are located in the ...
    (comp.lang.java.help)