Results 1 to 2 of 2
Thread: classnotfound
- 11-11-2008, 11:31 AM #1
Member
- Join Date
- Nov 2008
- Posts
- 1
- Rep Power
- 0
classnotfound
hi guys. im new to java and im trying to run in a webpage a particular application i found.
i can compile the class successfully ( java 6 update 10 ) with "javac sender.java" but when i try to run it both in the command line and through a webpage i get an error like this :
error when i run in it in the command line :
error message from java console ( when i run it in a webpage ) :Java Code:Exception in thread "main" java.lang.NoClassDefFoundError: sender (wrong name: net/sender) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:621) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12 4) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$000(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) Could not find the main class: sender. Program will exit.
this is the html ( how i'm running it through a webpage :Java Code:java.lang.NoClassDefFoundError: sender (wrong name: net/sender) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source) at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source) at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Exception: java.lang.NoClassDefFoundError: sender (wrong name: net/sender)
now i noticed this error is probably because of the "package net;" first line. but if comment it out, i will get other errors when running the app.Java Code:<html> <applet applet code="sender.class" width=300 height=120> </applet> </html>
any help would be greatly appreciated.
- 11-11-2008, 02:54 PM #2
packaging
I take out the packaging statements, then build in NetBeans with them in place after I get the program running.
Sounds like a package && classpath issue, I never did get that working correctly and just work manually to avoid all the convoluted crannies.Introduction to Programming Using Java.
Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks