Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8922657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:53:57+00:00 2026-06-15T06:53:57+00:00

I am creating a simplechat app with RMI, But I am not able recognize

  • 0

I am creating a simplechat app with RMI, But I am not able recognize that where the exact problem is?
This is my code:

ChatServer.java

import java.awt.Point;
import java.net.MalformedURLException;
import java.rmi.AlreadyBoundException;
import java.rmi.Naming;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author nick
 */
public class ChatServer extends UnicastRemoteObject implements IChat{

    ArrayList<String> list = new ArrayList<String>();

    public ChatServer() throws RemoteException{
        try {
            Naming.bind("//localhost:1099/chat", this);
        } catch (Exception ex) {

            ex.printStackTrace();

        }

        System.out.println("Chat Server Ready");
    }




    public void put(Point p) throws RemoteException{

        p.getX();
        p.getY();

    }
 /*
    public ArrayList<String> get() throws RemoteException{

        return list;

    } */
    public ArrayList<String> get() throws RemoteException
    {
        return list;
    }

    public static void main(String[] args) {
        try {
            new ChatServer();
        } catch (RemoteException ex) {
            Logger.getLogger(ChatServer.class.getName()).log(Level.SEVERE, null, ex);
        }
    }


}

ChatClient.java

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.rmi.Naming;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFrame;
import javax.swing.JTextArea;
import javax.swing.JTextField;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author nick
 */
public class ChatClient extends JFrame implements Runnable, ActionListener, MouseListener, MouseMotionListener {

    String TAG = "kushal ";
    IChat ic;
    int oldx, oldy;
    JTextField jtf;
    JTextArea jta;

    public ChatClient() {
        try {
            Remote remote = Naming.lookup("//localhost:1099/chat");
            ic = (IChat) remote;
        } catch (Exception ex) {
            ex.printStackTrace();
        }



        setSize(300, 300);
        setVisible(true);

        Thread t = new Thread(this);
        t.start();
    }

    public void paint(Graphics g) {
    }

    public void run() {
        while (true) {
            try {
                ArrayList<Point> list = ic.get();
                Thread.sleep(1000);
            } catch (Exception ex) {
                ex.printStackTrace();

            }

        }
    }

    public static void main(String[] args) {
        new ChatClient();
    }

    public void actionPerformed(ActionEvent e) {
      /*  try {
            ic.put(TAG + jtf.getText());
            jtf.setText("");
        } catch (RemoteException ex) {
            Logger.getLogger(ChatClient.class.getName()).log(Level.SEVERE, null, ex);
        }*/

    }

    public void mouseClicked(MouseEvent e) {
    }

    public void mousePressed(MouseEvent e) {
        oldx = e.getX();
        oldy = e.getY();


    }

    public void mouseReleased(MouseEvent e) {
    }

    public void mouseEntered(MouseEvent e) {
    }

    public void mouseExited(MouseEvent e) {
    }

    public void mouseDragged(MouseEvent e) {
        Graphics g = getGraphics();

        int x = e.getX();
        int y = e.getY();
        g.drawLine(oldx, oldy, x, y);
        oldx = x;
        oldy = y;


    }

    public void mouseMoved(MouseEvent e) {
    }
}

IChat.java

import java.awt.Point;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.util.ArrayList;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author new
 */
public interface  IChat extends Remote{

    public void put(Point p) throws RemoteException;
    public ArrayList<Point> get() throws RemoteException;
}

Error in ChatServer.java : ChatServer is not abstract and does not override abstract method get() in IChat

get() in ChatServer cannot implement get() in IChat
return type ArrayList is not compatible with ArrayList
—-

Any help would be greatful.

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T06:53:58+00:00Added an answer on June 15, 2026 at 6:53 am

    – You have Not created the Implementation class for the Interface.

    Eg:

        IChatImpl implements IChat{
    
        public void put(Point p) throws RemoteException{
    
    
    
        }
    
        public ArrayList<Point> get() throws RemoteException{
    
    
    
    
        }
    }
    

    ////////////////////////////////Edited part/////////////////////////////

    I think you have not overridden this method……

    public ArrayList<String>

    It should be….

    public ArrayList<Point>

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Creating extensions got much easier with Vs2010, but this seems not to be the
Creating a Blackberry app. Just a beginner, I have searched but couldn't find a
Creating a searchable contacts kind of app. Below is my code public class EmployeeList
Creating a mini-database with access, i came across this problem: For the background, i
Creating a simple TCP server based on examples but still do not get how
Creating an installer for possible remote systems so that if they do not have
Creating a layout in Java as the number of TableLayouts required is not known
Creating a simple app that calculates the speed your going and displays it in
Creating a website using simple html(not html5) and css but got stock in mouseover
Creating an a app, where I store bunch of photos in the drawable folder,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.