The problem exists with any app I try to compile or run.

When compiling the SwingApplication.java program from Sun's swing
tutorial on-line I get the following:

SwingApplication.java:12: class JLabel not found in class
SwingApplication
        final JLabel label = new JLabel(labelPrefix + "0    ");
              ^
SwingApplication.java:12: class JLabel not found in class
SwingApplication
        final JLabel label = new JLabel(labelPrefix + "0    ");
                                 ^
SwingApplication.java:14: class JButton not found in class
SwingApplication
        JButton button = new JButton("I'm a Swing button!");
        ^
SwingApplication.java:14: class JButton not found in class
SwingApplication
        JButton button = new JButton("I'm a Swing button!");
                             ^
SwingApplication.java:29: class JPanel not found in class
SwingApplication
        JPanel pane = new JPanel();
        ^
SwingApplication.java:29: class JPanel not found in class
SwingApplication
        JPanel pane = new JPanel();
                          ^
SwingApplication.java:30: variable BorderFactory not found in class
SwingApplication
        pane.setBorder(BorderFactory.createEmptyBorder(
                       ^
SwingApplication.java:46: variable UIManager not found in class
SwingApplication
                UIManager.getCrossPlatformLookAndFeelClassName());
                ^
SwingApplication.java:45: variable UIManager not found in class
SwingApplication
            UIManager.setLookAndFeel(
            ^
SwingApplication.java:50: class JFrame not found in class
SwingApplication
        JFrame frame = new JFrame("SwingApplication");
        ^
SwingApplication.java:50: class JFrame not found in class
SwingApplication
        JFrame frame = new JFrame("SwingApplication");
                           ^
11 errors

When I run this program :
----------------------------------------------------------------------
// Fig. 2.8: Addition.java
// An addition program

import javax.swing.JOptionPane;          // import class JOptionPane

public class Addition {
   public static void main( String args[] )
   {
      String firstNumber,                   // First string entered by
user
             secondNumber;                  // Second dtring entered by
user
      int    number1,                       // First number to add
             number2,                       // Second number to add
             sum;                           // Sum of number1 and
number2

      // read in first number from user as a string
      firstNumber =
         JOptionPane.showInputDialog("Enter first integer" );

      // read in second number from user as a string
      secondNumber =
         JOptionPane.showInputDialog("Enter second integer" );

      // convert numbers from type String to type int
      number1 = Integer.parseInt( firstNumber );
      number2 = Integer.parseInt( secondNumber );

      // add the numbers
      sum = number1 + number2;

      // display the results
      JOptionePane.showMessageDialog(
         null, "The sum is " + sum, "Results",
         JOptionPane.PLAIN.MESSAGE );

      System.exit ( 0 );      // terminate the program
   }
}
--------------------------------------------------------------------------

I get the following:

at java.lang.Throwable.<init>.(Throwable.java:40)
at java.lang.Error.<init>(Error.java:21)
at java.lang.LinkageError.<init>(LinkageError.java:21)
at java.lang. NoClassDefFoundError.<init>(NoClassDefFound Error.java:21)




----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to