File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Writing my first program - need a little help!

 
Linsey Johnson
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Marilyn de Queiroz
Sheriff
Posts: 9059
12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does your first line look like this:

public class App extends java.applet.Applet

??

I'm not familiar with a java.awt.Applet class.
 
Linsey Johnson
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My first lines read:

public class App
{
public static void main(String[] args)
{
then I begin declaring variables.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Marilyn de Queiroz
Sheriff
Posts: 9059
12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you trying to run it?

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 ]
 
Linsey Johnson
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 9059
12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Linsey Johnson
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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??
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ryan Newcombe
Greenhorn
Posts: 24
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had the same problem as you did at first because I was clicking the run button. I had to right click on app.jav in the upper left quadrant of Jbuilder---then click run from there.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic