NoClassDefFoundError for applications, but not for applets

T

Tex2000

I am writing some Java programs at home. A few months ago I could
compile Java applications and applets just fine - something must have
changed. I can still compile and use applets, and still compile
applications. But I cannot run Java applications. I always get
Exception in thread "main" java.lang.NoClassDefFoundError:
application.java. I am using the Java 1.4.2_04 development kit.

Any thoughts would be much appreciated.

Tex2000
 
?

=?ISO-8859-1?Q?Jan_Thom=E4?=

Tex2000 said:
I always get
Exception in thread "main" java.lang.NoClassDefFoundError:
the full stacktracke and maybe your main method would help to track down
the issue.

Best regards,
Jan
 
A

Alex Hunsley

Tex2000 said:
I am writing some Java programs at home. A few months ago I could
compile Java applications and applets just fine - something must have
changed. I can still compile and use applets, and still compile
applications. But I cannot run Java applications. I always get
Exception in thread "main" java.lang.NoClassDefFoundError:
application.java. I am using the Java 1.4.2_04 development kit.

Any thoughts would be much appreciated.

Tex2000

Google for "java classpath".
 
?

=?ISO-8859-1?Q?Jan_Thom=E4?=

Tex2000 said:
I always get
Exception in thread "main" java.lang.NoClassDefFoundError:
application.java.

Doh, missed this at the first glance. it looks for application.java
class this tells me you probably tried to start the program with
something like:

java application.java

which won't work. You have to start the program with

java <classname>

so if you got a class named "application" you gotta start it like this:

java application

do not append that ".java" thingy.

Greetings,
Jan
 
T

Tex2000

Jan said:
the full stacktracke and maybe your main method would help to track down
the issue.

Best regards,
Jan

I tried the -verbose command line option on java.exe, but it does not
offer much help. It does show that it is able to load many classes from
c:\j2sdk1.4.2_04\jre\lib\rt.jar. However, I also have run time
environments under c:\Program Files\Java. Specifically I have:
c:\Program Files\Java\j2re1.4.1_02
c:\Program Files\Java\j2re1.4.2_01
c:\Program Files\Java\j2re1.4.2_04

I suspect my problems started after I loaded a QuickTime viewer some
weeks ago, as my class path now points to
c:\j2re1.4.2_04\lib\ext\QTJava.zip. Since I didn't have time to fix it
then I've restricted myself to writing Java applets.


Tex2000
 
D

dashing

Asalam o alikum...

you problem is not much bigger
just go tu cmd and then write..
set classpath= ; (than press enter)
OR
go to the properties of my computer and select advance in it after
that click on environment variable. Now you have seen system variables
in downward so select classpath there and click on edit , than set its
value = ";" that is semicolumm ..

isallah your problem will be solve

thankyou
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,271
Latest member
BuyAtenaLabsCBD

Latest Threads

Top