This discussion is archived
2 Replies Latest reply: Jan 4, 2013 5:30 AM by rukbat RSS

Running a class

982393 Newbie
Currently Being Moderated
Put this in the wrong forum. Hopefully this is better for my question.

I'm having a problem with Displayer, the second program in Java 2 for Dummies (I know, hush!)

It will run as a file, but not as a project. Plus, it runs at compile, but will not run from the page.

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

<html>
<head>
<title>Untitled</title>
</head>
<body>
<applet code="Displayer" codebase="classes" width="300" height="200">
</applet>

</body>
</html>
Then the code is:
/**
*
* @author John Howard
*/
class Displayer {

/**
* @param args the command line arguments
*/
public static void main(String args[]) {
// TODO code application logic here
System.out.println("You'll love Java!");
}
}

I'm using NetBeans 7.2

Any help appreciated, new to Java, old-time programmer.
  • 1. Re: Running a class
    gimbal2 Guru
    Currently Being Moderated
    ... its not an applet, its just a regular Java class. If that book is making you think this is supposed to work, toss it and buy a proper one. If you're deviating from the book, stop doing that. Be patient and work through it in the pace it is proposing.

    Also stay away from applets, they are not what makes Java useful. If you must do something in the browser consider JavaFX 2, once you've learned plain old Java of course.

    As for the forum: stick the New to Java for now. And finally: use \
     tags when posting code. Welcome to the forum.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
  • 2. Re: Running a class
    rukbat Guru Moderator
    Currently Being Moderated
    +... thread moved to the New To Java forum.+
    It is probably smart to stay with that particular forum until you're better skilled.    Replies to your posts will be gentler there.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points