Results 1 to 2 of 2

Thread: classnotfound

  1. #1
    mirror666 is offline Member
    Join Date
    Nov 2008
    Posts
    1
    Rep Power
    0

    Default 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 :
    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.
    error message from java console ( when i run it in 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)
    this is the html ( how i'm running it through a webpage :
    Java Code:
    <html>
     <applet applet code="sender.class" width=300 height=120>
     </applet>
     </html>
    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.
    any help would be greatly appreciated.
    Attached Files Attached Files

  2. #2
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    7

    Default

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •