FAQ About CodeWarrior
Why can't I load a file into CodeWarrior and compile it?
You cannot compile a .java file unless it is part of a project. You
can't simply open the .java file in CodeWarrior and then compile it.
For your own sake, please remember to put each CodeWarrior project in
its own folder (directory). If you don't keep things organized, you
will get confused later on.
My program won't compile. It says exception in thread "main"
java.lang.NoClassDefFoundError: MyJLiveWindow
CodeWarrior has to know which class contains method main. You haven't
told it. You can find out how to do this by listening to the second
activity on the fourth page of the CodeWarrior tutorial on ProgramLive.
I listened to the activity and did what it said; I told CodeWarrior
that the class that contains method main is MyJLiveWindow.java, and it
still doesn't work!
You have to tell it the name of the class, MyJLiveWindow, and not the
name of the file, MyJLiveWindow.java.
When I use stationary to start CodeWarrior, the class with method
main is TrivialApplication. I don't like this name; can I change it?
Yes, when CodeWarrior creates a project using stationEry (not
stationAry), the class with method main has name TrivialApplication.
You can change the name of this file to something else as follows, assuming
that you have the project open in CodeWarrior:
- Open file TrivialApplication and edit it: change the name of the class
from TrivialApplication to MyName (whichever name you want).
- Use menu File item SaveAs to save the file with the name MyName.java.
Make sure the new file MyName.java is placed in the project folder;
you may have to navigate in the file dialog box to get this to happen.
Note that this new file appears in the project window instead of TrivalApplication.java.
- Change the name of the class that contains method main to MyName (as
discussed in the
second activity of page 4 of the CodeWarrior Lesson of ProgramLive).
Why doesn't program Draw1 close when you click the close box in its
graphics window? (This is the program that you make using files Draw1.java
and JLiveGraphics.java; class Draw1 contains method main. You can get
these files from ProgramLive using menu Tools item List Programs, clicking
Title input/output, and clicking button Folder.)
It doesn't close because we didn't program it to do that. In the next
edition of ProgramLive, we will. Later
in the course, we may have time to show YOU how to do that!
On the Macintosh, you can close program execution by choosing "Quit"
from the Apple menu or by hitting keys Command-Q. On the PC, click the
close box in the Java console. You can use ctrl-alt-del, but that's
messy.
|