Java chat applet

can any body hlp me....
i want to crate java chat applet i dont hav any idea plz hlp me
looking for +v response.                                                                                                                                                                                                                               

mail me for complete code
[email protected]
Vipin

Similar Messages

  • Java Chat applet won't send messages

    So i got a brand new MacBook Air yesterday with Mac OS X 10.8.2 and installed Java 7 Update 9 from Oracle.
    When using Safari 6 i run into a problem with a browser based Java chat applet.
    First of all: Java and Javascript are actibated in Safari.
    So I go to the chat's website and start the chat.
    Java works fine at first and the chat starts.
    People can send me private messages and i can type in a reply.
    However I cannot send these replies. Neither in the private messages (applet) nor in the main chat (browser).
    Any idea how to fix this issue?
    (BTW: Java 7 was the first Java ever installed on my Air, so no going back to Apples Java 6)

    And Java 7 Update 10 did not solve the problem either.
    Can anybody offer any ideas for a solution?
    Help would be much appreciated.

  • Problem loading the chat applet, red x mark sign..

    Hello all - hopefully this is the correct place for this post. I've been trying to load a java enabled chat room, and keep getting a red X in the top left corner (java applet failed, etc).
    Java chat applet fails to load in the following website www.chat-web.com, but loads in the other websites. the following is the version i have installed in my computer. Version 6 Update 12 (build 1.6.0_12-b04). I have visited the help section of the website in which java applet fails to load and tried all the following steps,
    1) I cleared all the temp files from the internet options.
    2) cleared the cache in the java plug-in
    3) disabled the pop-up blocker
    insipite of the above steps the problem still persists..
    here is a screen shot of the error > http://i42.tinypic.com/2pzwhvp.jpg
    here is the details of the error :
    Java Plug-in 1.6.0_12
    Using JRE version 1.6.0_12 Java HotSpot(TM) Client VM
    User home directory = C:\Users\Guest
    c: clear console window
    f: finalize objects on finalization queue
    g: garbage collect
    h: display this help message
    l: dump classloader list
    m: print memory usage
    o: trigger logging
    q: hide console
    r: reload policy configuration
    s: dump system and deployment properties
    t: dump thread list
    v: dump thread stack
    x: clear classloader cache
    0-5: set trace level to <n>
    load: class com.chatspace.v20090.Chat not found.
    java.lang.ClassNotFoundException: com.chatspace.v20090.Chat
         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)
    Caused by: java.net.ConnectException: Connection timed out: connect
         at java.net.PlainSocketImpl.socketConnect(Native Method)
         at java.net.PlainSocketImpl.doConnect(Unknown Source)
         at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
         at java.net.PlainSocketImpl.connect(Unknown Source)
         at java.net.SocksSocketImpl.connect(Unknown Source)
         at java.net.Socket.connect(Unknown Source)
         at sun.net.NetworkClient.doConnect(Unknown Source)
         at sun.net.www.http.HttpClient.openServer(Unknown Source)
         at sun.net.www.http.HttpClient.openServer(Unknown Source)
         at sun.net.www.http.HttpClient.<init>(Unknown Source)
         at sun.net.www.http.HttpClient.New(Unknown Source)
         at sun.net.www.http.HttpClient.New(Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
         at java.net.HttpURLConnection.getResponseCode(Unknown Source)
         at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
         at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
         at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         ... 7 more
    Exception: java.lang.ClassNotFoundException: com.chatspace.v20090.Chat
    Does this look like a chat room error? I think my side is fine, but I could be wrong. I'm not the best technical person, but just know the basics.
    Anyone have any ideas?
    Thanks!
    livelife

    Hi. Thank you for reply. I tried the steps suggested by you, but it still shows the same errors, i e-mailed to chat-web.com as well but seems the e-mail is invalid. i tried to load the chat rooms in my desktop pc too, i get the same error,
    Java Plug-in 1.6.0_13
    Using JRE version 1.6.0_13 Java HotSpot(TM) Client VM
    User home directory = C:\Documents and Settings\Intel
    c: clear console window
    f: finalize objects on finalization queue
    g: garbage collect
    h: display this help message
    l: dump classloader list
    m: print memory usage
    o: trigger logging
    q: hide console
    r: reload policy configuration
    s: dump system and deployment properties
    t: dump thread list
    v: dump thread stack
    x: clear classloader cache
    0-5: set trace level to <n>
    load: class com.chatspace.v20090.Chat not found.
    java.lang.ClassNotFoundException: com.chatspace.v20090.Chat
         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)
    Caused by: java.net.SocketException: Network is unreachable: connect
         at java.net.PlainSocketImpl.socketConnect(Native Method)
         at java.net.PlainSocketImpl.doConnect(Unknown Source)
         at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
         at java.net.PlainSocketImpl.connect(Unknown Source)
         at java.net.SocksSocketImpl.connect(Unknown Source)
         at java.net.Socket.connect(Unknown Source)
         at sun.net.NetworkClient.doConnect(Unknown Source)
         at sun.net.www.http.HttpClient.openServer(Unknown Source)
         at sun.net.www.http.HttpClient.openServer(Unknown Source)
         at sun.net.www.http.HttpClient.<init>(Unknown Source)
         at sun.net.www.http.HttpClient.New(Unknown Source)
         at sun.net.www.http.HttpClient.New(Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
         at java.net.HttpURLConnection.getResponseCode(Unknown Source)
         at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
         at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
         at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         ... 7 more
    Exception: java.lang.ClassNotFoundException: com.chatspace.v20090.Chat
    lifelive

  • I need help on steps on working and building chat applet

    is there a site where you can get some codes on building java chat applet?
    whats the easiest thing to do on making a chat server?

    java.sun.com has one.
    Check out the client and server source here:
    http://developer.java.sun.com/developer/technicalArticl
    s/InnerWorkings/Burrowing/SimpleChatApplet.java
    http://developer.java.sun.com/developer/technicalArticl
    s/InnerWorkings/Burrowing/SimpleChatServer.java
    Enjoy.
    ~Markhi mark! i'm sorry for the silly question i'm asking...
    i have compiled the two source code u suggest, but...
    i don't know what to do with them. i put the code of
    applet in a html, and i run the server on port 6006.
    do u need a web server? i've tryed to load
    http://localhost/chat.html and i see the page but also
    the error of communication.. so i put the :6006 but
    i have the error page... what do i need? help, please..
    thanks

  • Trying to produce a java chat server

    Would like produce a working client/server chat system, as basic as possible but able to listen and talk to each other. Any chat servers how-to examples I've come across never seem to work.
    Would like to understand why applets don't work when I open the web page but do work when I view using the appletviewer. I use Internet Explorer 4 i think, java version 1.3.0_02
    would you understand at least part of this error which appears when I run a chat server
    exception:com.ms.security.SecurityExceptionEx[Client.<int>]:cannot access "194.81.104.26":5660
    (the error is all one line no spaces)
    the following code is one of the programs I've been working on and I receive the above error, appletviewer doesn't work so i think that means something is wrong with the code, client side as the server side works well, it listens etc
    // Client side
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.net.*;
    public class Client extends Panel implements Runnable
    // Components for the visual display of the chat windows
    private TextField tf = new TextField();
    private TextArea ta = new TextArea();
    // The socket connecting us to the server
    private Socket socket;
    // The streams we communicate to the server; these come
    // from the socket
    private DataOutputStream dout;
    private DataInputStream din;
    // Constructor
    public Client( String host,int port ) {
    // Set up the screen
    setLayout( new BorderLayout() );
    add( "North", tf );
    add( "Center", ta );
    // Receive messages when someone types a line
    // and hits return, using an anonymous class as
    // a callback
    tf.addActionListener( new ActionListener() {
    public void actionPerformed( ActionEvent e ) {
    processMessage( e.getActionCommand() );
    // Connect to the server
    try {
    // Initiate the connection
    socket = new Socket( host, port );
    // Recieved a connection
    System.out.println( "connected to "+socket );
    // Create DataInput/Output streams
    din = new DataInputStream( socket.getInputStream() );
    dout = new DataOutputStream( socket.getOutputStream() );
    // Start a background thread for receiving messages
    new Thread( this ).start();
    } catch( IOException ie ) { System.out.println( ie ); }
    // Called when the user types something
    private void processMessage( String message ) {
    try {
    // Send it to the server
    dout.writeUTF( message );
    // Clear out text input field
    tf.setText( "" );
    } catch( IOException ie ) { System.out.println( ie ); }
    // Background thread runs this: show messages from other window
    public void run() {
    try {
    // Receive messages one-by-one, forever
    while (true) {
    // Get the next message
    String message = din.readUTF();
    // Print it to our text window
    ta.append( message+"\n" );
    } catch( IOException ie ) { System.out.println( ie ); }
    // ClientApplet
    import java.applet.*;
    import java.awt.*;
    import java.io.*;
    import java.net.*;
    public class ClientApplet extends Applet
    public void init() {
    //String host = getParameter( "host" );
         String host="194.81.104.26";
         //int port = Integer.parseInt( getParameter( "port" ) );
         int port =5660;
    setLayout( new BorderLayout() );
    add( "Center", new Client( host, port ) );
    // server
    import java.io.*;
    import java.net.*;
    import java.util.*;
    public class Server
    // The ServerSocket is used for accepting new connections
    private ServerSocket ss;
    // A mapping from sockets to DataOutputStreams. This will
    // help us avoid having to create a DataOutputStream each time
    // we want to write to a stream.
    private Hashtable outputStreams = new Hashtable();
    // Constructor and while-accept loop all in one.
    public Server( int port ) throws IOException {
    // listening
    listen( port );
    private void listen( int port ) throws IOException {
    // Create the ServerSocket
    ss = new ServerSocket( port);
    // ServerSocket is listening
    System.out.println( "Listening on "+ss );
    // Keep accepting connections forever
    while (true) {
    // The next incoming connection
    Socket s = ss.accept();
    // Connection
    System.out.println( "Connection from "+s );
    // Create a DataOutputStream for writing data to the
    // other side
    DataOutputStream dout = new DataOutputStream( s.getOutputStream() );
    // Save this stream so we don't need to make it again
    outputStreams.put( s, dout );
    // Create a new thread for this connection, and then forget
    // about it
    new ServerThread( this, s );
    // Get an enumeration of all the OutputStreams, one for each client
    // connected to us
    Enumeration getOutputStreams() {
    return outputStreams.elements();
    // Send a message to all clients (utility routine)
    void sendToAll( String message ) {
    // We synchronise on this because another thread might be
    // calling removeConnection()
    synchronized( outputStreams ) {
    // For each client ...
    for (Enumeration e = getOutputStreams(); e.hasMoreElements(); ) {
    // ... get the output stream ...
    DataOutputStream dout = (DataOutputStream)e.nextElement();
    // ... and send the message
    try {
    dout.writeUTF( message );
    } catch( IOException ie ) { System.out.println( ie ); }
    // Remove a socket, and it's corresponding output stream, from our
    // list. This is usually called by a connection thread that has
    // discovered that the connectin to the client is dead.
    void removeConnection( Socket s ) {
    // Synchronise so sendToAll() is okay while it walks
    // down the list of all output streams
    synchronized( outputStreams ) {
    // Removing connection
    System.out.println( "Removing connection to "+s );
    // Remove it from our hashtable/list
    outputStreams.remove( s );
    // Make sure it's closed
    try {
    s.close();
    } catch( IOException ie ) {
    System.out.println( "Error closing "+s );
    ie.printStackTrace();
    // Main routine
    // Usage: java Server <port>
    static public void main( String args[] ) throws Exception {
    // Get the port # from the command line
    int port = Integer.parseInt( args[0] );
         //int port = 5000;
    // Create a Server object, which will automatically begin
    // accepting connections.
    new Server( port);
    // ServerThread
    import java.io.*;
    import java.net.*;
    public class ServerThread extends Thread
    // The Server that spawned
    private Server server;
    // The Socket connected to our client
    private Socket socket;
    // Constructor.
    public ServerThread( Server server, Socket socket ) {
    // Save the parameters
    this.server = server;
    this.socket = socket;
    // Start up the thread
    start();
    // This runs in a separate thread when start() is called in the
    // constructor.
    public void run() {
    try {
    // Create a DataInputStream for communication; the client
    // is using a DataOutputStream to write to us
    DataInputStream din = new DataInputStream( socket.getInputStream() );
    // Over and over, forever ...
    while (true) {
    // ... read the next message ...
    String message = din.readUTF();
    // ... sending printed to screen ...
    System.out.println( "Sending "+message );
    // ... and have the server send it to all clients
    server.sendToAll( message );
    } catch( EOFException ie ) {
    // This doesn't need an error message
    } catch( IOException ie ) {
    // This needs an error message
    ie.printStackTrace();
    } finally {
    // The connection is closed for one reason or another,
    // so have the server dealing with it
    server.removeConnection( socket );
    <body bgcolor="#FFFFFF">
    <applet code="ClientApplet" width=600 height=400>
    <param name=host value="127.0.0.1">
    <param name=port value="5660">
    [Chat applet]
    </applet>
    </body>

    Hi!
    Go to
    http://www.freecode.com/projects/jchat-java2clientserverchatmodule/
    probably u will het the answer..
    Jove

  • Chat Applet using RMI .... trouble running the Applet using the IE browser.

    Hi,
    I'm trying to run a chat application using RMI technology. Actually, this wasn't created from the scratch. I got this one from from the cd that comes with the book I bought and I did some refinements on it to suit what I wanted to:
    These are the components of the chat application:
    1. RApplet.html - invokes the applet
    html>
    <head>
    <title>Sample Applet Using Dialog Box (1.0.2) - example 1</title>
    </head>
    <body>
    <h1>The Sample Applet</h1>
    <applet code="RApplet.class" width=460 height=160>
    </applet>
    </body>
    </html>
    2. RApplet.java - Chat session client applet.
    import java.rmi.*;
    import java.applet.*;
    import java.awt.event.*;
    import java.awt.*;
    import java.io.*;
    import java.rmi.server.*;
    //import ajp.rmi.*;
    public class RApplet extends Applet implements ActionListener {
    // The buttons
    Button sendButton;
    Button quitButton;
    Button startButton;
    Button clearButton;
    // The Text fields
    TextField nameField;
    TextArea typeArea;
    // The dialog for entering your name
    Dialog nameDialog;
    // The name the server knows us as
    String privateName;
    // The name we want to be known as in the chat session
    String publicName;
    // The remote chats erver
    ChatServer chatServer;
    // The ChatCallback
    ChatCallbackImplementation cCallback;
    // The main Chat window and its panels
    Frame mainFrame;
    Panel center;
    Panel south;
    public void init() {
    // Create class that implements ChatCallback.
    cCallback = new ChatCallbackImplementation();
         // Create the main Chat frame.
         mainFrame = new Frame("Chat Server on : " +
                        getCodeBase().getHost());
         mainFrame.setSize(new Dimension(600, 600));
         cCallback.displayArea = new TextArea();
         cCallback.displayArea.setEditable(false);
         typeArea = new TextArea();
         sendButton = new Button("Send");
         quitButton = new Button("Quit");
         clearButton = new Button("Clear");
         // Add the applet as a listener to the button events.
         clearButton.addActionListener(this);
         sendButton.addActionListener(this);
         quitButton.addActionListener(this);
         center = new Panel();
         center.setLayout(new GridLayout(2, 1));
         center.add(cCallback.displayArea);
         center.add(typeArea);
         south = new Panel();
         south.setLayout(new GridLayout(1, 3));
         south.add(sendButton);
         south.add(quitButton);
         south.add(clearButton);
         mainFrame.add("Center", center);
         mainFrame.add("South", south);
         center.setEnabled(false);
         south.setEnabled(false);
         mainFrame.show();
         // Create the login dialog.
         nameDialog = new Dialog(mainFrame, "Enter Name to Logon: ");
         startButton = new Button("Logon");
         startButton.addActionListener(this);
         nameField = new TextField();
         nameDialog.add("Center", nameField);
         nameDialog.add("South", startButton);
         try {
         // Export ourselves as a ChatCallback to the server.
         UnicastRemoteObject.exportObject(cCallback);
         // Get the remote handle to the server.
         chatServer = (ChatServer)Naming.lookup("//" + "WW7203052W2K" +
                                  "/ChatServer");
         catch(Exception e) {
         e.printStackTrace();
         nameDialog.setSize(new Dimension(200, 200));
         nameDialog.show();
    * Handle the button events.
    public void actionPerformed(ActionEvent e) {
         if (e.getSource().equals(startButton)) {
         try {
              nameDialog.setVisible(false);;
              publicName = nameField.getText();
              privateName = chatServer.register(cCallback, publicName);
              center.setEnabled(true);
              south.setEnabled(true);
              cCallback.displayArea.setText("Connected to chat server as: " +
                             publicName);
              chatServer.sendMessage(privateName, publicName +
                             " just connected to server");
         catch(Exception ex) {
              ex.printStackTrace();
         else if (e.getSource().equals(quitButton)) {
         try {
              cCallback.displayArea.setText("");
              typeArea.setText("");
              center.setEnabled(false);
              south.setEnabled(false);
              chatServer.unregister(privateName);
              nameDialog.show();
         catch(Exception ex) {
              ex.printStackTrace();
         else if (e.getSource().equals(sendButton)) {
         try{
              chatServer.sendMessage(privateName, typeArea.getText());
              typeArea.setText("");
         catch(Exception ex) {
              ex.printStackTrace();
         else if (e.getSource().equals(clearButton)) {
         cCallback.displayArea.setText("");
    public void destroy() {
         try {
         super.destroy();
         mainFrame.setVisible(false);;
         mainFrame.dispose();
         chatServer.unregister(privateName);
         catch(Exception e) {
         e.printStackTrace();
    3. Chatcallback.java - interface used by clients to connect to the server.
    import java.rmi.*;
    public interface ChatCallback extends Remote {
    public void addMessage(String publicName,
                   String message) throws RemoteException;
    4. ChatcallbackImplementation.java - implements Chatcallback interface.
    import java.rmi.*;
    import java.io.*;
    import java.awt.event.*;
    import java.awt.*;
    public class ChatCallbackImplementation implements ChatCallback {
    // The buttons
    // The Text fields
    TextArea displayArea;
    public void addMessage(String publicName,
                   String message) throws RemoteException {
    displayArea.append("\n" + "[" + publicName + "]: " + message);
    5. Chatserver.java - interface for the chat server.
    import java.rmi.*;
    import java.io.*;
    public interface ChatServer extends Remote {
    public String register(ChatCallback object,
                   String publicName) throws RemoteException;
    * Remove the client associated with the specified registration string.
    * @param registeredString the string returned to the client upon registration.
    public void unregister(String registeredString) throws RemoteException;
    * The client is sending new data to the server.
    * @param assignedName the string returned to the client upon registration.
    * @param data the chat data.
    public void sendMessage(String registeredString, String message) throws RemoteException;
    6. ChatServerImplementation.java - implements Chatserver interface.
    import java.rmi.*;
    import java.util.*;
    import java.rmi.server.*;
    import java.io.*;
    * A class that bundles the ChatCallback reference with a public name used
    * by the client.
    class ChatClient {
    private ChatCallback callback;
    private String publicName;
    ChatClient(ChatCallback cbk, String name) {
         callback = cbk;
         publicName = name;
    // returns the name.
    String getName() {
         return publicName;
    // returns a reference to the callback object.
    ChatCallback getCallback() {
         return callback;
    public class ChatServerImplementation extends UnicastRemoteObject
    implements ChatServer {
    // The table of clients connected to the server.
    Hashtable clients;
    // Tne number of current connections to the server.
    private int currentConnections;
    // The maximum number of connections to the server.
    private int maxConnections;
    // The output stream to write messages to.
    PrintWriter writer;
    * Create a ChatServer.
    * @param maxConnections the total number if connections allowed.
    public ChatServerImplementation(int maxConnections) throws RemoteException {
         clients = new Hashtable(maxConnections);
         this.maxConnections = maxConnections;
    * Increment the counter keeping track of the number of connections.
    synchronized boolean incrementConnections() {
         boolean ret = false;
         if (currentConnections < maxConnections) {
         currentConnections++;
         ret = true;
         return ret;
    * Decrement the counter keeping track of the number of connections.
    synchronized void decrementConnections() {
         if (currentConnections > 0) {
         currentConnections--;
    * Register with the ChatServer, with a String that publicly identifies
    * the chat client. A String that acts as a "magic cookie" is returned
    * and is sent by the client on future remote method calls as a way of
    * authenticating the client request.
    * @param object The ChatCallback object to be used for updates.
    * @param publicName The String the object would like to be known as.
    * @return The actual String assigned to the object for removing, etc. or
    * null if the client could not register.
    public synchronized String register(ChatCallback object, String publicString) throws RemoteException {
         String assignedName = null;
         if (incrementConnections()) {
         ChatClient client = new ChatClient(object, publicString);
         assignedName = "" + client.hashCode();
         clients.put(assignedName, client);
         out("Added callback for: " + client.getName());
         return assignedName;
    * Remove the client associated with the specified registration string.
    * @param registeredString the string returned to the client upon registration.
    public synchronized void unregister(String registeredString) throws RemoteException {
         ChatCallback cbk;
         ChatClient sender;
         if (clients.containsKey(registeredString)) {
         ChatClient c = (ChatClient)clients.remove(registeredString);
         decrementConnections();
         out("Removed callback for: " + c.getName());
         for (Enumeration e = clients.elements(); e.hasMoreElements(); ) {
              cbk = ((ChatClient)e.nextElement()).getCallback();
              cbk.addMessage("ChatServer",
                        c.getName() + " has left the building...");
         else {
         out("Illegal attempt at removing callback (" + registeredString + ")");
    * Sets the logging stream.
    * @param out the stream to log messages to.
    protected void setLogStream(Writer out) throws RemoteException {
         writer = new PrintWriter(out);
    * The client is sending new message to the server.
    * @param assignedName the string returned to the client upon registration.
    * @param data the chat data.
    public synchronized void sendMessage(String registeredString, String message) throws RemoteException {
         ChatCallback cbk;
         ChatClient sender;
         try {
         out("Recieved from " + registeredString);
         out("Message: " + message);
         if (clients.containsKey(registeredString)) {
              sender = (ChatClient)clients.get(registeredString);
              for (Enumeration e = clients.elements(); e.hasMoreElements(); ) {
                   cbk = ((ChatClient)e.nextElement()).getCallback();
                   cbk.addMessage(sender.getName(), message);
         else {
              out("Client " + registeredString+ " not registered");
         catch(Exception ex){
         out("Exception thrown in newData: " + ex);
         ex.printStackTrace(writer);
         writer.flush();
    * Write s string to the current logging stream.
    * @param message the string to log.
    protected void out(String message){
         if(writer != null){
         writer.println(message);
         writer.flush();
    * Start up the Chat server.
    public static void main(String args[]) throws Exception {
         try {
         // Create the security manager
         System.setSecurityManager(new RMISecurityManager());
         // Instantiate a server
         ChatServerImplementation c = new ChatServerImplementation(10);
         // Set the output stream of the server to System.out
         c.setLogStream(new OutputStreamWriter(System.out));
         // Bind the server's name in the registry
         Naming.rebind("//" + args[0] + "/ChatServer", c);
         c.out("Bound in registry.");
         catch (Exception e) {
         System.out.println("ChatServerImplementation error:" +
                        e.getMessage());
         e.printStackTrace();
    Using my own machine (connected to a network), I tried to test this one out by setting mine as the server and also the client. I did the following:
    1. Compile the source code.
    2. Use rmic to generate the skeletons and/or stubs from the ChatCallbackImplementation and ChatServerImplementation.
    3. Start the rmiregistry with no CLASSPATH
    4. Start the server successfully.
    5. Start the applet using the AppletViewer command.
    It worked fined.
    The problem is when I ran the applet using the browser, IE explorer, the dialog boxes, frame and buttons did appear. I was able to do the part of logging on. But after that, the applet seemed to have hang. No message appeared that says I'm connected (which appeared using the appletviewer). I clicked the send button. No response.
    I double-checked my classpath. I did have my classpath set correctly. I'm still trying to figure out the problem. Up to now, I don't have any clue what it is.
    I will appreciate much if someone can help me figure what's could have possibly been wrong ....
    Thanks a lot ...

    Hi Domingo,
    I had a similar problem running applet/rmi with IE.
    Looking in IE..view..JavaConsole error messages my applet was unable to find java.rmi.* classes.
    I checked over java classes in msJVM, they're not present.
    ( WinZip C:\WINDOWS\JAVA\Packages\9rl3f9ft.zip and others from msVM installed )
    ( do not contain the java.rmi.* packages )
    I have downloaded and installed the latest msJVM for IE5. ( I think its included in later versions)
    @http://www.objectweb.org/rmijdbc/RJfaq.html I found ref to rmi.zip download to provide
    these classes. I couldn't get the classes from the site but I managed to find a ref to IBM
    site @http://alphaworks.ibm.com/aw.nsf/download/rmi which had similar download.
    The download however didn't solve my problems. I was unable to install rmi.zip with
    RmiPatch.exe install.
    I solved this by extracting the class files from rmi.zip and installing them at C:\WINDOWS\JAVA\trustlib ( msJVM installation trusted classes lib defined in
    registry HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Java VM\TrustedLibsDirectory )
    This solved the problem. My rmi/applet worked.
    Hope this helps you.
    Chris
    ([email protected])

  • Chat applet

    hello,
    i developed a chat applet using JDK 1.3 .It is a swing applet.when i compile and run the applet ,it runs well inthe appletviewer.In IE ,it shows the following error "java.lang.ClassNotFoundException: javax.swing.JApplet".I think it needs java plugin.In JDK 1.3, javaplugin is already builtin.Then why it shows the above said error?.Kindly clarify the error.THIS IS VERY URGENT.

    i also have done that type of applicaton with messenger , if you use Only Applet
    then client side browser have also java plugin in defult and suport Applet but
    if you use JApplet then u should have to use java plugin which support Swing
    at client side.
    i come at this Forum some time, if you u have any problem then u can
    contect me at [email protected]
    OK ?

  • Applying images as skins in chat applet

    Hi,
    I have developed chat applet. I have implemented skins in that applet. But as colors. So how to apply images as diff skins.
    It is urgent.
    Please be polite and answer

    Good evening, sir, or madam, as the case may be,
    To correctly implement this, you must first learn how to load image files into an applet. Might I be so bold as to recommend that one look at the javax.swing.ImageIcon class, as it is endowed with constructors which facilitate the loading of images via a URL.
    Following that, I would then encourage you to learn how to take said loaded image and draw it on component. For this, I would recommend subclassing some component (JPanel, or some other suitable component), and override the paintComponent() method. The java.awt.Graphics class is supremely suited to perform drawing operations of this sort, as well as many others.
    Once you have successfully completed these tasks, then you will find that you have an applet which one can decorated with wonderful imagery from all corners of the world.
    Yours most sincerely,
    bsampieri

  • Java chat console not appearing

    hi there. please help. i am trying to use java chat console but cannot get it to work. i have tried everthing that the chat site tech asks of me, but still no luck. anyone else had this problem PLEASE let me know how u solved it.
    many thanks

    This isn't really a Java programming question... it's more a "something's disconfigured on someone's computer" question... but, just for fun, here are the things you need to check:
    Does your browser have a Java plug-in installed? Is the version of the Java plug-in compatible with the Java chat version the server is using? Do you have Java enabled in your browser? Do you have this problem with other Java applets from other sites, or only this one?
    I'd recommend upgrading your JVM (or downgrading it, if the site is really that broken), checking your browser settings, and possibly testing with another browser.
    Sincerely,
    Dylan

  • URGENT!! help on CHAT APPLET

    i've created a chat Applet as client. i want it to be used like this
    -user login
    -choose chat room
    -and start applet.
    what i've done now is chat applet. i want it to be used by multi user.
    and display online users name or username.
    but now it can only detect one user. if i run many applet concurrently using my pc, it can't detect other user's name.
    how to do that?
    please someone help me!!

    this is my codes.
    it can be compiled but nothing appears when i run appletviewer ChatApplet2.html
    what happen?
    import java.lang.*;
    import java.awt.*;
    import java.applet.*;
    import java.awt.event.*;
    import java.io.*;
    import java.net.*;
    public class ChatApplet2 extends Applet implements ActionListener,Runnable
    String user;
    String msg;
         String chatServer;
         ObjectOutputStream output;
         ObjectInputStream input;
         Socket client;
         public void init() {
              super.init();
              //{{INIT_CONTROLS
              setLayout(new BorderLayout(0,0));
              addNotify();
              resize(518,347);
              setBackground(new Color(12632256));
    displayArea = new java.awt.TextArea("",2,0,TextArea.SCROLLBARS_NONE);
              displayArea.setEditable(false);
    displayArea.disable();
    //displayArea.hide();
              displayArea.reshape(0,0,380,216);
              add(displayArea);
              idbox = new java.awt.TextField();
              idbox.reshape(84,288,284,24);
              add(idbox);
              button1 = new java.awt.Button("EnterRoom");
              button1.reshape(384,288,72,21);
              add(button1);
    list = new java.awt.List();
    //list.TOP_ALIGNMENT();
    //list.disable();
    list = new java.awt.List(5);
    list.add("#Default User"+"\n");
    list.reshape(384,24,128,196);
    list.setFont(new Font("Helvetica", Font.BOLD, 12));
    add(list);
              label2 = new java.awt.Label("Members");
              label2.reshape(396,0,100,19);
              add(label2);
              label1 = new java.awt.Label("UserName");
              label1.reshape(0,288,72,27);
              add(label1);
              enterField = new java.awt.TextField();
              enterField.reshape(84,240,431,44);
              add(enterField);
              label3 = new java.awt.Label("EnterText");
              label3.reshape(0,252,72,25);
              add(label3);
    //uf = new UserFrame();
              button1.addActionListener(this);
    idbox.addActionListener(this);
    enterField.addActionListener(this);
    list.addActionListener(this);
    public void actionPerformed(ActionEvent ae)
              if(ae.getSource()==idbox)
    user = idbox.getText()+"\n";
    list.addItem(user.trim());
    idbox.setText("");
              displayArea.append(user +" HAS JOINED THE GROUP");
         if(ae.getSource().equals(button1))
    user = idbox.getText()+"\n";
    list.addItem(user.trim());
    idbox.setText("");
              displayArea.append(user +" HAS JOINED THE GROUP");
    if(ae.getSource().equals(enterField))
    sendData(ae.getActionCommand() );
                   /*msg = enterField.getText();
    displayArea.append(msg +"\n");
    enterField.setText("");*/
    if(ae.getSource().equals(list))
    String l = list.getSelectedItem();
                             //uf.setTitle(l);
                             //Frame i[] = uf.getFrames();
                             //uf.setVisible(true);
    public void start()
              try {
         // Step 1: Create a Socket to make connection
         connectToServer();
         // Step 2: Get the input and output streams
         getStreams();
         // Step 3: Process connection
         processConnection();
         // Step 4: Close connection
         closeConnection();
         // server closed connection
              catch ( EOFException eofException ) {
         System.out.println( "Server terminated connection" );
         // process problems communicating with server
              catch ( IOException ioException ) {
         ioException.printStackTrace();
    if(vt == null)
    vt = new Thread(this,getClass().getName());
    vt.start();
    public void run()
    try{
    for(int i=0;i<10;i++)
    displayArea.append("One stop Java source code - www.globalleafs.com"+"\n");
    displayArea.setForeground(Color.red);
    vt.sleep(30000);
    vt.resume();
    }catch(Exception e){e.printStackTrace();}
         private void sendData( String msg )
              // send object to server
              try {
              output.writeObject( user + ">>> " + msg );
              output.flush();
              displayArea.append( "\nuser>>>" + msg );
              // process problems sending object
              catch ( IOException ioException ) {
              displayArea.append( "\nError writing object" );
         // get streams to send and receive data
         private void getStreams() throws IOException
              // set up output stream for objects
              output = new ObjectOutputStream(
              client.getOutputStream() );
              // flush output buffer to send header information
              output.flush();
              // set up input stream for objects
              input = new ObjectInputStream(
         client.getInputStream() );
              displayArea.append( "\nGot I/O streams\n" );
         // connect to server
         private void connectToServer() throws IOException
              displayArea.setText( "Attempting connection\n" );
              // create Socket to make connection to server
              client = new Socket(
         InetAddress.getByName( chatServer ), 5000 );
              // display connection information
              displayArea.append( "Connected to: " +
         client.getInetAddress().getHostName() );
         // process connection with server
         private void processConnection() throws IOException
              // enable enterField so client user can send messages
              enterField.setEnabled( true );
              // process messages sent from server
              do {
              // read message and display it
              try {
              msg = ( String ) input.readObject();
              displayArea.append( "\n" + msg );
              displayArea.setCaretPosition(
              displayArea.getText().length() );
              // catch problems reading from server
              catch ( ClassNotFoundException classNotFoundException ) {
              displayArea.append( "\nUnknown object type received" );
              } while ( !msg.equals( "SERVER>>> TERMINATE" ) );
         } // end method process connection
         // close streams and socket
         private void closeConnection() throws IOException
              displayArea.append( "\nClosing connection" );
              output.close();
              input.close();
              client.close();
         java.awt.TextArea displayArea;
         java.awt.TextField idbox;
         java.awt.Button button1;
    java.awt.List list;
    java.awt.Label label2;
         java.awt.Label label1;
         java.awt.TextField enterField;
         java.awt.Label label3;
    private Thread vt;

  • Problem in voice chat applet

    hi all,
    I am developing a Voice chat applet using java(JDK1.4,JMF). If i run my programs of transmitting voice and receiving voice from one machine to another machine(Without applet), its working fine.
    When i am sending voice from my server machine, and receiving on someother machine by application, its working fine.
    But if i am using my applet from some other machine(Other then server) its creating problems. Its showing some errors.
    Can you suggest some solutions??
    Thanks in advance.
    Abhishek

    hi,
    i also develop the voice chat application. can you send your source code to me. may be i can help you to solve your problems.
    my email is [email protected]

  • Voice Chat Applet

    Hey all,
    I want to develop a voice chat applet in Java. (similar to the one used in Yahoo chat rooms). I know basic Java, but I don't know where to start in developing an applet like this. I don't know what libraries or protocols I need to be focusing on. If anyone can offer me some advice or the steps necessary to create this applet, I would be very appreciative.
    Thank you,
    Khanathor

    Yeah, you would deserve thanks if
    1) I hadn't spent all day doing research.Sorry, but my mind-reading device wasn't working. So sorry that I couldn't tell that you had done that. Maybe it would have made a difference if you had done something like MENTIONING it in the first place.
    2) Your search query wasn't even what I was
    requesting assistance for.Oh, sorry again for not reading your mind as to what you were looking for other than a response for basically "I don't even know where to begin".
    3) Your response didn't so clearly reflect your
    arrogance.That's ok. Your post clearly reflected your lack of initiative and intelligence.

  • Java chat client behind the proxy or fire wall

    i am developing the chat application useing java.net.*.but i am not able to get connectivity behind the firewall or proxy on the java client.pls help me out

    to guarantee easy to use, no problem chat applet then you will need to have the chat server running on port 80 and the client use http request/response system
    first problem is that the applet will have to have been delivered from port 80 on the same ip# so you will either have to use Servlets or write your own web server with chat facilities
    you will need to maitain persistent/ pseudo persistent http connections for the server to deliver messages to clients, you can assume that a connection will remain open for ~ 5 minutes after a request from the client
    use HTTP/1.1 for reliable Connection: keep-alive and request/response pipelining
    with all that in place your client method is...
    register and send GET /chat <wait for upto 5 mins>
    if there is client activity send POST/chat <wait for upto 5 mins>
    if the above waits timeout send GET/chat <wait for upto 5mins>
    server method...
    accept GET/POST requests from client
    if there is chat to deliver, reply to most recent request from client
    if you recive another request before the previous one's reply is used, send a No Content reply to the previous request

  • Chat Applet locks up when connected to a server

    Hey, I am making a chat applet to reach out to IRC like servers. The problem I'm having is when it connects the program locks up till the server disconnect, then it prints the spool into my JTextArea.
    Now, and more bazaar, is that I cannot find a single instructor on the grounds of my tech school who can help me with networking java when 4 people teach in the damn format. Naturally, I'm very frustrated. Any help would be appreciated.

    The full code is at: [http://pastebin.com/m49fe14be|pastebin.com/m49fe14be]
    Naturally I'll be changing this again at least once when I figure out how to play this out.
    Where I'm having problems is: #
            public void connectOut(){
                    try{
                            connectionAddr = InetAddress.getByName(server);
                            connect = new Socket(server, port);
                            initiateReadWrite();
                            //threadRun();
                            //listener = new Thread();
                            //listener.start();
                            //while(listener.isAlive()){
                            readFromServer();
                            connect.setKeepAlive(true);
                    catch(Exception e){
                            exceptioner(e);
            }Or
            public synchronized void readFromServer(){
                    try{
                            String readin;
                            while((readin = in.readLine()) != null){
                                    scrolledText.append(readin + "\n");
                    catch(Exception e){
                            exceptioner(e);
                    }I'm utterly lost and cannot find anyone to help me at my technical college. Four instructors and not a one understands threading.

  • Is there free java chat, which i can embed in my Swing application

    Hello all,
    I have a Swing application and i want to embed java chat into it.
    Can you recommend me free chat for which i can see and modofy client and server sources.
    Regards,
    Chavdar

    No.

Maybe you are looking for

  • Error when trying to access the RBAC User editor and Message tracking

    Hi, I am getting an error when trying to access the RBAC User editor and Message tracking on the Web Mgmt interface. I verified that the admin account trying to access is in the Organization Management group and has the correct Role Assignment Policy

  • Add-on Failure

    Hey Gurus, We have developed an Add-on using the Add-on code generator wizard from the B1DE. The Add-on runs fine on machines, where Microsoft Visual Studio .Net 2005 is installed. But it crashes on the PCs, where .Net Framework 2.0 is installed prop

  • Exception in servermgr_accounts when creating open directory master...

    Just to give you some background, I'm new to Mac Os X Server. And I'm trying to get a mail/ical/web-server with "open directory" setup. The server is placed in a remote location, behind a NAT-firewall. I thought I hade everything setup, took a while

  • SAP ECC 6.0 retail

    Hello I am trying to find how to install SAP ECC 6.0 retail I am quite confused. . On one hand I can see there is note for IDES (1028572 - IDES ERP 2005 ECC 6.0 SR2 for Retail Industry) on the other SAP Note 1242830 - SAP Best Practices for Retail US

  • How to convert RAW images to JPG in Imagebrowser EX 1.4.0.5

    I installed ImagBrowser EX so I can view my raw images.  It works fine for viewing but I can't find how to convert them to raw images.  The manual and help file says to go to Edit > Process RAW Images but when I go to the edit menu, there is no such