Results 1 to 8 of 8
  1. #1
    raj.mscking@gmail.com's Avatar
    raj.mscking@gmail.com is offline Senior Member
    Join Date
    Jan 2012
    Location
    TamilNadu
    Posts
    288
    Rep Power
    3

    Default Error in Javax.Swing.ImageIcon

    Hi To All!
    My self Raj, I need your help for run my program,
    By using Server Socket & Socket run the program to monitoring the clients from server
    If i run the program in single system, it run perfectly and give desired out put also,
    But!
    if i using different system it client get connect and immediately if get disconnect automatically, it show an error like

    Server Side:


    "run:
    New client Connected to the server
    java.io.InvalidClassException: javax.swing.ImageIcon; local class incompatible: stream classdesc serialVersionUID = 532615968316031794, local class serialVersionUID = -962022720109015502
    at java.io.ObjectStreamClass.initNonProxy(ObjectStrea mClass.java:579)
    at java.io.ObjectInputStream.readNonProxyDesc(ObjectI nputStream.java:1601)
    at java.io.ObjectInputStream.readClassDesc(ObjectInpu tStream.java:1514)
    at java.io.ObjectInputStream.readOrdinaryObject(Objec tInputStream.java:1750)
    at java.io.ObjectInputStream.readObject0(ObjectInputS tream.java:1347)
    at java.io.ObjectInputStream.readObject(ObjectInputSt ream.java:369)
    at remoteserver.ClientScreenReciever.run(ClientScreen Reciever.java:33)
    "

    Client side:

    "run:
    Connecting to server ..........
    Connection Established.
    Preparing InputStream
    Waiting for command
    before sending image"


    My coding is

    "
    package remoteserver;

    import java.awt.Graphics;
    import java.awt.Image;
    import java.io.IOException;
    import java.io.ObjectInputStream;
    import javax.swing.ImageIcon;
    import javax.swing.JPanel;
    import javax.swing.JOptionPane;
    import javax.swing.JFrame;

    class ClientScreenReciever extends Thread {

    private ObjectInputStream cObjectInputStream = null;
    private JPanel cPanel = null;
    private boolean continueLoop = true;

    public ClientScreenReciever(ObjectInputStream ois, JPanel p) {
    cObjectInputStream = ois;
    cPanel = p;
    //start the thread and thus call the run method
    start();
    }

    public void run(){

    try {

    //Read screenshots of the client then draw them
    while(continueLoop){
    //Recieve client screenshot and resize it to the current panel size
    ImageIcon imageIcon = (ImageIcon) cObjectInputStream.readObject();
    System.out.println("New image recieved");
    Image image = imageIcon.getImage();
    image = image.getScaledInstance(cPanel.getWidth(),cPanel.g etHeight()
    ,Image.SCALE_FAST);
    //Draw the recieved screenshot
    Graphics graphics = cPanel.getGraphics();
    graphics.drawImage(image, 0, 0, cPanel.getWidth(),cPanel.getHeight(),cPanel);
    }
    } catch (IOException ex) {
    ex.printStackTrace();
    } catch(ClassNotFoundException ex){
    ex.printStackTrace();
    }
    JOptionPane.showMessageDialog(cPanel,"Client DISConnected");
    }

    }

    "

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,656
    Blog Entries
    7
    Rep Power
    21

    Default Re: Error in Javax.Swing.ImageIcon

    You're running different versions of the Java virtual machine. The serial ids of a built-in class differ (as the Exception message told you). Make your clients and server run the same Java version.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    raj.mscking@gmail.com's Avatar
    raj.mscking@gmail.com is offline Senior Member
    Join Date
    Jan 2012
    Location
    TamilNadu
    Posts
    288
    Rep Power
    3

    Default Re: Error in Javax.Swing.ImageIcon

    Thank you Mr.jos!
    i installed jdk.6 & 7 also in the both systems..,
    running by using JDK.6 with netbeas IDE 6.9
    what ca i do now..,

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,656
    Blog Entries
    7
    Rep Power
    21

    Default Re: Error in Javax.Swing.ImageIcon

    I both your server and clients are running the same Java version, try to run your program again and see ... (make sure you recompile your program against that latest Java version).

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  5. #5
    raj.mscking@gmail.com's Avatar
    raj.mscking@gmail.com is offline Senior Member
    Join Date
    Jan 2012
    Location
    TamilNadu
    Posts
    288
    Rep Power
    3

    Default Re: Error in Javax.Swing.ImageIcon

    Thank you sir..,
    i try now..,

  6. #6
    raj.mscking@gmail.com's Avatar
    raj.mscking@gmail.com is offline Senior Member
    Join Date
    Jan 2012
    Location
    TamilNadu
    Posts
    288
    Rep Power
    3

    Default Re: Error in Javax.Swing.ImageIcon

    Thanks Mr.Jos!
    it is running well sir..,
    I am very Happy With You Mr.Jos..,
    Thank to Jesus..,

  7. #7
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,656
    Blog Entries
    7
    Rep Power
    21

    Default Re: Error in Javax.Swing.ImageIcon

    Good to read that it runs now; the error message was trying to tell you what was wrong: the serial version ids were different so there were two different versions of one and the same class; so your client(s) and server were running different versions of Java. Learning how to read error messages pays off ;-)

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  8. #8
    raj.mscking@gmail.com's Avatar
    raj.mscking@gmail.com is offline Senior Member
    Join Date
    Jan 2012
    Location
    TamilNadu
    Posts
    288
    Rep Power
    3

    Default Re: Error in Javax.Swing.ImageIcon

    I am happy with your idea sir..,
    Have A Happy Day..,

Similar Threads

  1. Replies: 33
    Last Post: 09-06-2010, 10:49 PM
  2. download javax.swing.filechooser?
    By spalax in forum New To Java
    Replies: 5
    Last Post: 08-17-2009, 11:27 AM
  3. use of javax.swing.text.html
    By newbieal in forum New To Java
    Replies: 3
    Last Post: 10-09-2008, 06:45 PM
  4. Replies: 1
    Last Post: 08-01-2007, 06:10 AM
  5. map javax.swing.text.Element to javax.swing.text.View
    By elizabeth in forum New To Java
    Replies: 1
    Last Post: 07-30-2007, 07:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •