Exception in thread "main"
I have just installed jdk1.4 and am getting an error when I try to compile
a simple program. The source code is:
/*
this is a simple java program
Call this file Example.java.
*/
class Example {
//a Java program begins with a call to main()
public static void main(String args[]) {
System.out.println("Java drives the web");
}
}
The error Im getting is
Exception in thread "main" java.lang.NoClassDefFoundError: c:\jbg\Example
I get this error when I try to run the program. The program does compile.
Thanks for the help in advance
Sean
sbradley05@snet.net
Re: Exception in thread "main"
if your compiled class file is in this directory [c:\jbg\Example\], include
the folowing code to your autoexec.bat or just give this command on the prompt.
set classpath=.;c:\jbg\Example
try running it now.
bye,
Hiranya Samarasekera
----------------------------------------
"SeanB" <sbradley05@snet.net> wrote:
>
>I have just installed jdk1.4 and am getting an error when I try to compile
>a simple program. The source code is:
>
>/*
>this is a simple java program
>
>Call this file Example.java.
>*/
>class Example {
>//a Java program begins with a call to main()
>public static void main(String args[]) {
> System.out.println("Java drives the web");
> }
>}
>
>The error Im getting is
>
>Exception in thread "main" java.lang.NoClassDefFoundError: c:\jbg\Example
>
>I get this error when I try to run the program. The program does compile.
>
>Thanks for the help in advance
>
>Sean
>sbradley05@snet.net
Re: Exception in thread "main"
this will also happen if you try to run the class file with itīs
extension - in this case "java c:\jbg\Example.class" - to compile it you
need the file extension, to run it you donīt...
Volker
Hiranya Samarasekera wrote:
> if your compiled class file is in this directory [c:\jbg\Example\], include
> the folowing code to your autoexec.bat or just give this command on the prompt.
>
> set classpath=.;c:\jbg\Example
>
> try running it now.
>
> bye,
> Hiranya Samarasekera
>
> ----------------------------------------
>
> "SeanB" <sbradley05@snet.net> wrote:
>
>>I have just installed jdk1.4 and am getting an error when I try to compile
>>a simple program. The source code is:
>>
>>/*
>>this is a simple java program
>>
>>Call this file Example.java.
>>*/
>>class Example {
>>//a Java program begins with a call to main()
>>public static void main(String args[]) {
>> System.out.println("Java drives the web");
>> }
>>}
>>
>>The error Im getting is
>>
>>Exception in thread "main" java.lang.NoClassDefFoundError: c:\jbg\Example
>>
>>I get this error when I try to run the program. The program does compile.
>>
>>Thanks for the help in advance
>>
>>Sean
>>sbradley05@snet.net
>
>