java.io

I just posted this message and it seemed to dissapear >=(. SO here it is again. I made a program that asks for the users input. I make a random number then ask for the user to guese. Then it says higher or lower. It worked fine compiled and ran in the command prompt. But when i tried to run it online it didnt work. I think it said that it could not find java.io.

Heres the code

import java.io.*;

class numfun {

public static void main(String[] args) throws IOException {

BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

System.out.println("Welcome to num fun BETA");

System.out.println("What Do You Want To Do (1-3):");

System.out.println("1 Play Game");

System.out.println("2 Rules");

System.out.println("3 Exit");

int menuChoice = Integer.parseInt(in.readLine());

if (menuChoice==1) {

playGame();

}

}

static void playGame() throws IOException {

System.out.println("--");

System.out.println("Im thinking of a number from 1 to 100");

System.out.println("What if your guese");

numbertime();

}

static void numbertime() throws IOException {

BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

int num = (int) (Math.random() * 100);

System.out.println("Choose Now");

int Choice = 0;

while (Choice != num) {

Choice = Integer.parseInt(in.readLine());

if (Choice < num) {

System.out.println("The number is higher");

} else if (Choice > num) {

System.out.println("The number is lower");

}

}

System.out.println("You WIN");

}

}

Heres the html:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>

<head>

<title>Untitled</title>

</head>

<body>

<APPLET CODE="numfun.class" WIDTH=150 HEIGHT=25>

</APPLET>

</body>

</html>

did i do something wrong in the html or the code itself or did i have to compile it a cretain way.. Thanks for the help :)

[2196 byte] By [JavaMan33] at [2007-9-27 22:36:14]
# 1
You're going to have to run that as an applet instead of an application.
dunedinhigh at 2007-7-7 13:21:30 > top of Java-index,Archived Forums,Java Programming...
# 2
You can't run console applications as an applet.
danbas at 2007-7-7 13:21:30 > top of Java-index,Archived Forums,Java Programming...
# 3

You are trying to run an application as an applet. Don't work that way.

Look here.

http://search.java.sun.com/search/java/index.jsp?and=convert+applet+application&phr=&qt=&not=&field=title&since=&nh=10&col=javaforums&rf=0&Search.x=32&Search.y=10

You want Application to Applet

bbritta at 2007-7-7 13:21:30 > top of Java-index,Archived Forums,Java Programming...
# 4
=/ stupid tutorial said otherwizeWell...im still looking through the stuff...Im having a we bit of trouble understanding it
JavaMan33 at 2007-7-7 13:21:30 > top of Java-index,Archived Forums,Java Programming...