The Artima Developer Community
Sponsored Link

Java Answers Forum
Need help with a redirect browser snippet

1 reply on 1 page. Most recent reply: Aug 9, 2003 12:51 PM by ricky

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Bernadette Philbrick

Posts: 1
Nickname: bcp1961
Registered: Aug, 2003

Need help with a redirect browser snippet Posted: Aug 6, 2003 9:11 AM
Reply to this message Reply
Advertisement
I'm completely new to java, and am trying to figure out how to get this code snippet I picked up to work. The following code is what I saved as "geturl.java" but when I try to use the javac compiler on it I get tons of errors.
How do I get this to work...I'm very confused...

import java.applet.*;
import java.awt.*;

public class geturl extends Applet {

try
{
URL url = new URL (getDocumentBase(),
"http://java.about.com/index.htm");
applet.getAppletContext().showDocument (url);
}
catch (MalformedURLException mue)
{
// handle Exception
}

}

Thanks
Bernadette


ricky

Posts: 8
Nickname: ricky30000
Registered: Jul, 2003

Re: Need help with a redirect browser snippet Posted: Aug 9, 2003 12:51 PM
Reply to this message Reply
import java.awt.*;
import java.net.*;
import java.applet.*;
import java.applet.AppletContext;
import java.util.*;



public class geturl extends Applet
{

public void init()
{

try
{

URL url = new URL (getDocumentBase(), "http://java.about.com/index.htm");
AppletContext browser = getAppletContext();
browser.showDocument(url);

}
catch( MalformedURLException e)
{
e.printStackTrace();
}
}
}

You didn't have an init method every applet has an init method

Flat View: This topic has 1 reply on 1 page
Topic: interacting with ftp prompt when using apache commons net package Previous Topic   Next Topic Topic: calling batch file from java function

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use