I wrote my very first program for an Intro to Java class. My program compiles without any errors, but instead of running it gives me the following message: The class App is not a subclass of java.awt.Applet If anyone could tell me what on earth this means and/or help me to fix it, I would greatly appreciate it.
If you want to use your class as if it were an Applet, then it needs to be an Applet (by extending java.applet.Applet - or that Swing version). Take a look at The Writing Applets Trail of Sun's Java Tutorial.
When you run the program, you should type "java App" on the command line (at the DOS prompt).
Are you trying run this application in your browser or appletviewer by any chance? [ October 01, 2002: Message edited by: Marilyn de Queiroz ]
Joined: Oct 01, 2002
I am using JBuilder 4 Foundation (it came with our textbook) to write the program, and I am just clicking the run button to run it.
Marilyn de Queiroz
Joined: Jul 22, 2000
My best guess is the something in the setup of JBuilder was set to run your stuff as an applet ... and you didn't write an applet. This is one reason most instructors don't promote beginners using an IDE. You spend more time learning about the IDE than about the language (in this case Java). Check your "preferences"/"options" in JBuilder. Ask questions about JBuilder in the IDE forum (further down the list of forums here).
Maybe you can find something on this page that will be helpful to you. It won't help you with the JBuilder stuff, though.
Joined: Oct 01, 2002
I managed to fix my first problem by basically starting a new project and copying in all of my code. However, I managed to get a new problem. When I compile, I get three warnings: Warning #: 908 : check sourcepath; source d:\Project2\App\src\app\App.java cannot be found on sourcepath by appending \App.java to each sourcepath entry I get one for each class in my project. What does this mean, and how do I fix it??
Is JBuilder a REQUIREMENT for this course?? It is hard for a beginner to separate the issues that belong to each. Why don't you try working outside of JBuilder. Download the sdk from Sun and use that instead. Just use notepad.exe. You will get better help here if you do.
"JavaRanch, where the deer and the Certified play" - David O'Meara