Re: Help with "main" error
From: Anthony Borla (ajborla_at_bigpond.com)
Date: 12/14/03
- Next message: Roedy Green: "Re: Help with "main" error"
- Previous message: William Steely: "Problem installing program with Java"
- In reply to: news: "Re: Help with "main" error"
- Next in thread: Roedy Green: "Re: Help with "main" error"
- Reply: Roedy Green: "Re: Help with "main" error"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: Roedy Green: "Re: Help with "main" error"
- Previous message: William Steely: "Problem installing program with Java"
- In reply to: news: "Re: Help with "main" error"
- Next in thread: Roedy Green: "Re: Help with "main" error"
- Reply: Roedy Green: "Re: Help with "main" error"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|