-
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
>
>
-
Attach software www.cajoon.com to your Java environment (J2SE, J2EE) and get 'root-cause' for every exception . . .
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks