Results 1 to 6 of 6
  1. #1
    jklsemicolon is offline Member
    Join Date
    Aug 2008
    Posts
    15
    Rep Power
    0

    Default Difference between browswer and appletviewer?

    So i built an applet that imports a couple other classes and when i go to the command prompt and use 'appletviewer Applet.html' it works fine. But when I actually launch Applet.html it doesnt load the applet and says that the applet is notinited.

    The java console says that there is some NoClassDefFoundError's and a ClassNotFoundException (and some nullpointer and security stuff but I think that is a result of this problem). The class that it is looking for is called Client$1 (I have a class called Client.class) but Client$1.class is in the folder but I didn't make it.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,308
    Rep Power
    25

    Default

    That stuff is important. Please copy and paste all of the java console error messages here.
    The Client$1 is an anonymous class that can be generated by the compiler. Be sure to copy all the classes generated by the compiler to the folder where you are trying to load the HTML page with the applet tag.

  3. #3
    jklsemicolon is offline Member
    Join Date
    Aug 2008
    Posts
    15
    Rep Power
    0

    Default

    I think the files are all in the right place because the appletviewer can find them..


    java.lang.NoClassDefFoundError: Client$1
    at Client.<init>(Client.java:20)
    at ClientApplet.init(ClientApplet.java:13)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.ClassNotFoundException: Client$1
    at sun.applet.AppletClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.applet.AppletClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    ... 4 more
    java.net.ConnectException: Connection refused: connect
    Exception in thread "Thread-15" java.lang.NullPointerException
    at sun.plugin.util.AnimationPanel.createTranslucentIm age(Unknown Source)
    at sun.plugin.util.AnimationPanel.createGradientShape Image(Unknown Source)
    at sun.plugin.util.AnimationPanel.initBackground(Unkn own Source)
    at sun.plugin.util.AnimationPanel.preloadResources(Un known Source)
    at sun.plugin.util.AnimationPanel.doPaint(Unknown Source)
    at sun.plugin.util.AnimationPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Exception in thread "AWT-EventQueue-3" java.lang.NullPointerException
    at Client.processMessage(Client.java:40)
    at Client.access$000(Client.java:7)
    at Client$1.actionPerformed(Client.java:22)
    at java.awt.TextField.processActionEvent(Unknown Source)
    at java.awt.TextField.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilter s(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(U nknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarch y(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
    java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:12645 connect,resolve)
    at java.security.AccessControlContext.checkPermission (Unknown Source)
    at java.security.AccessController.checkPermission(Unk nown Source)
    at java.lang.SecurityManager.checkPermission(Unknown Source)
    at java.lang.SecurityManager.checkConnect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at Client.<init>(Client.java:26)
    at ClientApplet.init(ClientApplet.java:13)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Exception in thread "Thread-22" java.lang.NullPointerException
    at sun.plugin.util.AnimationPanel.createTranslucentIm age(Unknown Source)
    at sun.plugin.util.AnimationPanel.createGradientShape Image(Unknown Source)
    at sun.plugin.util.AnimationPanel.initBackground(Unkn own Source)
    at sun.plugin.util.AnimationPanel.preloadResources(Un known Source)
    at sun.plugin.util.AnimationPanel.doPaint(Unknown Source)
    at sun.plugin.util.AnimationPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:12645 connect,resolve)
    at java.security.AccessControlContext.checkPermission (Unknown Source)
    at java.security.AccessController.checkPermission(Unk nown Source)
    at java.lang.SecurityManager.checkPermission(Unknown Source)
    at java.lang.SecurityManager.checkConnect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at Client.<init>(Client.java:26)
    at ClientApplet.init(ClientApplet.java:13)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:12645 connect,resolve)
    at java.security.AccessControlContext.checkPermission (Unknown Source)
    at java.security.AccessController.checkPermission(Unk nown Source)
    at java.lang.SecurityManager.checkPermission(Unknown Source)
    at java.lang.SecurityManager.checkConnect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at Client.<init>(Client.java:26)
    at ClientApplet.init(ClientApplet.java:13)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:12645 connect,resolve)
    at java.security.AccessControlContext.checkPermission (Unknown Source)
    at java.security.AccessController.checkPermission(Unk nown Source)
    at java.lang.SecurityManager.checkPermission(Unknown Source)
    at java.lang.SecurityManager.checkConnect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at Client.<init>(Client.java:26)
    at ClientApplet.init(ClientApplet.java:13)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:12645 connect,resolve)
    at java.security.AccessControlContext.checkPermission (Unknown Source)
    at java.security.AccessController.checkPermission(Unk nown Source)
    at java.lang.SecurityManager.checkPermission(Unknown Source)
    at java.lang.SecurityManager.checkConnect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at Client.<init>(Client.java:26)
    at ClientApplet.init(ClientApplet.java:13)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:12645 connect,resolve)
    at java.security.AccessControlContext.checkPermission (Unknown Source)
    at java.security.AccessController.checkPermission(Unk nown Source)
    at java.lang.SecurityManager.checkPermission(Unknown Source)
    at java.lang.SecurityManager.checkConnect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at Client.<init>(Client.java:26)
    at ClientApplet.init(ClientApplet.java:13)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:12645 connect,resolve)
    at java.security.AccessControlContext.checkPermission (Unknown Source)
    at java.security.AccessController.checkPermission(Unk nown Source)
    at java.lang.SecurityManager.checkPermission(Unknown Source)
    at java.lang.SecurityManager.checkConnect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at Client.<init>(Client.java:26)
    at ClientApplet.init(ClientApplet.java:13)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    java.lang.NoClassDefFoundError: Client$1
    at Client.<init>(Client.java:20)
    at ClientApplet.init(ClientApplet.java:13)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    java.lang.NoClassDefFoundError: Client$1
    at Client.<init>(Client.java:20)
    at ClientApplet.init(ClientApplet.java:13)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    java.lang.NoClassDefFoundError: Client$1
    at Client.<init>(Client.java:20)
    at ClientApplet.init(ClientApplet.java:13)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    java.lang.NoClassDefFoundError: Client$1
    at Client.<init>(Client.java:20)
    at ClientApplet.init(ClientApplet.java:13)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    java.lang.NoClassDefFoundError: Client$1
    at Client.<init>(Client.java:20)
    at ClientApplet.init(ClientApplet.java:13)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    java.lang.NoClassDefFoundError: Client$1
    at Client.<init>(Client.java:20)
    at ClientApplet.init(ClientApplet.java:13)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    java.lang.NoClassDefFoundError: Client$1
    at Client.<init>(Client.java:20)
    at ClientApplet.init(ClientApplet.java:13)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    java.lang.NoClassDefFoundError: Client$1
    at Client.<init>(Client.java:20)
    at ClientApplet.init(ClientApplet.java:13)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    java.lang.NoClassDefFoundError: Client$1
    at Client.<init>(Client.java:20)
    at ClientApplet.init(ClientApplet.java:13)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    java.lang.NoClassDefFoundError: Client$1
    at Client.<init>(Client.java:20)
    at ClientApplet.init(ClientApplet.java:13)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    java.lang.NoClassDefFoundError: Client$1
    at Client.<init>(Client.java:20)
    at ClientApplet.init(ClientApplet.java:13)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    java.lang.NoClassDefFoundError: Client$1
    at Client.<init>(Client.java:20)
    at ClientApplet.init(ClientApplet.java:13)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    java.lang.NoClassDefFoundError: Client$1
    at Client.<init>(Client.java:20)
    at ClientApplet.init(ClientApplet.java:13)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    java.lang.NoClassDefFoundError: Client$1
    at Client.<init>(Client.java:20)
    at ClientApplet.init(ClientApplet.java:13)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,308
    Rep Power
    25

    Default

    Are you running the appletviewer and the browser while in the same folder on the same machine? No server or anything else?
    Connection refused: connect
    Why are you getting the above message? Or the following?????
    (java.net.SocketPermission 127.0.0.1:12645 connect,resolve)
    Looks like there's other software involved.

  5. #5
    jklsemicolon is offline Member
    Join Date
    Aug 2008
    Posts
    15
    Rep Power
    0

    Default

    Yeah same machine and folder no servers (yet)

    The program is an online chat server. I'm running a file (clientapplet.class) that uses client.class and connects to server.class with sockets. Server.class runs continually in the background (it was running when I got this error message) and it distributes the message to all instances of the client applet.

    The socket permission thing is accessing myself on a port that i randomly chose.

  6. #6
    jklsemicolon is offline Member
    Join Date
    Aug 2008
    Posts
    15
    Rep Power
    0

    Default

    Well I copied the .java files to a new location and recompiled them and now it works... go figure

    Thanks for the help Norm


    I figured it out if anyone has the same problem - all the files must be in a folder with the same name as the class
    Last edited by jklsemicolon; 08-16-2008 at 04:03 AM.

Similar Threads

  1. Difference between StringBuilder & StringBuffer
    By Pooja Deshpande in forum New To Java
    Replies: 5
    Last Post: 04-16-2008, 12:51 PM
  2. Difference between Throws and Throw
    By Poonam in forum New To Java
    Replies: 7
    Last Post: 02-06-2008, 04:52 PM
  3. Difference between ASP and JSP
    By barney in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 08-07-2007, 07:15 AM
  4. difference between this and super
    By mrark in forum New To Java
    Replies: 1
    Last Post: 06-27-2007, 05:23 PM
  5. Difference between error and exception
    By harinath chakrapani in forum New To Java
    Replies: 1
    Last Post: 06-19-2007, 08:49 AM

Posting Permissions

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