By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,470 Members | 1,907 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,470 IT Pros & Developers. It's quick & easy.

Exception in thread "main" java.lang.NoClassDefFoundError

P: n/a
(Forgive all caps... they are there to differentiate btw question and code)

THIS IS THE ERROR I KEEP GETTING. IT COMPILES BUT WHEN IT RUNS, THE
FOLLOWING POPS UP:
Exception in thread "main" java.lang.NoClassDefFoundError: PlayClip

THIS IS MY CODE:
import java.applet.*;
import java.io.*;
import java.net.*;

public class PlayClip {
public static void main(String args[]) throws Exception{
if(args.length == 0){
System.err.println("Specify file name to play");
System.exit(-1);
}
File file = new File(args[0]);
URL url = file.toURL();
AudioClip clip = Applet.newAudioClip(url);
clip.loop();
//Wait 30 seconds
Thread.sleep(30000);
System.exit(0);
}
}

THIS IS MY SYSTEM SETTINGS, ENVIR VAR"S ETC.
SET PATH=C:\j2sdk1.4.2_05\bin;
SET
CLASSPATH=C:\j2sdk1.4.2_05\bin;c:\jakarta-tomcat-5.0.25\common\lib\servlet-a
pi.jar
SET JAVA_HOME=C:\j2sdk1.4.2_05
SET TOMCAT_HOME=c:\jakarta-tomcat-5.0.25
SET CATALINA_HOME=c:\jakarta-tomcat-5.0.25

ANY IDEA WHY THIS IS HAPPENING? I CAN AND IN FACT ARE RUNNING AND COMPILING
SREVLETS TO TOMCAT...



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.720 / Virus Database: 476 - Release Date: 7/14/04
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"dave" <go******************@nowhere.com> wrote in message
news:M0*******************@nwrdny02.gnilink.net...
(Forgive all caps... they are there to differentiate btw question and code)
THIS IS THE ERROR I KEEP GETTING. IT COMPILES BUT WHEN IT RUNS, THE
FOLLOWING POPS UP:
Exception in thread "main" java.lang.NoClassDefFoundError: PlayClip .... CLASSPATH=C:\j2sdk1.4.2_05\bin;c:\jakarta-tomcat-5.0.25\common\lib\servlet-a pi.jar


Please observe netiquette and common sense. Caps are not required to
differentiate comments from code. Thousands upon thousands of messages have
gotten along just fine in the comp.lang.java.* groups without using all
caps.

Your problem is almost certainly that PlayClip.class is not in your
classpath. This is what the classpath is for: to tell Java where to find
classes you're trying to use. Use "java -classpath . PlayClip" to
temporarily add the current directory to the classpath. There's little
reason to have "C:\j2sdk1.4.2_05\bin" in your classpath, and
"c:\jakarta-tomcat-5.0.25\common\lib\servlet-api.jar" would likely be better
off elsewhere as well, like in a projects properties or settings.

Finally, in the future please post simple issues like this to
comp.lang.java.help and more advanced ones to comp.lang.java.programmer.
This group is not supposed to exist.
Jul 17 '05 #2

P: n/a
It was actually b/c i didn't enter ---> .;
before CLASSPATH= and PATH=

Believe it or not, I do appreciate your critique of my netiquette and will
keep this in mind. I apologize.

"dave" <go******************@nowhere.com> wrote in message
news:M0*******************@nwrdny02.gnilink.net...
(Forgive all caps... they are there to differentiate btw question and code)
THIS IS THE ERROR I KEEP GETTING. IT COMPILES BUT WHEN IT RUNS, THE
FOLLOWING POPS UP:
Exception in thread "main" java.lang.NoClassDefFoundError: PlayClip

THIS IS MY CODE:
import java.applet.*;
import java.io.*;
import java.net.*;

public class PlayClip {
public static void main(String args[]) throws Exception{
if(args.length == 0){
System.err.println("Specify file name to play");
System.exit(-1);
}
File file = new File(args[0]);
URL url = file.toURL();
AudioClip clip = Applet.newAudioClip(url);
clip.loop();
//Wait 30 seconds
Thread.sleep(30000);
System.exit(0);
}
}

THIS IS MY SYSTEM SETTINGS, ENVIR VAR"S ETC.
SET PATH=C:\j2sdk1.4.2_05\bin;
SET
CLASSPATH=C:\j2sdk1.4.2_05\bin;c:\jakarta-tomcat-5.0.25\common\lib\servlet-a pi.jar
SET JAVA_HOME=C:\j2sdk1.4.2_05
SET TOMCAT_HOME=c:\jakarta-tomcat-5.0.25
SET CATALINA_HOME=c:\jakarta-tomcat-5.0.25

ANY IDEA WHY THIS IS HAPPENING? I CAN AND IN FACT ARE RUNNING AND COMPILING SREVLETS TO TOMCAT...



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.720 / Virus Database: 476 - Release Date: 7/14/04

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.720 / Virus Database: 476 - Release Date: 7/14/04
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.