Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-06-2009, 02:07 PM
Member
 
Join Date: Oct 2009
Posts: 56
Rep Power: 0
dudejonne is on a distinguished road
Smile Simple error..?
import java.applet.Applet;
public class img extends Applet {
public static void main (String[] args) {
//some code
}
}

Gives this error:

Exception in thread "main" java.lang.NoClassDefFoundError: img
Caused by: java.lang.ClassNotFoundException: img
at java.net.URLClassLoader$1.run(URLClassLoader.java: 200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.j ava:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:3 07)
at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:2 52)
at java.lang.ClassLoader.loadClassInternal(ClassLoade r.java:320)
Could not find the main class: img. Program will exit.

Very weird since I do have a main class, right?

Edit:
javac img.java works fine but java img gives the error..

Last edited by dudejonne; 11-06-2009 at 02:23 PM.
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 11-06-2009, 02:39 PM
RamyaSivakanth's Avatar
Senior Member
 
Join Date: Apr 2009
Location: Chennai
Posts: 589
Rep Power: 1
RamyaSivakanth is on a distinguished road
Default
Chech ur path and classpath settings.
__________________
Ramya
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 11-06-2009, 04:11 PM
Member
 
Join Date: Oct 2009
Posts: 56
Rep Power: 0
dudejonne is on a distinguished road
Default
My path is set to: C:\Program Files\Java\jdk1.6.0_16\bin\
To what should I set my classpath?
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 11-06-2009, 04:21 PM
RamyaSivakanth's Avatar
Senior Member
 
Join Date: Apr 2009
Location: Chennai
Posts: 589
Rep Power: 1
RamyaSivakanth is on a distinguished road
Default
u set to lib \Java\jdk1.6.0_16\lib\tools.jar
__________________
Ramya
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 11-06-2009, 04:33 PM
Member
 
Join Date: Oct 2009
Posts: 56
Rep Power: 0
dudejonne is on a distinguished road
Default
Hm, it doesn't works:

C:\wamp\www>set classpath=C:\Program Files\Java\jdk1.6.0_16\lib\tools.jar

C:\wamp\www>javac img.java

C:\wamp\www>java img
Exception in thread "main" java.lang.NoClassDefFoundError: img
Caused by: java.lang.ClassNotFoundException: img
at java.net.URLClassLoader$1.run(URLClassLoader.java: 200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.j ava:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:3 07)
at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:2 52)
at java.lang.ClassLoader.loadClassInternal(ClassLoade r.java:320)
Could not find the main class: img. Program will exit.
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 11-06-2009, 04:39 PM
RamyaSivakanth's Avatar
Senior Member
 
Join Date: Apr 2009
Location: Chennai
Posts: 589
Rep Power: 1
RamyaSivakanth is on a distinguished road
Default
u add .;let us see
set classpath= .;C:\Program Files\Java\jdk1.6.0_16\lib\tools.jar
__________________
Ramya
Bookmark Post in Technorati
Reply With Quote
  #7 (permalink)  
Old 11-06-2009, 04:43 PM
Member
 
Join Date: Feb 2009
Posts: 92
Rep Power: 0
rdtindsm is on a distinguished road
Default
class path should point to the directory containing the class file. In this case,
c:\wamp\www;

Semicolon may or may not be included. It would normally be included to make it easier to add the next class path item. Unix/linux uses a different delimiter, but the c:/ path indicates windows system.
Bookmark Post in Technorati
Reply With Quote
  #8 (permalink)  
Old 11-06-2009, 04:45 PM
RamyaSivakanth's Avatar
Senior Member
 
Join Date: Apr 2009
Location: Chennai
Posts: 589
Rep Power: 1
RamyaSivakanth is on a distinguished road
Default
He is asking windows classpath.my solution will workout
__________________
Ramya
Bookmark Post in Technorati
Reply With Quote
  #9 (permalink)  
Old 11-06-2009, 05:40 PM
Member
 
Join Date: Oct 2009
Posts: 56
Rep Power: 0
dudejonne is on a distinguished road
Default
it did, thanks
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ftpclient abort download Papalazarou New To Java 0 01-06-2009 05:18 PM
Download JDK 1.5 Nick15 New To Java 4 01-01-2009 04:10 AM
What jdk do I download? padutch2 New To Java 3 11-29-2007 05:28 AM
problems sun.net.ftp.FtpClient tommy Advanced Java 1 08-06-2007 05:01 AM
I could download JDK 1.5 Albert New To Java 2 07-13-2007 04:36 PM


All times are GMT +2. The time now is 02:27 AM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org