Keep getting error and don't know how to fix...

ok, I keep getting this nullPointerException error.. and I have no clue what I've done wrong.... I believe its on the client side of it... because when I run just the client.. the try catch should make it be like "can't find host" but instead.. it just sits there.. the cursor blinking.. and Idk why.. so if you could please help me!!!!!!! heres the server and client code
import java.net.*;
import java.io.*;
public class SocketServer extends Thread
     private static Socket socket = null;
     static boolean forever = true;
     static RTS2 rts;
     public static void main(String[] args) throws Exception
          ServerSocket serverSocket = null;
          try{
               serverSocket = new ServerSocket(5454);
          }catch (IOException e) {
            System.err.println("Could not listen on port.");
            System.exit(1);
        Socket clientSocket = null;
         try {
            clientSocket = serverSocket.accept();
        } catch (IOException e) {
            System.err.println("Accept failed.");
            System.exit(1);
        while(forever)
             try{
          ObjectOutputStream oos =
                        new ObjectOutputStream(socket.getOutputStream());
          oos.writeObject(rts.getCompany());
          ObjectInputStream  ois =
                       new ObjectInputStream(socket.getInputStream());
                  rts.setEnemy((Men)ois.readObject());
                  socket.close();
             } catch (Exception e) {
                           System.out.println(e);
                           e.printStackTrace();
import java.net.*;
import java.io.*;
public class SocketClient
     static boolean forever=true;
     static RTS2 rts;
     static Socket socket = null;
     static ObjectInputStream  ois = null;
     static ObjectOutputStream oos = null;
     public static void main(String[] args) throws Exception
          try {
            socket = new Socket("josh", 5455);
            ois = new ObjectInputStream(socket.getInputStream());
               oos = new ObjectOutputStream(socket.getOutputStream());
        } catch (UnknownHostException e) {
            System.err.println("Don't know about host");
            System.exit(1);
        } catch (IOException e) {
            System.err.println("Couldn't get I/O for the connection");
            System.exit(1);
        while(forever)
             rts.setEnemy((Men)ois.readObject());
             System.out.println("hello");
                oos.writeObject(rts.getCompany());
               oos.flush();
}

ok so that was a silly mistake I made... yet it didn't fix the problem... whenever I run just the client, shouldn't it not find a host and not just sit there blinking? but when I do run the server then run the client I get this error from the server side
java.lang.NullPointerException
at SocketServer.main(SocketServer.java:32)
which is when it starts the ObjectOutputStream and such... so I can only assume the problems on the client side, I bet its something easy too that i'm missing.. lol

Similar Messages

  • I joined this community in error and don't know how to delete myself from the group. Can someone please advise me on this ?

    I joined this community in error and don't know how to delete myself from the group. Can someone please tell me how to do that ?
    Thanks,
    Skeebo

  • New PC with Windows 8.1 trying to sync phone but receive following error message and don't know how to fix: iPhone cannot be synced. You do not have enough access privileges for this operation.

    In downloading iTunes onto my PC (Dell XPS 8700) with Windows 8.1 trying to sync my iPhone but receive keep receiving following error message and I just don't know how to fix: iPhone cannot be synced. You do not have enough access privileges for this operation.
    I would greatly appreciate help with this matter.

    See if the user tip helps: https://discussions.apple.com/docs/DOC-6562

  • I have for gotten my security questions and don't know how to fix it

    I have for gotten my security questions and don't know what to do need help

    The Three Best Alternatives for Security Questions and Rescue Mail
        1. Use Apple's Express Lane.
              Go to https://expresslane.apple.com ; click 'See all products and services' at the
              bottom of the page. In the next page click 'More Products and Services, then
              'Apple ID'. In the next page select 'Other Apple ID Topics' then 'Forgotten Apple
              ID security questions' and click 'Continue'. Please be patient waiting for the return
              phone call. It will come in time depending on how heavily the servers are being hit.
         2.  Call Apple Support in your country: Customer Service: Contacting Apple for support or
              Apple ID- Contacting Apple for help with Apple ID account security. Ask to speak to
              Account Security.
         3.  Rescue email address and how to reset Apple ID security questions.
    How to Manage your Apple ID: Manage My Apple ID

  • HT201210 Had a message to say my iphone needed plugging in to itunes, did this but then couldn't even turn it on (apple symbol on my screen) trying to restore to factory settings but keep getting error (16) don't know what to do now :(

    Had message on my iphone 4 this morning that I needed to plug it into itunes. Did this but could only get a blank screen with apple symbol on it. Tried to do a system restore but keep getting the message that it couldn't finish restoring

    Try a Hard Reset.....
    Press and hold the Wake / Sleep button AND the Home button at the same time, keep them both pressed until the Apple Logo appears on the screen, it can take 10 or more seconds.  Ignore the swipe to turn off message.

  • I hosed my fs...and don't know how to fix it

    When I started up my box the other day, I got the message that the filesystem had been mounted x times without checking, and that I could manually check it or hit ctrl-D to reboot normally.  I've had this before so I just hit ctrl-D and now all hell has broken loose.  During bootup now, when trying to mount the fs, I get a long string of "Unrecoverable Error" and am unable to go further.
    So I pop in my 0.4 install/rescue CD to try and run fsck or something to get back into my system, but have never done that before and have no clue. Is there something I have to pass at the boot: prompt? If I don't, then I cannot access my system, can't run fsck and can't do much of anything. I'd rather not just do a reinstall, as I'd like to try and fix this first.  I've tried to do some searching, but haven't found anything except how to run fsck, which doesn't help because I can't even get to that step yet.  My only net access now is at work, which is monitored so I can't spend a long time searching...if someone could just point me in the right direction I'd really appreciate it
    Thanks in advance
    [EDIT]:  Well, nothing like finding the answer 30 seconds after you post a request for help  :oops: .  Maybe someone can just confirm this for me.  At the boot: prompt when I bootup to the CD, I can just pass "init=/bin/bash" and will be able to access my filesystem?  Or do i need to pass something like "root=/location/of/root/partition".  Those are both things i found. Anyway, I'll take 10 lashes for finding the answer after I post for help

    well it seems that I completely hosed everything, plus I actually want to try out the 0.5 new installer, etc., so I'm just going to reinstall and pay more attention this time :oops:...thanks for all the help and advice

  • Ran "Verify Disk", and gave me an error i don't know how to fix

    Here is the error message that comes back after I do the Verify Disk.
    Verifying volume “Macintosh HD”
    Checking HFS Plus volume.
    Checking Extents Overflow file.
    Checking Catalog file.
    Illegal name
    Illegal name
    Checking multi-linked files.
    g Catalog hierarchy.",0)
    Checking Extended Attributes file.
    Checking volume bitmap.
    Volume Bit Map needs minor repair
    Checking volume information.
    Checking volume information.
    id volume free block count",0)
    (It should be 39891409 instead of 39891403)
    The volume Macintosh HD needs to be repaired.
    Error: The underlying task reported failure on exit
    1 HFS volume checked
    Volume needs repair
    It says i need to repair, but it won't let me hit the repair disk option. Any help for a Mac loving noob?

    Hi, H.
    It sounds like you ran Live Verification, i.e. used Verify Disk against your startup disk while booted from such. One can Verify, but not Repair, the current startup disk.
    Run the Procedure specified in my "Resolving Disk, Permission, and Cache Corruption" FAQ. Perform the steps therein in the order specified.
    If Disk Utility still fails to repair the disk, see the "Disk Utility cannot repair the disk" section of that same FAQ.
    Good luck!
    Dr. Smoke
    Author: Troubleshooting Mac® OS X
    Note: The information provided in the link(s) above is freely available. However, because I own The X Lab™, a commercial Web site to which some of these links point, the Apple Discussions Terms of Use require I include the following disclosure statement with this post:
    I may receive some form of compensation, financial or otherwise, from my recommendation or link.

  • Getting error and don't know why - array of objects..

    Image slide[] = new Image[25];
         public SlideShow()
         for(int x = 0; x<= slide.length; x++)
              Image slide[x] = new ImageIcon("slide"+ x +"jpg").getImage();
              add(new ImageViewer(slide[x]));
         }Error:
    SlideShow.java:14: ']' expected
              Image slide[x] = new ImageIcon("slide"+ x +"jpg").getImage();
                          ^
    SlideShow.java:14: illegal start of expression
              Image slide[x] = new ImageIcon("slide"+ x +"jpg").getImage();

    You don't need to declare the type of slide[x]. It is already known to be Image, since you declared slide as Image[]
    Foo[] foos = new Foo[1];
    Foo foos[0] = new Foo(); // WRONG
    foos[0] = new Foo(); // RIGHT

  • I cannot click certain things on firefox and don't know how to fix it.

    Okay so this problem started today. I know nothing about computers so a detailed response would be really helpful. When I go on any website, I can't click certain things. For example, on Facebook, I cannot click to update my status and I cannot click anything in the top blue bar. Nothing is blocking them, my cursor just won't click them. I can't download music from sites or do anything that I want to do. I am not sure if it is Firefox or if it is just my computer, because a couple days ago my cursor wasn't working at all unless I plugged a computer mouse into my laptop. I really don't want to download another browser, so I wanted to check here for some solutions. Do you think it is a hardware program? If so is it an easy fix? Thanks!

    That problem can be caused by an extension like the Yahoo! Toolbar or a Babylon extension that extents too much downwards and covers the top part of the browser window and thus makes links and buttons in that part of the screen not clickable.
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes
    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance/Themes).
    *Don't click the Reset button on the Safe mode start window or otherwise make changes.
    *https://support.mozilla.org/kb/Safe+Mode

  • Error #1009 - don't know how to fix

    Hi everyone,
    I'm new to flash and specially to AS3 and I'm getting this error message:
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at VIDEO_FINAL_02_fla::MainTimeline/frame1334()
    And strangely enough it works in mw SWF&FLV Player and in Safari or Firefox!!! The button just doesn't work with flash player - and I need it to work in this player.
    It's a simple educational video - it starts with a movie, then it stops and you have to click in a button that leeds you in to some text about a subject. then you click 'continue' and you continue watching tnhe second video - and so on (7 buttons and vídeos). - It's very linear.
    Here goes the the code of this frame:
    stop ();
    myLIVRO_BOTAO.addEventListener(MouseEvent.CLICK, livroPressz);
    function livroPressz(e:MouseEvent):void {
    gotoAndPlay("LIVROa");
    I can't understand... I gave this button (LIVRO_BOTAO) an instance name (myLIVRO_BOTAO) on the properties tab.

    Forget it..
    I just found the answer in another website.
    You shouldn't have movieclips inside buttons - and that was the problem...
    I've just tried and it worked!
    You just have to include a line before the rest of the code:
    myButton = SimpleButton(getChildByName(myButton))
    myButton - name of your button.
    Thank you anyway.

  • Resized firefox's zoom default and don't know how to fix it

    Hello,
    I have Firefox ver. 24.0 and it seemed that the zoom was larger than normal but it was it's default size. I've tried to find a solution and it showed going into config, ect. I've accidentally typed a certain number when I was carelessly typing and pressed 'enter'. It is now way, way, too large. When I went into Firefox, all you see is the file button that shows the whole screen! and I've tried using 'ctrl' and '-' but it did not work. I've tried re-downloading Mozilla Firefox but it seem to keep its default! I've even downloaded an older version of Mozilla and yet all I saw was a large 'file' button. Is there someway this can be fixed?
    Thank you.

    hello PyongPyonsaeng, you can perform the following steps to change the value again "blindly":
    # open firefox and press ctrl +L (this will put the focus into the location bar)
    # type '''about:config'''
    # press enter twice
    # type '''devpix'''
    # press the tab key
    # press enter
    # type '''1.0'''
    # press enter again & hopefully you should be back to normal visibility now

  • Firefox keeps crashing. I don't know how to fix this

    Firefox has been consistently crashing. How can I stop this from happening? Also, when I type something in the Search box on Google, nothing shows up.

    Does File > Work Offline has a check mark when that happens?
    You can try to create a new Boolean pref with the name network.manage-offline-status and set the value to false.<br />
    Right-click on the about:config page to open the right-click context menu and use "New > Boolean" to create a new Boolean pref.
    Name: network.manage-offline-status
    Value: false
    See also http://kb.mozillazine.org/about%3Aconfig

  • Error I don't know how to fix myMessage.text

    Hi,
    I am getting an error on the below piece of code, the error is showing on the myMessage.text:@"hello xcode";
    can anyone see where I'm going wrong?, I am following a self teach manual. Thanks in advace.
    UILabel *myMessage;
       myMessage=[[UILabel alloc]  
                  initWithFrame:CGRectMake(25.0, 225.0, 300.0, 50.0)
                  myMessage.text:@"hello xcode";
        myMessage.font=[UIFont systemFontOfSize:48];
        [_window addSubview:myMessage];
        [_window makeKeyAndVisible];
        return YES;

    I have no errors now but am getting a white screen on the simulator, can anyone help out?
    UILabel *myMessage;
        myMessage=[[UILabel alloc]  initWithFrame:CGRectMake(25.0, 225.0, 300.0, 50.0)];
        myMessage.text=@"Hello Xcode";
        myMessage.font=[UIFont systemFontOfSize:48];
        [_window addSubview:myMessage];
        [myMessage release];
        [_window makeKeyAndVisible];
    return YES;

  • When I go into Outlook on my second laptop I lose all my e-mails on my I-phone and don't know how to fix

    I have two laptops, one for personal and one for work.  I also have an iPhone 4S and an iPad mini.  I am trying to link them so that I can receive several email accounts to all devices. I get the emails ok to my personal computer and iPad but when I go into Outlook on my work computer I lose all the emails off my iPhone. Can anyone help please?

    You have posted your message to the "Forum comments" forum. The Forum comments forum is intended for making comments on the functioning of any of the forums. The Forum comments forum is not intended for issues related to the use of Adobe products or other Adobe services. Therefore, I am moving your thread to a more appropriate forum, the Createive Suites Macintosh forums.
    You can still find your thread through the link at the bottom of the email notification or through the "Your stuff" -> "Discussions" link near the top of the page.

  • Page palette appears to be very strange in Indesign (and don't know how to fix it)

    So one day, my Page Palette just went cuckoo in Indesign.The bottom area, where you can normally delete, add, or shows you how many pages there are, or the very lower right scretch corner are all missing. I've tried to go to Palette options and see it is a "View" issue, but nothing seems to bring those functions back.
    This could either be something Very simple and I am an idiot, or it is something alot more major, which I am praying it's not.
    Thanks, any insights is great apperciated!!

    Replace your preferences. This link is for CS4, and it looks like you have CS2, but the information is basically the same. Read the whole page.
    Adobe InDesign CS4 * Setting preferences

Maybe you are looking for

  • RAC on Windows Server 2008 R2 - which edition is necessary

    Hello, which Windows Server 2008 R2 edition is required to install RAC - standard or enterprise (NOT database edition - windows server 2008 edition)? If we want to implement RAC 11Gr2 Enterprise Edition does the operating system also has to be enterp

  • Limit the number of digits in a numeric field

    Hi I have been searching for the last hour to find out ho i can limit the numeric field on my livecycle form. I have seen lots of java script however nothing seems to work, all i want is for the user only to enter 6 digits (e.g. 123456) and if they t

  • Imac Vs. ibook

    Hi guys, I'm in a bit of a fix. I'm a college student right now and I'm looking to buy a macintosh. I really like the ibook because its cheap and very portable(I'm going with the 12 inch if I get it.) I saw the imac though and it looks very good for

  • I have some general questions about Java

    Is there a such thing as a list of every Exception in Java? Is there somewhere I can look at examples of try statements, catch statements I guess tutorials on the basics of Java, like what would constitute these statements.

  • Trial sites rant

    As I am continuing to explore the possibilities of Business Catalyst, I bought a recent template deal from Tribevita. I downloaded their templates, which in turn zapped the amount of trial sites (100 max) available to create new Muse site tests or an