Compiling, running, and debugging tutorial
To find and fix compiler errors,
"Frame1.java" Error #300: constructor Double() not found
in class java.lang.Double at line 39, column 31
JBuilder positions the cursor on line 39, column 31 in the editor, the location of the error.
The error message indicates that the Java class java.lang.Double
does not contain a parameterless constructor. The highlighted statement is attempting to create a new Double
object that does not have a parameter. If you look at the constructors in the java.lang.Double
class, you'll see that all constructors require a parameter. Additionally, if you look a few lines further on in the program, you'll see that the Double
object, valueTwoDouble
, is constructed with an initial value of 0.0.
Ctrl+Shift+Space
to display ParameterInsight, JBuilder's pop-up window that displays the required parameter type. You can also right-click the Double()
method and choose Browse Symbol to open the source in the editor.
0.0
between the parenthesis on line 39. The statement will now read:
Double valueOneDouble = new Double(0.0)
Modified,
indicating that you've made changes to the file.
"Frame1.java" Error 300: variable subtractresultDisplay not found
in class DebugTutorial.Frame1 at line 244, column 5
This error indicates that the variable subtractresultDisplay
in line 243 has not been defined.
subtractresultDisplay
in the Text To Find field. Make sure the Case Sensitive option is turned off. Click the Search From Start Of File option to start the search from the beginning of the file.
Notice that two of the three references to this label are subtractResultDisplay
; there is an uppercase R
in Result
. Casing is critical in Java: subtractresultDisplay
is not the same as subtractResultDisplay
.
subtractresultDisplay
to subtractResultDisplay
.
To use CodeInsight to fix a compiler error,
setTest()
method in javax.swing.JLabel.
"Frame1.java" Error #300: method setTest(java.lang.String) not
found in class javax.swing.JLabel at line 255, column 27
JBuilder positions the cursor on line 255, column 27.
Ctrl+Space
while the cursor is positioned after the dot (.). This will display the CodeInsight pop-up window that displays available member functions.
setText
by typing setText
or scrolling. Once selected, double-click it or press Enter. The setText()
method is inserted in the editor after the dot, replacing the incorrect setTest
method name. A tool tip displays the expected method parameter type.