Client Server Application with images or icons

I made a Client Server application with JFrames, but I put a jLabel with an icon, and I can't run the Client.
It says java.lang.NullPointerException
Do you know why I can't see the icon in the JLabel? It isn't an applet, it's an application with JFrames.

You have to explain the problem better if you want some help. Also show the code which is giving you the nullpointerexception(Do not forget codetags!).

Similar Messages

  • Client/server application under development

    Hi there,
    I've been working on a client/server application that includes chat and whiteboard features. In terms of how the client app communicates with the server app, my initial thought was to just go with xml, until I reached a snag. Everything about chat and almost everything that is accomplished on the whiteboard can be expressed in terms of text or character data; which what makes xml a good candidate for moving the data back and forth from client to server. However, there's one part of the whiteboard feature that can't be converted to just text. The whiteboard has an ImageTool. With it you can select an image (gif,jpg) from your harddrive and load it into the whiteboard. An image is binary data and simply cannot be put into an xml file for transport. At least, that's my understanding. Am I wrong about this?
    So, this poses the questions: "How do other similar applications like MSN Messenger move images around? If they're not using xml as there medium, what are they using? Just plain sockets without any structured medium like xml?"
    Please advise,
    Alan

    You could always Base64 encode the image file content and then put the Base64 in XML.
    I am in the middle of a client-server project and I use XStream ( http://xstream.codehaus.org/ ) to convert Objects to XML automatically. I don't have to do any explicit encoding - XStream does it all for me.

  • Problem in creating client side PDF with image using flex and AlivePD

    I need a favor I am creating client side PDF with image using flex and AlivePDF for a web based application. Images have been generated on that pdf but it is creating problem for large size images as half of the image disappeared from that pdf.I am taking the image inside a canvas . How do i control my images so that they come fit on that pdf file for any image size that i take.
    Thanks in advance
    Atishay

    I am having a similar and more serious problem. It takes a
    long time to execute, but even attaching a small image balloons the
    pdf to 6MB plus. After a few images it gets up to 20MB. These are
    100k jpeg files being attached. The resulting PDF is too large to
    email or process effectively. Does anyone know how to reduce
    size/processing?

  • Servlet in client/server application?

    hi,
    I am planing to make a client server application( SWING & an OODB), would it be clever to use servlet ( not httpservlet) as midle tier framework?
    If yes , what are the benefits?
    Thanks.

    thanks for responding
    actually my client don't wanna run a separate server application on the hosting machine as it costs too much, so thats why i think there is no other way to achieve the task rather than using servlets.
    please do help me or atleast give me a suggestion. actually i'm developing an internet messenger application. i have developed it using client/server application model in which both (the swing client and the server) uses java sockets to communicate with each other. but now i want to develop the server side of the messenger as servlets. but as far as i know the servlets follow the request/response model. if i follow that model i have to use some sort of client pull after certain amount of time say after five or ten seconds, and this approach does not fulfill my requirements as it would slow the performance if there are hundreds of clients calling the servlet every 5 seconds. thus i want to create persisted connections between the client and the servlet which last for the life time of the user's session. also it is important for the data integrity of the application, so please help me in this matter as i have no other source of guidence in this meany world. i hope you will certainely help me in this matter. please mention that if there are any drawbacks of my approach i mean the persisted connections.
    thanks you a lot
    Best reagrds
    Imran Sarwar.

  • Should i use secure sockets for my whole client/server application?

    Hi,
    I have a client server application, and I want to ensure that the login process is secure (i.e. use secure sockets). but I dont know how to switch back to a normal socket once that is done.
    So I am left thinking that i should just use SSL for my whole application, which can last pretty long. But I would rather not. Is there any other way of doing this?
    or should I just encrypt the login info using MD5 or something like that, then send it over an unsecure socket?
    thanks!

    Hey,
    Are you sure you haven't confused JGSS for JSSE?
    Imagine you have a client-server system and you sometimes want data sent over the wire to be encrypted... JGSS offers you this flexibility; if you a encrypted transmission, run ift through JGSS before transmitting it; if you don't want an encrypted transmission, bypass JGSS and just send the transmission.
    The benefit is the security (encryption) isn't hard-wired into you communications protocol i.e. TLS. JGSS has nothing to do with connections it is just protocol for securing messages, not sending them.
    You would need to establish the secure context but this could be done at startup and persist for the duration of you applicaiton invocation. You perhaps might need to implement a mechanism to identify encrypted messages on the receiving peer (so it knows to attempt decryption).
    Admittedly, kerberos seems like one of those 'inside-joke' things. I've come to realise if you don't have some sort of kerberos realm/server against which to authenticate - you need to swap it out as the underlying mechanism. How this is done I'm not sure yet, but I intend to find out today....further down the rabbit hole I go!
    If I discover anything helpful, I will let you know.
    Warm regards,
    D

  • Are there any Client/Server Application (using sockets) design patterns?

    Hi,
    The title of the post nearly says it all. I am searching for different design patterns related with the development of a client/server application. I understand that there must be any different ways on how a client/server application can be developed.
    Regards,
    Sim085
    Disclaimer:
    When I enter in the Socket forum on this site I recieve this message "Thank you for any participation in this forum. Due to a lack of relevant activity, we have decided to archive this forum on June 16, 2006. For future posts on this topic, we suggest you use the Networking forum" and I am not allowed to create a new post! However I can see posts done yesterday! All i did is add the forum in 'my forums'. Does this happen to you people as well?

    Hi Sim085...How are you?
    So look this:
    http://forum.java.sun.com/thread.jspa?threadID=5148926&tstart=75
    I don�t know if is what you want...but I hope in this^^
    Ok man...If you have one example for help you is better.
    [ ]

  • Need HELP in JAVA ( client /server application )

    hi there ,
    I need the following codes in java for my client/server application . which i can use to perform certain function on another computer on LAN. This is part of my semester project . I would really appreciate if any one can help me
    ->Open/close the CD-ROM once or in intervals (specified in seconds).
    ->Swap mouse buttons the right mouse button gets the left mouse button's functions and vice versa.
    ->Start optional application.
    ->Play optional sound-file.
    ->Point the mouse to optional coordinates.
    ->Shutdown the system, logoff the user etc.
    ->Mouse can be controlled on the target computer with remote mouse.
    ->Keys (letters) on the keyboard can be disabled.
    ->Increase and decrease the sound-volume.
    ->Listen for keystrokes and send them back to you!
    I would really appreciate if some1 can help me find these codes in java
    thanx
    Alamzaib Shafi
    [email protected]

    Dude, if you did your own homework once in a while you'd be able to handle your own semester project. I hope you fail your class and get kicked out of the program. One less idiot with a diploma competing with us hackers for the tech jobs.
    You are indeed a most worthy recipient of my unemployed angst.

  • Complier error concerning Client Server Application. Error in the server

    Hi I am trying to implement a client server application that will carry out basic calculations. However I am recienving this compiler error within the server class.
    unreported exception java.io.IOException; must be caught or delcared to be thrown.
    The code is pasted below.
    Your help would be much appreciated.
    Kind Regards
    Ridha
    import java.io.*;
    import java.net.*;
    import java.util.Hashtable;
    public class Server
        public static void main(String []args)
            ServerSocket calcServer = null;
            try
                // Create a socket on server
                //ServerSocket ss = new ServerSocket(7);
                calcServer = new ServerSocket(7);
            catch (IOException e)
                System.out.println("Could not listen on port: 7.");
                System.exit(1);
            System.out.println("The Server is Running");
            // When clients connets, make the link and carry on
            Socket clientSocket = null;
            try
             clientSocket = calcServer.accept();
            catch (IOException e)
             System.err.println("Accept Failed");
             System.exit(1);
                // hashtable to manage list of online and offline users
                //Hashtable tOnlineUsers = new Hashtable(10);
                //Hashtable tOfflineUsers = new Hashtable(10);
                // Now start accepting connections from clients in a while loop
                // The server should run in an infinite loop
                 // to get data to and from server
    InputStream in = clientSocket.getInputStream(); < my error is here
                    BufferedReader br = new BufferedReader(new InputStreamReader(in));
                    OutputStream out = clientSocket.getOutputStream();
                    PrintWriter pr = new PrintWriter(out, true);
                while(true)
                    Worker w = new Worker(clientSocket);
                    w.start();
                }   // End of while
            }// End of main()
    }   // End of class

    well, using my superb powers of reasoning and deduction, I can say that this is a lemon entry, watson. the line you kindly highlighted can potentially throw an IOException which you are not dealing with. deal with it

  • Client server application using CORBA

    Hi
    I have a basic client server application running using CORBA/idl where the client starts up and the server says hello back to the client. I have figured out the basics but would like some help with these small problems.
    When I start the client, the server says hello. Thats OK. Now I want the client to start a simple java app (called c:\test.java - it works) that I created before. How?
    The next bit is when I close down the app "test" that I start, I want the server to realise that its closing and simply say goodbye on the client. How?
    If anybody can help me, I'd appreciate it.
    Thanks for your time,
    Shaun

    hi,
    to my knowledge, you will have to define a method in idl file and in your client, which server invocates(saying good bye etc) before shutting down..
    ls.

  • Client/server application (Help me)

    I have a client server application.In the client part i send data to the server and the server receive data. After receiveing data server also send some data but the client can't capture data. Anyone please tell me what is the problem?
    I am giving the sample code here......
    I am thinking actually the problem is in the client side.......
    Server
    out = new DataOutputStream(client.getOutputStream());
    input = this.client.getInputStream();
    byte[] data=new byte[input.available()];
    input.read(data);
    byte[] sdata=new byte[3];
    sdata[0]=1;
    sdata[1]=2;
    sdata[2]=3;
    out.write(sdata);
    Client
    How can i implement my client to send and receive at a time??

    Thanks all of u.
    I have solved the problem.
    Now i have another problem.In the Client side I have used DataOutput
    Stream(for sending) and InputStream(for receiving).
    With the InputStream i am capturing data by this way.....
    int dataSize=is.available();
    int kkk=0;
    boolean hasSize=true;
    while (kkk<=0) {
    dataSize = is.available();
             if (dataSize != 0 && hasSize) {
                          byte[] dat = new byte[dataSize];
                          is.read(dat);
                           String s = new String(dat);
                           System.out.println("Capture:" + s);
                           System.out.println("data ssss: "+dataSize);
                           hasSize=false;
                           kkk=9;
                       }//End of if
      }//End of while
                     Here is the problem. If I am sending from the server data size less 4000 byte then the client can easily capture the data. But when i am sending the data which is very very large such as 70,000 bytes then it creates a problem.
    My target is simple. I want to capture the whole data that is send by the server . then want to keep the data in a byte array which size will depend upon the receiving data.
    How can i do that??

  • Client/Server application question

    Hey everyone,
    I am trying to exercise on a client/server application. My client application is similar to this one [http://java.sun.com/developer/onlineTraining/Programming/BasicJava2/Code/SocketClient.java]. However this client works like this: it sends text through socket -> receive response from server. I am trying to find a way so that the client can receive and process messages from the server asynchronously. That is the server can send messages anytime (not just as a response to the client) and the client should always be able to receive messages from the served at any time, and not just after it sent something. I believe that multithreading would be the answer, listening to the output stream and sending through the input stream should be run in parallel, but I can't find a way to implement it. Your help is appreciated. Thank you.

    I knew that :-) but how exactly?
    How do I translate this code into two runnable classes which will communicate with the original class and its gui?
    //Send data over socket
              String text = textField.getText();
              out.println(text);
           textField.setText(new String(""));
    //Receive text from server
           try{
           String line = in.readLine();
              System.out.println("Text received :" + line);
           } catch (IOException e){
          System.out.println("Read failed");
                 System.exit(1);
      }

  • Problem using the File Dialog Box in a Client/Server application

    I am developping a client-server application using Labview 5.1 . The application on the server acquires data from some instruments and saves it on file, while the application on the clients displayes such acquired data. For doing this I call some routines on the server via the "Open Application vi" (remote connection). All goes well except when I open on the server the "File Dialog Box vi" : in this case the application on the clients is blocked (is blocked the execution of the called vi on the server). Only when
    the File Dialog Box on the server is closed, the execution of the called vi on the server starts again.
    I need to use the File Dialog Box on the server, but I don' t want to stop at the same time
    the clients !!
    I need help for resolving such problem.
    Many thanks in advance !!!

    Hi!
    waldemar.hersacher wrote:
    "It seems that the VIs called by the clients are running in the user interface thread.
    A call to the file dialog box will call a modal system dialog. So LV can't go on executing VIs in the user interface thread."
    Are you sure? I think, that File Dialog, called by LabVIEW File Dialog from Advanced File Functions Palette doesn't blocking any cycles in subVI, which running in UI Thread. Look in my old example (that was prepared for other topic, but may be good for this topic too).
    2 linus:
    I think, you must a little bit reorganize you application for to do this. You must put your File Dialog into separated cycle. This cycle, of course, will be blocked when File Dialog appear on the screen. But other cy
    cle, which responsible for visualization will run continuosly at the same time...
    Attachments:
    no_block_with_file_open_dialog.zip ‏42 KB

  • How to validate a server in client-server application

    I am considering a client server application for a masters project. One of the core requirements for this application would be to ensure that the server could not be replaced. This would be easy to do using public/private keys. The client creates a message and encrypts using servers public key, then sends to the server. The server decrypts, processes, creates response, and encrypts using its private key. This works, however the public and private keys need to be in the source code. It looks like keystores may fix that problem, however the password to the key store would then be required. For this application to be usefull, I need to find a way to embed a password or encryption key in a .classfile in a way that it can not be retrieved by decompiling or parsing for strings. Anyone have ideas on how this could be done, or a different method I could use to guarantee that the response coming from a server process is from my server program and not a fake program?

    More detail. The program is a network license server (not web based). We need a simple license server for internal use, so that we can track usage and limit concurrent users for custom software. We also need some security so that people can not take the software home and use it. We have looked at commercial applications, however they are very expensive and we can not justify the cost since this is for internal software. There are 3 main pieces to a license server, the client libraries, the server, and the key generator. For the license server to be usefull, it should be impossible (or very very difficult) for someone to generate their own keys and add them to the license server. It should also be very difficult for them to create a fake license server that will grant licenses to clients without needing keys. If public/private key encryption is used, then the client would need to know the servers public key and their private key. These keys would need to be compiled into the program, stored in a key store, or looked up at run time from some other resource. The server would need to know its private key, and the clients public key. Since this is internal software, we can limit access to the server software, so it would be ok to compile the keys into the code (not ideal but secure enough for out use). However if I use this program as my Masters project, I would need to figure out a better way to secure it. The generic problem is how to give someone two programs that talk to each other, and be able to ensure that they do not fake one of the programs?

  • Can i use forms 9i or 10g for client/server applications

    Right now, we are using oracle 9i DB and developer suite 10g. I have to build a client/server application. In one of the OTN articles, it says that from forms 9i onwards, it's not supporting client/server applications. Do i have to use 6i for this.
    Thank You.
    Sree.

    That's right. Only web deployment is support from 9i onwards. Bad decision since Oracle seems to ignore their customer's view

  • Client/Server API with push?

    I set up a simple Socket client server architecture with the Java socket API. However, my clients sometimes are initiators or requests, and sometimes my server is the initiator of infos. Example: client want to get infos from server but also want to tell the server something. The server tells all registered clients something but also can accept requests from clients. So both sides are client AND server (depending on what they currently want to do).
    The socket API is just a classic client/server API, i.e. a server listens and a client sends requets and get responses. For my server to send requests to all clients, this is not enough. Is the only way to have all clients offering a socket server on their computer, too? so that this 2-way-request-communication works?
    This is basically some kind of "push" technology, but i don't want my clients to "poll" the server just to emulate the feature of sending requests from the server to the client. Is there some other (perhaps non-socket) API that offers this?

    @sjasja: how is the socket api symmetrical?It is, trust me! Connection initiation isn't, but after that it is. (Let's assume connected TCP/IP.)
    The server does bind() and accept(), the client does connect(). After that, the connection is symmetrical: either end can issue any number of read() and write() calls in any order. You write() to a socket, it pops out from read() at the other end (though not necessarily as a single packet; TCP/IP is stream oriented, so write() "packets" can and will be glued together, or fragmented at the whimsy of network routers and friends.)
    - accept() //wait for client to send request
    - socket.getInputStream() //read request
    - socket .getOutputStream() //write responseThose don't read or write; they get streams which you can read from and write to.
    In the server, when accept() returns a new connection, you'd start a reader thread for that client. The thread would read() (or readLine() if you implement a line-oriented protocol) and handle the incoming messages. Whenever you want to write to the client, write to the stream returned by socket.getOutputStream(). You may need to synchronize writes if you have several threads that do sequences of write()s that need to arrive at the client sequentially.
    As to the difficulty of socket programming: I don't think it particularly difficult. But then I've written dozens of socket programs since my first one in '85... The Java Tutorial socket chapter shows a simple client/server pair; not terribly difficult I think. In particular, check out the KKMultiServer at the bottom of the sample server chapter.

Maybe you are looking for