Error in Hashtable put method-Can not resolve symbol

Hi there!I am new to using java.util.Hashtable.
I am using it for a command line instant messaging program for holding the list of clients and list of client names currently connected to the server.
However when I compile my server with the command javac server.java it seems to give errors can not resolve symbol method put (java.lang.object,int).
Here is my code for my server:
* @(#)server.java
* @author
* @version 1.00 2008/3/22
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.*;
public class server {
          static int key1=0;
          static Hashtable nameHolder=new Hashtable();
          //static ArrayList nameHolder=new ArrayList();
          //static ArrayList clientsConnected =new ArrayList();
          static Hashtable clientsConnected =new Hashtable();
     public static void main(String[] args) throws IOException {
          //nameHolder.add("controlelement");
          Socket connect=null;
          String name =null;
          PrintWriter out=null;
          BufferedReader in =null;
          String machinename;
          int port=0;
     ServerSocket serverSocket = null;
     serverSocket = new ServerSocket(2222);
     boolean listeningports = true;
     try {
               if(args.length > 0)
               port = Integer.parseInt(args[0]);
               System.out.println(port);
               else
                    System.out.println("You must enter port number");
                    System.exit(1);
               while(true)
                         System.out.println("Hakan");
                         connect=serverSocket.accept();
               in = new BufferedReader(new InputStreamReader(connect.getInputStream()));
                    System.out.println("Hakan");
               String girdi = in.readLine();
               StringTokenizer nameAl=new StringTokenizer(girdi);
               String ad=null;
               String host=null;
               int portofclient=0;
               int m=0;
               while(nameAl.hasMoreTokens())
                    if(m==0)
                         ad=nameAl.nextToken();
                         System.out.println("Adim"+ad);
                    else if(m==1)
                         host=nameAl.nextToken();
                         System.out.println("Hostum"+host);
                    else if(m==2)
                         portofclient = Integer.parseInt(nameAl.nextToken());
                         System.out.println("Listening portum"+portofclient);
                         break;
                    m++;
               out = new PrintWriter(connect.getOutputStream(), true);
               System.out.println("Haso");
               if(!isUsed(ad))
                    System.out.println(girdi);
                    System.out.println("H�so");
                    //Object fason=(Object)ad;
                    nameHolder.put(key1,ad);
//The error seems to occur here
                    client myclient=new client(ad,host,portofclient);
                    //Object garson=(Object)myclient;
                    clientsConnected.put(key1,myclient);
                    key1++;
                    //clientInfoHolder.add(girdi);
                    out.println("Kullanımda");
                    System.out.println("Haso");
                    new MultiClientManager(connect).start();
               else
                    //System.out.println("kulanilmaz");
                    out.println("Kullanim disi");
     catch(Exception e)
          System.out.println("You did not specify port number");
          System.out.println("Or connection was not established due to specifying invalid or used port");
          e.printStackTrace();
     public static boolean isUsed( String name )
               if( nameHolder.containsValue(name) )
                    return true;
               return false;
     public static client Ask(String name)
          ArrayList lombak=(ArrayList) clientsConnected.values();
          for(int i=0;i<lombak.size();i++)
               client semsi = (client)lombak.get(i);
               if(semsi.nickname.compareTo(name)==0)
                    return semsi;
          return null;
     public static int returnkeyoffromclients(String name)
          ArrayList lombak=(ArrayList)clientsConnected.values();
          for(int i=0;i<lombak.size();i++)
               client semsi = (client)lombak.get(i);
               if(semsi.nickname.compareTo(name)==0)
                    return i;
          return 0;
     public static int returnkeyoffromnames(String name)
          ArrayList lombak=(ArrayList)nameHolder.values();
          for(int i=0;i<lombak.size();i++)
               String semsi = lombak.get(i).toString();
               if(semsi.compareTo(name)==0)
                    return i;
          return 0;
}

Excuse me for not putting my code between tags. I am just sleepless.
I am sending it again.
* @(#)server.java
* @author
* @version 1.00 2008/3/22
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.*;
public class server  {
          static int key1=0;
          static Hashtable nameHolder=new Hashtable();
          //static ArrayList nameHolder=new ArrayList();
          //static ArrayList clientsConnected =new ArrayList();
          static Hashtable clientsConnected =new Hashtable();
         public static void main(String[] args) throws IOException {
              //nameHolder.add("controlelement");
              Socket connect=null;
              String name =null;
              PrintWriter out=null;
              BufferedReader in =null;
              String machinename;
              int port=0;
             ServerSocket serverSocket = null;
             serverSocket = new ServerSocket(2222);
             boolean listeningports = true;
             try {
                    if(args.length > 0)
                         port = Integer.parseInt(args[0]);
                         System.out.println(port);
                    else
                         System.out.println("You must enter port number");
                         System.exit(1);
                    while(true)
                              System.out.println("Hakan");
                               connect=serverSocket.accept();
                         in = new BufferedReader(new InputStreamReader(connect.getInputStream()));
                              System.out.println("Hakan");
                         String girdi = in.readLine();
                         StringTokenizer nameAl=new StringTokenizer(girdi);
                         String ad=null;
                         String host=null;
                         int portofclient=0;
                         int m=0;
                         while(nameAl.hasMoreTokens())
                              if(m==0)
                                   ad=nameAl.nextToken();
                                   System.out.println("Adim"+ad);
                              else if(m==1)
                                   host=nameAl.nextToken();
                                   System.out.println("Hostum"+host);
                              else if(m==2)
                                   portofclient = Integer.parseInt(nameAl.nextToken());
                                   System.out.println("Listening portum"+portofclient);
                                   break;
                              m++;
                         out = new PrintWriter(connect.getOutputStream(), true);
                         System.out.println("Haso");
                         if(!isUsed(ad))
                              System.out.println(girdi);
                              System.out.println("H�so");
                              //Object fason=(Object)ad;
                              nameHolder.put(key1,ad);
                              client myclient=new client(ad,host,portofclient);
                              //Object garson=(Object)myclient;
                              clientsConnected.put(key1,myclient);
                              key1++;
                              //clientInfoHolder.add(girdi);
                              out.println("Kullan&#305;mda");
                              System.out.println("Haso");
                              new MultiClientManager(connect).start();
                         else
                              //System.out.println("kulanilmaz");
                              out.println("Kullanim disi");
             catch(Exception e)
                  System.out.println("You did not specify port number");
                  System.out.println("Or connection was not established due to specifying invalid or used port");
                  e.printStackTrace();
         public static boolean isUsed( String name )
                   if( nameHolder.containsValue(name) )
                        return true;
                   return false;
         public static client Ask(String name)
              ArrayList  lombak=(ArrayList) clientsConnected.values();
              for(int i=0;i<lombak.size();i++)
                   client semsi = (client)lombak.get(i);
                   if(semsi.nickname.compareTo(name)==0)
                        return semsi;
              return null;
         public static int returnkeyoffromclients(String name)
              ArrayList lombak=(ArrayList)clientsConnected.values();
              for(int i=0;i<lombak.size();i++)
                   client semsi = (client)lombak.get(i);
                   if(semsi.nickname.compareTo(name)==0)
                        return i;
              return 0;
         public static int returnkeyoffromnames(String name)
              ArrayList lombak=(ArrayList)nameHolder.values();
              for(int i=0;i<lombak.size();i++)
                   String semsi = lombak.get(i).toString();
                   if(semsi.compareTo(name)==0)
                        return i;
              return 0;
     These are the lines that are responsible from the error.
nameHolder.put(key1,ad);
client myclient=new client(ad,host,portofclient);
//Object garson=(Object)myclient;
clientsConnected.put(key1,myclient);

Similar Messages

  • Can not resolve symbol in method showMessageDialog

    I tried to dispaly a mesg using JOptionPane, it gives error mesg like
    HWS.java:27: cannot resolve symbol
    symbol : method showMessageDialog (<anonymous java.awt.event.ActionListener>,j
    ava.lang.String,java.lang.String,int)
    location: class javax.swing.JOptionPane
    JOptionPane.showMessageDialog (this, "The","Exit", JOptionPane.INFORMATION_M
    ESSAGE);
    ^
    pls help.
    Sabarish
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class HWS extends JFrame{
    public HWS() {
    super("Learning...");
    setSize(300,300);
    JLabel label2 = new JLabel("Jegan Rao");
    JButton button = new JButton("Click here");
    Container pane = getContentPane();
    pane.setLayout(new FlowLayout());
    pane.add(button);
    pane.add(label2);
    ActionListener al = new ActionListener(){
    public void actionPerformed (ActionEvent ae){
    JOptionPane.showMessageDialog (this, "The","Exit", JOptionPane.INFORMATION_MESSAGE);
    button.setHorizontalAlignment(JButton.CENTER);
    button.addActionListener(al);
    button.setVerticalAlignment(JButton.CENTER);
    label2.setHorizontalAlignment(JLabel.CENTER);
    label2.setVerticalAlignment(JLabel.CENTER);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    pack();
    setVisible(true);
    public static void main(String [] args){
    HWS h = new HWS();
    }

    Please post code using the code tags. There is a code button when you enter text for your message. Click on it then paste your code between the tags.
    All of the JOptionPane showMessageDialog() methods require a Component as the first object argument. Your code calls showMessageDialog from inside an actionPerformed() method, which is inside an ActionListener. So 'this' is an ActionListener, not a JFrame or other Component.
    Are you sure you want to call up a dialog in an actionPerformed() method? This method is called from the event thread, and blocks this thread until the dialog completes. This means no events can occur until the dialog completes, but it may require an event to complete the dialog.

  • Can not resolve symbol? what is the problem with this braclet?

    Hi to all!
    I've got a problem understanding the output of javac. Here's the code and below the javac message.
    class ExtComboBoxUI extends BasicComboBoxUI
    private Object sourceBase;
    ExtComboBoxUI(Object source)
    --> {
    sourceBase = source;
    ExtComboBoxUI.java:28: cannot resolve symbol
    symbol : constructor BasicComboBoxUI ()
    location: class BasicComboBoxUI
    Could someone please give me an idea why javac cannot resolve this braclet?
    I am helpless - I really don't know how to get rid of this bug.
    Regards,
    LeaH

    Hi Leah,
    Please check whether you had included all the packages required for your program/application and also check that the packages has been set to the classpath.
    Specify the classpath and check once again.
    Regards,
    Anil.
    Technical Support Engineer.

  • I restored my ipod, when I went to put everything back on it, I got a message that said, "an error writing to the device, can not sinc.  Then it said the required disc can not be found.  Now what do I do, I have all of this music and apps that I can't get

    Before I restored my ipod, I backed it up then I updated and restored.  The problem is when I went to put everything back on it, I got a message saying that an error writing to the device, can not sync.  Then another message appeared saying that "the required disc can not be found.  Now what do I do?

    Try resetting the iPOd. Nothing will be lost.
    Reset iPod touch:  Press and hold the On/Off Sleep/Wake button and the Home
    button at the same time for at least ten seconds, until the Apple logo appears.
    - Also, delet the iPod Phot Cache folder for the second error. For its loation see:
    iTunes: Photo sync creates iPod Photo Cache folder

  • Another DiveLog can't resolve symbol error

    I am using NetBeans to go through the DiveLog tutorial, which I have first typed, then cut/pasted in (hence I've not included it here). On compilation I get the following error:
    divelog/DiveLog.java [41:1] cannot resolve symbol
    symbol : method addTab (java.lang.String,<nulltype>,divelog.Welcome,java.lang.String)
    location: class javax.swing.JTabbedPane
    tabbedPane.addTab("Welcome",
    ^
    1 error
    Errors compiling divelog (->).
    The rest of the line looks like this:
    tabbedPane.addTab("Welcome",
         null,
         new Welcome(),
         "Welcome to the Dive Log");
    (Note that I have cut out all the other tabs, just to focus the mind)
    As I am sure you expect if I set the component parameter to null (rather than new Welcome()) it compiles just fine.
    I have read the troubleshooting tips on the tutorial, and understand that I am not compiling the whole package, but as far as I know I am! I highlight the package and compile all, I have compiled the project, and both with the same result. I have also read many, many newsgroup entries on the same subject and I have been trying all the various solutions for the last two days.
    I note that whilst the others have an error that points to Welcome, the error message I get is on the symbol addTab.
    I get the same error if I javac it too. (from the Divelog directory I typed javac -classpath d:\java\myjava\ DiveLog.java, and also tried setting a CLASSPATH environmental variable)
    I have my path (environmental variable) set to: d:\java\j2sdk_nb\j2sdk1.4.2\bin
    I have also set CLASSPATH to d:\java\myJava
    Please remember the pain of newbie!
    Thanks, Myles
    PS I am working in Windows XP

    The compiler is saying that in the JTabbedPane class, there is no method that takes a String, a null, a divelog.Welcome, and another String as parameters. I am guessing that in the divelog.Welcome class source code, you are missing something like the bolded text below.
    public class Welcome extends JPanel
    I'm making this guess because the JTabbedPane needs a Component for the third argument. If you still can't make sense of this, post the page of the tutorial so we can look at it.

  • Trying to open iTunes I got a error message of msvcr80.dll can not be found. I thought that it was an iTunes program problem. I tried reloading iTunes and then got an error message of a program is trying to acces a library file incorrectly. How can I reso

    When trying to open ITunes, I got an error message of msvcr80.dll can not be found.
    Assuming that it was an iTunes file, I reinstalled iTunes.
    Trying to open again, I got an error message of an appication is trying to open a library file incorrectly.
    How do I resolve this problem.
    Neither my PC with Vista nor my my laptop with windows 7 will work?
    Thanks

    Hello Msvcr80.dll,
    Thanks for using Apple Support Communities.
    For more information on this, take a look at:
    iTunes 11.1.4 for Windows: Unable to install or open
    http://support.apple.com/kb/TS5376
    Check for .dll files
    Go to C:\Program Files (x86)\iTunes and C:\Program Files\iTunes and look for .dll files.
    If you find QTMovie.DLL, or any other .dll files, move them to the desktop.
    Reboot your computer.
    Note: Depending on your operating system, you may only have one of the listed paths.
    Uninstall and reinstall iTunes
    Uninstall iTunes and all of its related components.
    Reboot your computer. If you can't uninstall a piece of Apple software, try using the Microsoft Program Install and Uninstall Utility.
    Re-download and reinstall iTunes 11.1.4.
    Best of luck,
    Mario

  • HT201210 my iphone 3 couldn't restore, its saying the error 46. what is the meaning of error 46?and how can i resolve it?

    my iphone 3 couldn't restore, its saying the error 46. what is the meaning of error 46?and how can i resolve it?

    It doesn't matter when you installed antivirus software; if you have it on your computer it will frequently block access from applications to sites it does not know about. A sync does not require access to a site not on your computer; an upgrade clearly does. So if you have never jailbroken any device you do not need to be concerned about your hosts file, but you DO need to temporarily disable your antivirus during the update process.
    The hosts file is an operating system file on all computers that overrides DNS lookup. In order to jailbreak or hack an iDevice the programs that do it need to redirect iTunes so it does not go to the Apple activation server, but instead goes to the hacking program for activation instructions. It does this by adding a record to the hosts file that bypasses the DNS lookup for gs.apple.com. But you don't have to be concerned about this.

  • Package can not resolve

    Hi I have this import package
    import java.util.regex.*;
    Now this package is only in 1.4 api not 1.3 api.
    I am using websphere 5.1 with follwoing jre
    IBM\WebSphere Studio\Application Developer\v5.1.2\runtimes\base_v5\java\jre.
    but error message is coming import can not be resolved.
    now at installation time websphere uses 1.3 but i changed wverywhere from 1.3 to 1.4 but problem still persisting
    thanxs and regards

    use base_v51 not base_v5.
    solved

  • OPA 10.4.1 on JBoss 6.1 - can not resolve path: plugins

    Having difficulties in deploying my web-determinations.war to JBoss 6.1.
    Same thing works well in OPM (Build and Debug).
    PS: Getting the same error when deploying the examples provided in the OPA Java Runtime.
    Any suggestions ?
    Error Log:
    2012-09-21 16:35:40,657 INFO [STDOUT] (ResourceContainer.invoker.nonDaemon-6) 0 [ResourceContainer.invoker.nonDaemon-6] WARN com.oracle.determinations.web.platform.servlet.WebDeterminationsServletContext - Plugin directory could not be initialised. No plugins will be loaded
    2012-09-21 16:35:40,657 INFO [STDOUT] (ResourceContainer.invoker.nonDaemon-6) java.lang.IllegalArgumentException: can not resolve path: plugins
    2012-09-21 16:35:40,657 INFO [STDOUT] (ResourceContainer.invoker.nonDaemon-6)      at com.oracle.util.plugins.PluginRegistry.addPluginsFromDir(PluginRegistry.java:118)
    2012-09-21 16:35:40,657 INFO [STDOUT] (ResourceContainer.invoker.nonDaemon-6)      at com.oracle.determinations.web.platform.servlet.WebDeterminationsServletContext.init(WebDeterminationsServletContext.java:159)
    2012-09-21 16:35:40,658 INFO [STDOUT] (ResourceContainer.invoker.nonDaemon-6)      at com.oracle.determinations.web.platform.servlet.WebDeterminationsServletContext.<init>(WebDeterminationsServletContext.java:116)
    2012-09-21 16:35:40,658 INFO [STDOUT] (ResourceContainer.invoker.nonDaemon-6)      at com.oracle.determinations.web.platform.servlet.WebDeterminationsServlet.init(WebDeterminationsServlet.java:73)
    2012-09-21 16:35:40,658 INFO [STDOUT] (ResourceContainer.invoker.nonDaemon-6)      at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1208)
    2012-09-21 16:35:40,659 INFO [STDOUT] (ResourceContainer.invoker.nonDaemon-6)      at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1108)
    2012-09-21 16:35:40,659 INFO [STDOUT] (ResourceContainer.invoker.nonDaemon-6)      at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3628)
    Edited by: 960661 on Sep 21, 2012 1:43 PM

    Its working now, I assumed it wasn't working by looking at the logs. Accessing the rulebase "/JBossPOC/startsession/JBossPOC/" - i could see that plugin is working.
    Do i need to make any other changes to remove the following warnings ?
    12:12:52,522 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015876: Starting deployment of "JBossPOC.war"
    12:12:55,346 WARN [com.oracle.determinations.web.platform.servlet.WebDeterminationsServletContext] (MSC service thread 1-4) Plugin directory could not be initialised. No plugins will be loaded: java.lang.IllegalArgumentException: can not resolve path: plugins
         at com.oracle.util.plugins.PluginRegistry.addPluginsFromDir(PluginRegistry.java:118) [determinations-utilities.jar:]
         at com.oracle.determinations.web.platform.servlet.WebDeterminationsServletContext.init(WebDeterminationsServletContext.java:159) [web-determinations.jar:]
         at com.oracle.determinations.web.platform.servlet.WebDeterminationsServletContext.<init>(WebDeterminationsServletContext.java:116) [web-determinations.jar:]
         at com.oracle.determinations.web.platform.servlet.WebDeterminationsServlet.init(WebDeterminationsServlet.java:73) [web-determinations.jar:]
         at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1202) [jbossweb-7.0.13.Final.jar:]
         at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1102) [jbossweb-7.0.13.Final.jar:]
         at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3655) [jbossweb-7.0.13.Final.jar:]
         at org.apache.catalina.core.StandardContext.start(StandardContext.java:3873) [jbossweb-7.0.13.Final.jar:]
         at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
         at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
         at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_07]
         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_07]
         at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_07]

  • TS3694 I am trying to restore an Ipod Touch 1st generation and I am receiving an error code of 1, How can I resolve?

    I am trying to restore an Ipod Touch 1st generation and I am receiving an error code of 1, How can I resolve?

    i have the same problem ipod touch 1st gen and its 1 not -1
    can you help please??

  • HT204416 My Safari is no longer working with many sites.  However Chrome and Firefox work fine.  I would like to re-install Safari in an effort to clear up the problem I can not resolve.

    My Safari is no longer working with many sites.  However Chrome and Firefox work fine.  I would like to re-install Safari in an effort to clear up the problem I can not resolve.

    1. From the Safari menu bar, select
              Safari ▹ Preferences... ▹ Extensions
    Turn all extensions OFF and test. If the problem is resolved, turn extensions back ON and then disable them one or a few at a time until you find the culprit.
    2. Select
              Safari ▹ Preferences... ▹ Privacy ▹ Remove All Website Data...
    and confirm. Test.
    3. If the above steps don't resolve the problem, please describe it in more detail.

  • HT4847 I can not delete old icloud back up from my old phone, keep receiving an error message "this back up can not be deleted because it's in use" it is not in use that phone is long gone!

    I can not delete old icloud back up from my old phone, keep receiving an error message "this back up can not be deleted because it's in use" it is not in use that phone is long gone!

    I have the same problem here and it wont let me do another back up or delete the old one.... Please help!!!! Anyone

  • I just purchased survivor season 11 to watch on my iphone4. I synced the first 4 episodes and I get an error message that episode 2 can not be played in my iphone4? How do I get it to play on my iPhone 4?

    I just purchased survivor season 11 to watch on my iphone4. I synced the first 4 episodes and I get an error message that episode 2 can not be played in my iphone4? How do I get it to play on my iPhone 4?

    In order to use ''nxm://'' links, Nexus Mod Manager must be installed and associated with the ''nxm'' protocol.
    * http://www.nexusmods.com/skyrim/mods/modmanager/
    In case of problems with this third-party program, please refer to its support forum:
    * http://forums.nexusmods.com/index.php?/forum/1413-nmm-code-development-chat

  • When trying to restore and update my ipod touch it comes up with an error message saying: "The ipod can not be restored this device isnt eligible for the requested build"

    When trying to restore and update my ipod touch it comes up with an error message saying: "The ipod can not be restored this device isnt eligible for the requested build" How do i fix this?

    I am having the same issue. I just had the battery replaced at a third party store. The battery powers the ipod up but it needs to be restored. It is saying it isn't eligible for rebuild. I am running MAC OS 10.4.11  itunes v. 9.0   and I just want it to be restored. I need help.  Oh and its an 8 gb ipod touch.

  • Since I'd installed the new version of iTunes, iCal and Address book do not sync with my iPhone 3GS through iTunes anymore and I get an error message stating that iTunes can not sync with this iPhone. Was must i do to correct this issue?

    Since I'd installed the new version of iTunes, iCal and Address book do not sync with my iPhone 3GS through iTunes anymore and I get an error message stating that iTunes can not sync with this iPhone. Was must i do to correct this issue and if i must, how dI reintall iTunes without loosing my content?
    P.S. I am able to sync postcasts and music though!

    http://support.apple.com/kb/TS3694
    http://support.apple.com/kb/TS3125
    http://support.microsoft.com/kb/299357

Maybe you are looking for