Article View: borland.public.jbuilder.java.language
Article #15649Security violation from applet
From: Nathan Katzenstein
Date: Wed, 19 May 1999 00:00
Date: Wed, 19 May 1999 00:00
64 lines
2195 bytes
2195 bytes
First Java Applet for me!! Trying to read a remote HTML page.
When i run the following applet in an HTML file, i get the following
error:
Applet Monitor security violation: security.class from local disk trying
to access url: http://ibm.com
What am I missing?????
Nathan
import java.awt.*;
import java.net.*;
import java.io.*;
import java.applet.Applet;
public class Monitor extends Applet
{
public void start()
{
try
{
// Check to see that a command parameter was entered
//if (args.length != 1)
{
// Print message, pause, then exit
//System.err.println ("Invalid command parameters");
//System.in.read();
//System.exit(0);
}
// Create an URL instance
URL url = new URL("http:////www.ibm.com");
// Get an input stream for reading
InputStream in = url.openStream();
// Create a buffered input stream for efficency
BufferedInputStream bufIn = new BufferedInputStream(in);
// Repeat until end of file
for (;;)
{
int data = bufIn.read();
// Check for EOF
if (data == -1)
break;
else
System.out.print ( (char) data);
}
}
catch (MalformedURLException mue)
{
System.err.println ("Invalid URL");
}
catch (IOException ioe)
{
System.err.println ("I/O Error - " + ioe);
}
}
}
Technical Details
Message-ID:
<3742F83E.413E754B@prenhall.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,30cb1802a2a37a58,start X-Google-Attributes: gidf74b3,public From: Nathan Katzenstein <nathank@prenhall.com> Subject: Security violation from applet Date: 1999/05/19 Message-ID: <3742F83E.413E754B@prenhall.com> X-Deja-AN: 479703119 Content-Transfer-Encoding: 7bit Organization: Another Netscape Collabra Server User Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language