Jump to content
  • Advertisement
Sign in to follow this  
Talib

[java] URL access denied

This topic is 5453 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi I wrote the following code (as a start):
/*
 * Applet.java
 *
 * Created on 14 October 2004, 10:36
 */

/**
 *
 * @author  Default
 */
import java.net.*;
import java.io.*;

public class Applet extends java.applet.Applet {
    
    public void init() {
        try{
            URL yahoo = new URL("http://www.yahoo.com/");
            
            System.out.println(yahoo.getContent());
            
        }
        catch (MalformedURLException e){}
        catch (IOException e){}
  

     }
    
}


but I get a access denied error. After a bit of reading I know it has something to with the Security manager not allowing me to access URL not on my localhost. Is there anyway of bypassing this? All I need to do is be able to read the HTML code of a webpage. Any help would be appreciated. Talib

Share this post


Link to post
Share on other sites
Advertisement
If this applet is served from a normal web server, you could set up a gateway program that the applet could access to get to the URL you want. If not, then I think you have to digitally sign your applet and ask for permission to access other resources. I have never done it, so I don't know the specifics.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!