Results 1 to 8 of 8
Thread: Error in Javax.Swing.ImageIcon
- 01-28-2012, 08:51 AM #1
Senior Member
- Join Date
- Jan 2012
- Location
- TamilNadu
- Posts
- 162
- Rep Power
- 2
Error in Javax.Swing.ImageIcon
Hi To All!
.gif)
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");
}
}
"
- 01-28-2012, 08:55 AM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,372
- Blog Entries
- 7
- Rep Power
- 17
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,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 01-28-2012, 09:07 AM #3
Senior Member
- Join Date
- Jan 2012
- Location
- TamilNadu
- Posts
- 162
- Rep Power
- 2
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..,
- 01-28-2012, 09:20 AM #4
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,372
- Blog Entries
- 7
- Rep Power
- 17
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,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 01-28-2012, 09:25 AM #5
Senior Member
- Join Date
- Jan 2012
- Location
- TamilNadu
- Posts
- 162
- Rep Power
- 2
Re: Error in Javax.Swing.ImageIcon
Thank you sir..,
i try now..,
- 01-28-2012, 09:47 AM #6
Senior Member
- Join Date
- Jan 2012
- Location
- TamilNadu
- Posts
- 162
- Rep Power
- 2
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..,
- 01-28-2012, 10:02 AM #7
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,372
- Blog Entries
- 7
- Rep Power
- 17
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,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 01-28-2012, 12:14 PM #8
Senior Member
- Join Date
- Jan 2012
- Location
- TamilNadu
- Posts
- 162
- Rep Power
- 2
Similar Threads
-
Issue in reading .bmp file using javax.swing.ImageIcon
By Cbani in forum AWT / SwingReplies: 33Last Post: 09-06-2010, 10:49 PM -
download javax.swing.filechooser?
By spalax in forum New To JavaReplies: 5Last Post: 08-17-2009, 11:27 AM -
use of javax.swing.text.html
By newbieal in forum New To JavaReplies: 3Last Post: 10-09-2008, 06:45 PM -
Error: javax.swing.AbstractButton cannot be applied to...
By barney in forum AWT / SwingReplies: 1Last Post: 08-01-2007, 06:10 AM -
map javax.swing.text.Element to javax.swing.text.View
By elizabeth in forum New To JavaReplies: 1Last Post: 07-30-2007, 07:02 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks