This section is designed to give you a quick reference point for common problems with their solutions when targeting the Java VM with CodeWarrior. This should be the first place you look before contacting technical support.
Troubleshooting questions and answers cover the following main categories:
This section deals with problems encountered writing Java code using the CodeWarrior development environment. The following issues are covered in this section:
The following errors are encountered when building Java applications (depending on which host CodeWarrior is running on, and which VM is being used):
Could not execute <ClassName>: The system cannot find the file specified.
Can't find class <ClassName>
NoClassDefFound
The common cause of this error is the incorrect entry of the Main Class name in the Java Target panel. Open this panel by choosing Edit > TargetName Settings (where TargetName is the name of the build target in question),
then select Java Target from the settings panels list on the left side of the window.
Make sure that the Main Class field matches the name of the main class in your code. Remember
that class names are case sensitive; and you must specify the
fully-qualified class name when a class is in a package.
If this field does match your main class exactly, make sure that you have a virtual machine installed on your computer. CodeWarrior can use the Apple MRJ, Sun JDK 1.1.6 (or higher), and Microsoft Internet Explorer 4.0 as a virtual machine. We include all of these on the CodeWarrior CD(s). You can specify which one you want to use via the Virtual Machine pop-up menu in the Java Target panel. You can also download the latest versions from Apple, Sun or Microsoft.
This error may be worded in one of the following ways, depending on which host CodeWarrior is running on, and which VM is being used:
File not found when looking for: <ClassName>
java.lang.NullPointerException
load: class <ClassName> not found
This is usually the result of the class name specified in the
applet HTML tag not matching the actual class name in the Java code.
Make sure that the class name in the applet tag matches the name of the main class in your code. Also be
sure that the name of the class file matches the name of the main
class. Remember that class names are case sensitive.
My install is missing the .jar extension in the File Mappings settings panel. What are the correct entries for this extension?
If you are missing the default entry for Jar files in the File Mappings settings panel, make sure that the entry you add is set up the following way:
With these settings, added .jar files will be found by imported classes in your project.
Linker errors unrelated to my Java project are stopping the debugger.
Check to see if you have the debugger set to break on all exceptions.
Set the Debug > Break on Java Exceptions menu to Uncaught Exceptions or Exceptions in targeted classes. This should prevent breaking on exceptions being thrown by the
Java VM. Otherwise, just press OK when the exception window is displayed, and you should be able
to continue debugging.
When I try to debug my application that merges the classes.zip file into the project output, the CodeWarrior IDE 3.2 immediately
quits with an error type 12.
Merging the classes.zip file into the output causes the output file to bloat to over
4 megabytes. Do not merge the classes.zip file into the project output.
Running applets from within the CodeWarrior IDE causes the Macintosh to attempt to connect to the internet.
Try setting up your TCP/IP control panel like so:
Enter a domain name like "mylocalhost." |
Create a file named "hosts" in the system Preferences folder, and add this line to it"
Where [IP Address] is the same address used in the IP address field in the TCP/IP control panel.
You should use the File > Configurations menu command in the TCP/IP control panel to save these settings
so you can easily switch between your normal internet settings
and the new "local server" settings.
This section deals mainly with problems encountered converting older CodeWarrior Java projects to the latest release. The following issues are covered in this section:
The Droplet project type was used in previous versions of CodeWarrior to make a "pseudo" stand-alone applet. Droplet is no longer supported by CodeWarrior.
While the Droplet type is no longer supported, you can still make a stand-alone Java application with CodeWarrior. The CodeWarrior project converter does not convert your project to the new type for you. The best method is to use the stand-alone Applet stationery and create a new project. Then add your Java source files to this project.
See "Stand-alone Applications for Mac OS" for more information.
If you find you are having problems not covered in this section,
please send a bug report to Metrowerks support, cw_support@metrowerks.com, and that information will be added to future versions of this
manual.