java.net.socketpermission
Hi , i'm trying to access a remote webpage and i keep getting a java.net.socketpermission from google i understand i need to grant pemission if this is the case can someone please direct me to a webpage that explains what and how , thanks .
import javax.swing.JApplet;
import java.awt.Graphics;
import javax.swing.*;
import java.util.Date;
import java.io.*;
import java.net.*;
publicclass pcratioextends JAppletimplements Runnable{
privateint w, h;
Thread t=null;
private JLabel display =new JLabel("Start");
int SleepTime = 100 ;// 1 minute == 60000
publicvoid init( )
{
display =new JLabel("Initiliazing");
getContentPane().add(display);
w = 45;
h = 50;
start();
}
publicvoid paint(Graphics g)
{
//g.drawRect(w, h, 20, 80);
}
publicvoid stop()
{
t=null;
}
publicvoid run()
{
long starttime = System.currentTimeMillis();
Thread currentThread = Thread.currentThread();
while (currentThread==t)
{
generatepc();
repaint();
try{
starttime+=SleepTime;
Thread.sleep(Math.max(0,starttime-System.currentTimeMillis()));
}
catch (InterruptedException e)
{
break;
}
}
}
publicvoid start()
{
t=new Thread(this);
t.start();
}
publicvoid generatepc()
{
Date date =new Date();
long currenttime = System.currentTimeMillis();
String temp = String.valueOf(currenttime);
display.setText(date.getHours()+":"+date.getMinutes()+":"+date.getSeconds());
getpage();
}
publicvoid getpage()
{
String input;
URL url;
BufferedReader in;
try{
url =new URL("http://www.google.com");
in =new BufferedReader(new InputStreamReader(url.openStream()));
}catch (MalformedURLException e){
System.out.println("BAD URL");
}catch(IOException e){
System.out.println("CANT CONNECT");
}
}
}

