1

Topic: java, showing news at startup...

hi i want my prog to show the news when i start it up, so far i have this:-

public void news(String web)
{
String temp = "Error"; int a = 0;
try
{
URL url = new URL(web);
URLConnection urlconnection = url.openConnection();
BufferedReader input = null;
input = new BufferedReader(new InputStreamReader(urlconnection.getInputStream()));
while((temp = input.readLine()) != null)
{
  line[a] = temp;
  a++;
}
}
catch(Exception e){System.out.println(e);}
}

and this is the thing that displays it:-

        System.out.println("Deobed by teh lovable Kaitnieks");
        System.out.println("Checking for updates...");
        System.out.println("");
        System.out.println("");
        try{Thread.sleep(1500);}
        catch(InterruptedException _ex){}
        System.out.println("+*********************************************************+");
        System.out.println("+                      Updater                            +");
        System.out.println("+*********************************************************+");
        System.out.println("+-+-+-+-+-+-+*=  You have version 1.6 =*+-+-+-+-+-+-+-+-+-+");
        System.out.println("+          The newest version is version " + checkupdate("http://www.kylebot.net/bot_data/version.txt") + "              +");
        System.out.println("+      If you need to update, get the newest version      +");
        System.out.println("+              from http://www.kylebot.net                +");
        System.out.println("+*********************************************************+");
        System.out.println("");
        System.out.println("");
        System.out.println("Getting the news....");
        try{Thread.sleep(1500);}
        catch(InterruptedException _ex){}
        System.out.println("+*********************************************************+");
        System.out.println("+                         News                            +");
        System.out.println("+*********************************************************+");
        System.out.println("+-+-+-+-+-+-+-+*= KyleBot version 1.6 =*+-+-+-+-+-+-+-+-+-+");
        System.out.println(news("http://www.kylebot.net/bot_data/news.txt"));
        System.out.println("+*********************************************************+");
    }

The update part works but that only reads 1 line, the other 1 (news) reads 20 lines i think. the error i get when i compile is this:-

mudclient.java:283: 'void' type not allowed here
        System.out.println(news("http://www.kylebot.net/bot_data/news.txt"));
                               ^
1 error
Press any key to continue . . .

plz can some1 give me the FULL code to fix it i mean if i need to add somthing just tell me EXACLY what to add and where, i dont usualy c/p its just that i'm goin 2 florida at 9:00am 2morrow.

*removed by Rickard*
^ 1337 php and mySQL sig
Like annoying people with visual basic? http://www.annoyingvb.com <-- the home for virus/spammers/trojans. ect source code!

2 (edited by Reines 2004-10-07 18:46)

Re: java, showing news at startup...

public int news(String web)
{
String temp = "Error"; int a = 0;
try
{
URL url = new URL(web);
URLConnection urlconnection = url.openConnection();
BufferedReader input = null;
input = new BufferedReader(new InputStreamReader(urlconnection.getInputStream()));
while((temp = input.readLine()) != null)
{
  line[a] = temp;
  a++;
}
}
catch(Exception e){System.out.println(e);}
return a;
}
System.out.println("Deobed by teh lovable Kaitnieks");
        System.out.println("Checking for updates...");
        System.out.println("");
        System.out.println("");
        try{Thread.sleep(1500);}
        catch(InterruptedException _ex){}
        System.out.println("+*********************************************************+");
        System.out.println("+                      Updater                            +");
        System.out.println("+*********************************************************+");
        System.out.println("+-+-+-+-+-+-+*=  You have version 1.6 =*+-+-+-+-+-+-+-+-+-+");
        System.out.println("+          The newest version is version " + checkupdate("http://www.kylebot.net/bot_data/version.txt") + "              +");
        System.out.println("+      If you need to update, get the newest version      +");
        System.out.println("+              from http://www.kylebot.net                +");
        System.out.println("+*********************************************************+");
        System.out.println("");
        System.out.println("");
        System.out.println("Getting the news....");
        try{Thread.sleep(1500);}
        catch(InterruptedException _ex){}
        System.out.println("+*********************************************************+");
        System.out.println("+                         News                            +");
        System.out.println("+*********************************************************+");
        System.out.println("+-+-+-+-+-+-+-+*= KyleBot version 1.6 =*+-+-+-+-+-+-+-+-+-+");
        int length = news("http://www.kylebot.net/bot_data/news.txt");
        for(int a = 0;a < length;a++)
            System.out.println(line[a]);
        System.out.println("+*********************************************************+");
    }