I am writing a simple applet (my first) to retrieve the most recent status from a twitter account. This works fine when running from javaw.exe launched from within eclipse. However, when run from a browser I get the error:
java.security.AccessControlException: access denied (java.net.SocketPermission twitter.com:80 connect, resolve)
Any advice on how to avoid this?
The call:
private void updateStatus() {
try {
Twitter client = new Twitter("user", "pw");
Status status = client.getStatus();
addItem(status.toString());
}
catch (Throwable t) {
addItem(t.getMessage());
}
}
The connection to the client is succeeding. It is the getStatus() call which throws the exception. I notice that eclipse adds "-Djava.security.policy=java.policy.applet" to javaw.exe, not sure if this has anything to do with why it works from eclipse and not from within a browser. Frustratingly, I tried to run the same javaw.exe command directly with the same CL parameters and PATH as eclipse uses successfully. However, when I run it directly javaw.exe exits immediately. jtwitter is a simple wrapper on the Twitter API.