Missing method body and cannot resolve symbol

I keep getting these two errors when trying to compile. I know that I need to call my fibonacci and factorial functions from the main function. Is this why I am getting the missing method body error? How do I correct this?
Am I getting the cannot resolve symbol because I have to set the num and fact to equal something?
Thanks
public class Firstassignment
public static void main(String[]args)
     System.out.println();
public static void fibonacci(String[]args);
     int even=1;
     int odd=1;
     while (odd<=100);
     System.out.println(even);
     int temp = even;
     even = odd;
     odd = odd + temp;
public static void factorial (String[]args);
     for (int count=1;
     count<=num;
     count++);
     fact = fact * count;
     outputbox.printLine("Factorial of" + num + "is" + fact);

Hey... :o)
the problem is that you've put semicolons at the end of the function signature, like this:
public static void fibonacci(String[]args);
}that should happen only when the function is abstract... so ur function should actually look like this:
public static void fibonacci(String[]args)
}also, i think you've missed out on the declarations (like what are fact and num??)....

Similar Messages

  • Need help - method call error cannot resolve symbol

    My code compiles fine but I continue to receive a method call error "cannot resolve symbol - variable superman" - can't figure out why. Here is my code:
    public static String caesar(String message, int shift)
    {   [b]String result = "";
    for(int i = 0; i < message.length(); ++i)
    {   [b]char newChar = message.charAt(i + shift);
    result += newChar;
    return result.toUpperCase();
    I entered "superman" for message and "3" for the shift. Can someone please help? Thanks!

    Your post worked great - especially since it made me realize I was going about it all wrong! I was attempting to convert "superman" to "vxshupdq" - basically a cipher shift starting at index 0 and shifting it 3 character values which would result in s changing to v. I restructured my code:
    public static String caesar(String message, int shift)
    {   [b]String result = "";
    for(int i = 0; i < message.length(); ++i)
    {   [b]char newChar = message.charAt(i);
    result += (newChar + shift) % message.length();
    return result.toUpperCase();
    But it's displaying the result as a "60305041". How can I get it to display the actual characters?

  • Cannot find package error and cannot resolve symbol error

    Hi
    I have a file Assignment.java in C:\TIJCode\c03 folder. But this file belongs to the default package. This file imports a package com.bruceeckel.simpletest which is in C:\TIJCode\ folder. Now this package has a file named Test.java which accesses a few more files fromt he same package.
    I set the classpath to C:\TIJCode. When i try to run the Assignment file I get an error saying package com.bruceeckel.simpletest cannot be found and cannot resolve symbol error. symbol: Test Class: Assignment.
    The files in com.bruceeckel.simpletest package were not compiled. So I first tried to do that. But I get a cannot resolve symbol error while trying to compile a file NumOfLinesException which inherits SImpleTestException file. The exact error message is
    NumOfLinesException.java : 7 : cannot resolve symbol
    symbol : class SimpleTestException
    location : class com.bruceeckel.simpletest.NumOfLinesException extends SimpleTestException
    The exact code in each of above mentioned files is
    //: c03:Assignment.java
    // Assignment with objects is a bit tricky.
    // From 'Thinking in Java, 3rd ed.' (c) Bruce Eckel 2002
    // www.BruceEckel.com. See copyright notice in CopyRight.txt.
    import com.bruceeckel.simpletest.*;
    class Number {
    int i;
    public class Assignment {
    static Test monitor = new Test();
    public static void main(String[] args) {
    Number n1 = new Number();
    Number n2 = new Number();
    n1.i = 9;
    n2.i = 47;
    System.out.println("1: n1.i: " + n1.i +
    ", n2.i: " + n2.i);
    n1 = n2;
    System.out.println("2: n1.i: " + n1.i +
    ", n2.i: " + n2.i);
    n1.i = 27;
    System.out.println("3: n1.i: " + n1.i +
    ", n2.i: " + n2.i);
    monitor.expect(new String[] {
    "1: n1.i: 9, n2.i: 47",
    "2: n1.i: 47, n2.i: 47",
    "3: n1.i: 27, n2.i: 27"
    } ///:~
    //: com:bruceeckel:simpletest:SimpleTestException.java
    // From 'Thinking in Java, 3rd ed.' (c) Bruce Eckel 2002
    // www.BruceEckel.com. See copyright notice in CopyRight.txt.
    package com.bruceeckel.simpletest;
    public class SimpleTestException extends RuntimeException {
    public SimpleTestException(String msg) {
    super(msg);
    } ///:~
    //: com:bruceeckel:simpletest:NumOfLinesException.java
    // From 'Thinking in Java, 3rd ed.' (c) Bruce Eckel 2002
    // www.BruceEckel.com. See copyright notice in CopyRight.txt.
    package com.bruceeckel.simpletest;
    public class NumOfLinesException extends SimpleTestException {
    public NumOfLinesException(int exp, int out) {
    super("Number of lines of output and "
    + "expected output did not match.\n" +
    "expected: <" + exp + ">\n" +
    "output: <" + out + "> lines)");
    } ///:~
    //: com:bruceeckel:simpletest:Test.java
    // Simple utility for testing program output. Intercepts
    // System.out to print both to the console and a buffer.
    // From 'Thinking in Java, 3rd ed.' (c) Bruce Eckel 2002
    // www.BruceEckel.com. See copyright notice in CopyRight.txt.
    package com.bruceeckel.simpletest;
    import java.io.*;
    import java.util.*;
    import java.util.regex.*;
    public class Test {
    // Bit-shifted so they can be added together:
    public static final int
    EXACT = 1 << 0, // Lines must match exactly
    AT_LEAST = 1 << 1, // Must be at least these lines
    IGNORE_ORDER = 1 << 2, // Ignore line order
    WAIT = 1 << 3; // Delay until all lines are output
    private String className;
    private TestStream testStream;
    public Test() {
    // Discover the name of the class this
    // object was created within:
    className =
    new Throwable().getStackTrace()[1].getClassName();
    testStream = new TestStream(className);
    public static List fileToList(String fname) {
    ArrayList list = new ArrayList();
    try {
    BufferedReader in =
    new BufferedReader(new FileReader(fname));
    try {
    String line;
    while((line = in.readLine()) != null) {
    if(fname.endsWith(".txt"))
    list.add(line);
    else
    list.add(new TestExpression(line));
    } finally {
    in.close();
    } catch (IOException e) {
    throw new RuntimeException(e);
    return list;
    public static List arrayToList(Object[] array) {
    List l = new ArrayList();
    for(int i = 0; i < array.length; i++) {
    if(array[i] instanceof TestExpression) {
    TestExpression re = (TestExpression)array;
    for(int j = 0; j < re.getNumber(); j++)
    l.add(re);
    } else {
    l.add(new TestExpression(array[i].toString()));
    return l;
    public void expect(Object[] exp, int flags) {
    if((flags & WAIT) != 0)
    while(testStream.numOfLines < exp.length) {
    try {
    Thread.sleep(1000);
    } catch (InterruptedException e) {
    throw new RuntimeException(e);
    List output = fileToList(className + "Output.txt");
    if((flags & IGNORE_ORDER) == IGNORE_ORDER)
    OutputVerifier.verifyIgnoreOrder(output, exp);
    else if((flags & AT_LEAST) == AT_LEAST)
    OutputVerifier.verifyAtLeast(output,
    arrayToList(exp));
    else
    OutputVerifier.verify(output, arrayToList(exp));
    // Clean up the output file - see c06:Detergent.java
    testStream.openOutputFile();
    public void expect(Object[] expected) {
    expect(expected, EXACT);
    public void expect(Object[] expectFirst,
    String fname, int flags) {
    List expected = fileToList(fname);
    for(int i = 0; i < expectFirst.length; i++)
    expected.add(i, expectFirst[i]);
    expect(expected.toArray(), flags);
    public void expect(Object[] expectFirst, String fname) {
    expect(expectFirst, fname, EXACT);
    public void expect(String fname) {
    expect(new Object[] {}, fname, EXACT);
    } ///:~

    What do you have in the C:\TIJCode\ directory? Does the directory structure mimic the package structure for the stuff you're importing?

  • Illegal start of expression and cannot resolve symbol HELP

    Can someone pls help me?
    These are the two problems:
    --------------------Configuration: j2sdk1.4.1_02 <Default>--------------------
    C:\Documents and Settings\Laila\My Documents\CMT2080\Coursework\Game\Mindboggler.java:291: illegal start of expression
    public void inputJButtonActionPerformed( ActionEvent event )
    ^
    C:\Documents and Settings\Laila\My Documents\CMT2080\Coursework\Game\Mindboggler.java:285: cannot resolve symbol
    symbol: method inputJButtonActionPerformed (java.awt.event.ActionEvent)
                   inputJButtonActionPerformed( event);
    Here is my code :
    //Mind boggler quiz
    //Marcelyn Samson
    import java.awt.*;
    import java.awt.event.*;
    import java.text.DecimalFormat;
    import javax.swing.*;
    import javax.swing.border.*;
    import java.lang.*;
    public class Mindboggler extends JFrame
              // JPanel for welcome window
              private JPanel welcomeJPanel;
              private JPanel presetJPanel;
         private JLabel titleJLabel;
         private JLabel quizJLabel;
         private JLabel girlJLabel, headJLabel;
         private JLabel introJLabel;
         private JButton startJButton;
         // JPanel for questionone window
         private JPanel questiononeJPanel;
         private JLabel textJLabel;
         private JPanel becksJPanel;
         private JButton oneJButton, twoJButton, threeJButton, fourJButton, nextJButton;
              //JPanel for questiontwo window
              private JPanel questiontwoJPanel;
              private JPanel orlandoJPanel;
              private JLabel q2JLabel;
              private JCheckBox lordJCheckBox;
              private JCheckBox faceJCheckBox;
              private JCheckBox piratesJCheckBox;
              private JButton next2JButton;
         private JButton inputJButton;
         //JPanel for questionthree
         private JPanel questionthreeJPanel;
         private JPanel howmuchJPanel;
         private JLabel howmuchJLabel;
         private JLabel nameJLabel;
         private JTextField nameJTextField;
         private JLabel moneyJLabel;
         private JTextField moneyJTextField;
         private JButton next3JButton;
         //Publics
         public JPanel welcomeJFrame, questionJFrame, questiontwoJFrame, questionthreeJFrame;
         //contentPane
              public Container contentPane;
              //no argument constructor
              public Mindboggler()
                   createUserInterface();
              //create and position components
              private void createUserInterface()/////////////////////////; semo colon do not edit copy paste
                   //get contentPane and set layout to null
                   contentPane = getContentPane();
                   contentPane.setLayout ( null );
                   welcome();
                   //set properties of applications window
                   setTitle( "Mindboggler" ); // set JFrame's title bar string
              setSize( 600, 400 ); // set width and height of JFrame
              setVisible( true ); // display JFrame on screen
              } // end method createUserInterface
              public void welcome(){
                        // set up welcomeJPanel
                   welcomeJPanel = new JPanel();
                   welcomeJPanel.setLayout( null );
                   welcomeJPanel.setBounds(0, 0, 600, 400);
                   welcomeJPanel.setBackground( Color.GREEN );
                   // set up textJLabel
                   titleJLabel = new JLabel();
                   titleJLabel.setText( "Mind Boggler" );
                   titleJLabel.setLocation( 30, 10);
                   titleJLabel.setSize( 550, 70);
                   titleJLabel.setFont( new Font( "SansSerif", Font.PLAIN, 30 ) );
                   titleJLabel.setHorizontalAlignment( JLabel.CENTER );
                   welcomeJPanel.add( titleJLabel );
                   // set up presetJPanel
                   presetJPanel = new JPanel();
                   presetJPanel.setLayout( null );
                   presetJPanel.setBounds( 150, 10, 300, 80 );
                   presetJPanel.setBackground( Color.GRAY );
                   welcomeJPanel.add( presetJPanel );
                   //setup Intro JLabel
                   introJLabel = new JLabel();
                   introJLabel.setText( "Think, think, think. Can you get all the questions right?" );
                   introJLabel.setBounds( 40, 100, 500, 200 );
                   introJLabel.setFont( new Font( "SansSerif", Font.PLAIN, 18 ) );
                   introJLabel.setHorizontalAlignment( JLabel.CENTER );
                   welcomeJPanel.add(introJLabel);
                   //set up head JLabel
                   headJLabel = new JLabel();
                   headJLabel.setIcon( new ImageIcon( "head.jpeg") );
                   headJLabel.setBounds( 540, 5, 40, 160 );
                   headJLabel.setHorizontalAlignment( JLabel.CENTER );
                   welcomeJPanel.add(headJLabel);
                        //setup girlJLabel
                   girlJLabel = new JLabel();
                   girlJLabel.setIcon( new ImageIcon( "girl.Jjpeg") );
                   girlJLabel.setBounds( 5, 10, 60, 100 );
                   girlJLabel.setHorizontalAlignment( JLabel.CENTER );
                   welcomeJPanel.add(girlJLabel);
                        //set up startJbutton
                   startJButton = new JButton();
                   startJButton.setText( "Start" );
                   startJButton.setBounds(250, 300, 100, 30);
                   startJButton.setFont( new Font( "SansSerif", Font.BOLD, 14) );
                   welcomeJPanel.add(startJButton);
                   contentPane.add(welcomeJPanel);
                   startJButton.addActionListener(
                        new ActionListener(){
                             public void actionPerformed(ActionEvent e){
                                  question();
              public void question()
                   //set up question one JPanel
                   welcomeJPanel.setVisible(false);
                   questiononeJPanel = new JPanel();
         questiononeJPanel.setLayout( null );
              questiononeJPanel.setBounds(0, 0, 600,400);
              questiononeJPanel.setBackground( Color.GREEN );
              // set up textJLabel
              textJLabel = new JLabel();
              textJLabel.setText( "Who did Beckham supposedly cheat with?" );
              textJLabel.setLocation( 20, 20);
              textJLabel.setSize( 550, 70);
              textJLabel.setFont( new Font( "SansSerif", Font.BOLD, 20 ) );
              textJLabel.setHorizontalAlignment( JLabel.CENTER );
              questiononeJPanel.add( textJLabel );
                   // set up presetJPanel
              becksJPanel = new JPanel();
              becksJPanel.setLayout( null );
              becksJPanel.setBorder( new TitledBorder(
         "Question 1" ) );
              becksJPanel.setBounds( 10, 10, 570, 80 );
              becksJPanel.setBackground( Color.GRAY );
              questiononeJPanel.add( becksJPanel );
                   // set up oneJButton
              oneJButton = new JButton();
              oneJButton.setBounds( 10, 120, 300, 40 );
              oneJButton.setText( "Britney Spears" );
              oneJButton.setBackground( Color.ORANGE );
              questiononeJPanel.add( oneJButton );
              // set up twoJButton
              twoJButton = new JButton();
              twoJButton.setBounds( 10, 180, 300, 40 );
              twoJButton.setText( "Meg Ryan" );
              twoJButton.setBackground( Color.ORANGE );
              questiononeJPanel.add( twoJButton );
              // set up threeJButton
              threeJButton = new JButton();
              threeJButton.setBounds( 10, 240, 300, 40 );
              threeJButton.setText( "Rebecca Loos" );
              threeJButton.setBackground( Color.ORANGE );
              questiononeJPanel.add( threeJButton );
              // set up fourJButton
              fourJButton = new JButton();
              fourJButton.setBounds( 10, 300, 300, 40 );
              fourJButton.setText( "Angelina Jolie" );
              fourJButton.setBackground( Color.ORANGE );
              questiononeJPanel.add( fourJButton );
                   // set up nextJButton
                   nextJButton = new JButton();
                   nextJButton.setBounds ( 375, 300, 150, 40 );
                   nextJButton.setText("Next");
                   nextJButton.setBackground( Color.GRAY );
                   questiononeJPanel.add( nextJButton );
                   contentPane.add(questiononeJPanel);
              nextJButton.addActionListener(
                        new ActionListener(){
                             public void actionPerformed(ActionEvent e){
                                  questiontwo();
              public void questiontwo()
                   //set up question two JPanel
                   questiononeJPanel.setVisible(false);
                   questiontwoJPanel=new JPanel();
                   questiontwoJPanel.setLayout(null);
                   questiontwoJPanel.setBounds(0, 0, 600, 400);
                   questiontwoJPanel.setBackground( Color.GREEN );
                   // set up q2JLabel
              q2JLabel = new JLabel();
              q2JLabel.setBounds( 20, 20, 550, 70 );
              q2JLabel.setText( "What films has Orlando Bloom starred in?" );
              q2JLabel.setFont(new Font( "SansSerif", Font.BOLD, 20 ) );
         q2JLabel.setHorizontalAlignment( JLabel.CENTER );
    questiontwoJPanel.add(q2JLabel);
    //set up orlandoJPanel
    orlandoJPanel = new JPanel();
    orlandoJPanel.setLayout(null);
    orlandoJPanel.setBorder( new TitledBorder("Question 2"));
    orlandoJPanel.setBounds( 10, 10, 570, 80);
    orlandoJPanel.setBackground(Color.GRAY);
    questiontwoJPanel.add(orlandoJPanel);
    // set up lordJCheckBox
              lordJCheckBox = new JCheckBox();
              lordJCheckBox.setBounds( 16, 112, 200, 24 );
              lordJCheckBox.setText( "1. Lord of The Rings" );
              questiontwoJPanel.add( lordJCheckBox );
                   // set up faceJCheckBox
              faceJCheckBox = new JCheckBox();
              faceJCheckBox.setBounds( 16, 159, 200, 24 );
              faceJCheckBox.setText( "2. Face Off" );
              questiontwoJPanel.add( faceJCheckBox );
              // set up piratesJCheckBox
              piratesJCheckBox = new JCheckBox();
              piratesJCheckBox.setBounds( 16, 206, 200, 24 );
              piratesJCheckBox.setText( "3. Pirates of The Caribean" );
              questiontwoJPanel.add( piratesJCheckBox );
              // set up inputJButton
              inputJButton = new JButton();
              inputJButton.setBounds(20, 256, 200, 21 );
              inputJButton.setText( "Input answer" );
              questiontwoJPanel.add( inputJButton );
    inputJButton.addActionListener(
         new ActionListener()
              //event handler called when user clicks inputJButton
              public void actionPerformed( ActionEvent event )
                   inputJButtonActionPerformed( event);
    //show JOptionMessages when user clicks on JCheckBoxes and inputJButton
    public void inputJButtonActionPerformed( ActionEvent event )
         //display error message if no JCheckBoxes is checked
         if ( ( !lordJCheckBox.isSelected() && !faceJCheckBox.isSelected() && !piratesJCheckBox.isSelected() ) )
              //display error message
              JOptionPane.showMessageDialog( null, "Please check two boxes", JOptionPane.ERROR_MESSAGE );
         // if lordjcheckbox and pirates is selected = right
         else
              if ( ( lordJCheckBox.isSelected() && piratesJCheckBox.isSelected() ))
                   JOptionPane.showMessageDialog(null, "Thats RIGHT!");
              //if others are selected = wrong
              else
                   if ( (lordJCheckBox.isSelected() && faceJCheckBox.isSelected() ))
                        JOptionPane.showMessageDialog(null, "Thats WRONG");
                   else
                        ( (faceJCheckBox.isSelected() && piratesJCheckBox.isSelected() ))
                             JOptionPane.showMessageDialog(null, "Thats WRONG");
    // set up nest2JButton
              next2JButton = new JButton();
              next2JButton.setBounds( 155, 296, 94, 24 );
              next2JButton.setText( "Next" );
              questiontwoJPanel.add( next2JButton );
    contentPane.add(questiontwoJPanel);
    next2JButton.addActionListener(
         new ActionListener(){
              public void actionPerformed(ActionEvent e){
                   questionthree();
    } // end questiontwo
    public void questionthree()
         //setup questionthree JPanel
         questiontwoJPanel.setVisible(false);
         questionthreeJPanel = new JPanel();
         questionthreeJPanel.setLayout(null);
         questionthreeJPanel.setBounds(0, 0, 600, 400);
         questionthreeJPanel.setBackground( Color.GREEN);
              // main method
              public static void main( String[] args )
              Mindboggler application = new Mindboggler();
              application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
              } // end method main
    }// end class
    WOULD BE VERY GEATFUL

    Just want to say thank you by the way for trying to help. Ive moved public void inputJButtonActionPerformed( ActionEvent event ) outside of brackets. Now i have a different problem on it. Sorry about this.
    PROBLEM: --------------------Configuration: <Default>--------------------
    C:\Documents and Settings\Laila\My Documents\CMT2080\Coursework\Game\Mindboggler.java:353: 'else' without 'if'
    else ( ( !lordJCheckBox.isSelected() && !faceJCheckBox.isSelected && !piratesJCheckBox.isSelected() ) )
    ^
    1 error
    Process completed.
    MY CODE:
    //Mind boggler quiz
    //Marcelyn Samson
    import java.awt.*;
    import java.awt.event.*;
    import java.text.DecimalFormat;
    import javax.swing.*;
    import javax.swing.border.*;
    import java.lang.*;
    public class Mindboggler extends JFrame
              // JPanel for welcome window
              private JPanel welcomeJPanel;
              private JPanel presetJPanel;
         private JLabel titleJLabel;
         private JLabel quizJLabel;
         private JLabel girlJLabel, headJLabel;
         private JLabel introJLabel;
         private JButton startJButton;
         // JPanel for questionone window
         private JPanel questiononeJPanel;
         private JLabel textJLabel;
         private JPanel becksJPanel;
         private JButton oneJButton, twoJButton, threeJButton, fourJButton, nextJButton;
              //JPanel for questiontwo window
              private JPanel questiontwoJPanel;
              private JPanel orlandoJPanel;
              private JLabel q2JLabel;
              private JCheckBox lordJCheckBox;
              private JCheckBox faceJCheckBox;
              private JCheckBox piratesJCheckBox;
              private JButton next2JButton;
         private JButton inputJButton;
         //JPanel for questionthree
         private JPanel questionthreeJPanel;
         private JPanel howmuchJPanel;
         private JLabel howmuchJLabel;
         private JLabel nameJLabel;
         private JTextField nameJTextField;
         private JLabel moneyJLabel;
         private JTextField moneyJTextField;
         private JButton next3JButton;
         //Publics
         public JPanel welcomeJFrame, questionJFrame, questiontwoJFrame, questionthreeJFrame;
         //contentPane
              public Container contentPane;
              //no argument constructor
              public Mindboggler()
                   createUserInterface();
              //create and position components
              private void createUserInterface()/////////////////////////; semo colon do not edit copy paste
                   //get contentPane and set layout to null
                   contentPane = getContentPane();
                   contentPane.setLayout ( null );
                   welcome();
                   //set properties of applications window
                   setTitle( "Mindboggler" ); // set JFrame's title bar string
              setSize( 600, 400 ); // set width and height of JFrame
              setVisible( true ); // display JFrame on screen
              } // end method createUserInterface
              public void welcome(){
                        // set up welcomeJPanel
                   welcomeJPanel = new JPanel();
                   welcomeJPanel.setLayout( null );
                   welcomeJPanel.setBounds(0, 0, 600, 400);
                   welcomeJPanel.setBackground( Color.GREEN );
                   // set up textJLabel
                   titleJLabel = new JLabel();
                   titleJLabel.setText( "Mind Boggler" );
                   titleJLabel.setLocation( 30, 10);
                   titleJLabel.setSize( 550, 70);
                   titleJLabel.setFont( new Font( "SansSerif", Font.PLAIN, 30 ) );
                   titleJLabel.setHorizontalAlignment( JLabel.CENTER );
                   welcomeJPanel.add( titleJLabel );
                   // set up presetJPanel
                   presetJPanel = new JPanel();
                   presetJPanel.setLayout( null );
                   presetJPanel.setBounds( 150, 10, 300, 80 );
                   presetJPanel.setBackground( Color.GRAY );
                   welcomeJPanel.add( presetJPanel );
                   //setup Intro JLabel
                   introJLabel = new JLabel();
                   introJLabel.setText( "Think, think, think. Can you get all the questions right?" );
                   introJLabel.setBounds( 40, 100, 500, 200 );
                   introJLabel.setFont( new Font( "SansSerif", Font.PLAIN, 18 ) );
                   introJLabel.setHorizontalAlignment( JLabel.CENTER );
                   welcomeJPanel.add(introJLabel);
                   //set up head JLabel
                   headJLabel = new JLabel();
                   headJLabel.setIcon( new ImageIcon( "head.jpeg") );
                   headJLabel.setBounds( 540, 5, 40, 160 );
                   headJLabel.setHorizontalAlignment( JLabel.CENTER );
                   welcomeJPanel.add(headJLabel);
                        //setup girlJLabel
                   girlJLabel = new JLabel();
                   girlJLabel.setIcon( new ImageIcon( "girl.Jjpeg") );
                   girlJLabel.setBounds( 5, 10, 60, 100 );
                   girlJLabel.setHorizontalAlignment( JLabel.CENTER );
                   welcomeJPanel.add(girlJLabel);
                        //set up startJbutton
                   startJButton = new JButton();
                   startJButton.setText( "Start" );
                   startJButton.setBounds(250, 300, 100, 30);
                   startJButton.setFont( new Font( "SansSerif", Font.BOLD, 14) );
                   welcomeJPanel.add(startJButton);
                   contentPane.add(welcomeJPanel);
                   startJButton.addActionListener(
                        new ActionListener(){
                             public void actionPerformed(ActionEvent e){
                                  question();
              public void question()
                   //set up question one JPanel
                   welcomeJPanel.setVisible(false);
                   questiononeJPanel = new JPanel();
         questiononeJPanel.setLayout( null );
              questiononeJPanel.setBounds(0, 0, 600,400);
              questiononeJPanel.setBackground( Color.GREEN );
              // set up textJLabel
              textJLabel = new JLabel();
              textJLabel.setText( "Who did Beckham supposedly cheat with?" );
              textJLabel.setLocation( 20, 20);
              textJLabel.setSize( 550, 70);
              textJLabel.setFont( new Font( "SansSerif", Font.BOLD, 20 ) );
              textJLabel.setHorizontalAlignment( JLabel.CENTER );
              questiononeJPanel.add( textJLabel );
                   // set up presetJPanel
              becksJPanel = new JPanel();
              becksJPanel.setLayout( null );
              becksJPanel.setBorder( new TitledBorder(
         "Question 1" ) );
              becksJPanel.setBounds( 10, 10, 570, 80 );
              becksJPanel.setBackground( Color.GRAY );
              questiononeJPanel.add( becksJPanel );
                   // set up oneJButton
              oneJButton = new JButton();
              oneJButton.setBounds( 10, 120, 300, 40 );
              oneJButton.setText( "Britney Spears" );
              oneJButton.setBackground( Color.ORANGE );
              questiononeJPanel.add( oneJButton );
              // set up twoJButton
              twoJButton = new JButton();
              twoJButton.setBounds( 10, 180, 300, 40 );
              twoJButton.setText( "Meg Ryan" );
              twoJButton.setBackground( Color.ORANGE );
              questiononeJPanel.add( twoJButton );
              // set up threeJButton
              threeJButton = new JButton();
              threeJButton.setBounds( 10, 240, 300, 40 );
              threeJButton.setText( "Rebecca Loos" );
              threeJButton.setBackground( Color.ORANGE );
              questiononeJPanel.add( threeJButton );
              // set up fourJButton
              fourJButton = new JButton();
              fourJButton.setBounds( 10, 300, 300, 40 );
              fourJButton.setText( "Angelina Jolie" );
              fourJButton.setBackground( Color.ORANGE );
              questiononeJPanel.add( fourJButton );
                   // set up nextJButton
                   nextJButton = new JButton();
                   nextJButton.setBounds ( 375, 300, 150, 40 );
                   nextJButton.setText("Next");
                   nextJButton.setBackground( Color.GRAY );
                   questiononeJPanel.add( nextJButton );
                   contentPane.add(questiononeJPanel);
              nextJButton.addActionListener(
                        new ActionListener(){
                             public void actionPerformed(ActionEvent e){
                                  questiontwo();
              public void questiontwo()
                   //set up question two JPanel
                   questiononeJPanel.setVisible(false);
                   questiontwoJPanel=new JPanel();
                   questiontwoJPanel.setLayout(null);
                   questiontwoJPanel.setBounds(0, 0, 600, 400);
                   questiontwoJPanel.setBackground( Color.GREEN );
                   // set up q2JLabel
              q2JLabel = new JLabel();
              q2JLabel.setBounds( 20, 20, 550, 70 );
              q2JLabel.setText( "What films has Orlando Bloom starred in?" );
              q2JLabel.setFont(new Font( "SansSerif", Font.BOLD, 20 ) );
         q2JLabel.setHorizontalAlignment( JLabel.CENTER );
    questiontwoJPanel.add(q2JLabel);
    //set up orlandoJPanel
    orlandoJPanel = new JPanel();
    orlandoJPanel.setLayout(null);
    orlandoJPanel.setBorder( new TitledBorder("Question 2"));
    orlandoJPanel.setBounds( 10, 10, 570, 80);
    orlandoJPanel.setBackground(Color.GRAY);
    questiontwoJPanel.add(orlandoJPanel);
    // set up lordJCheckBox
              lordJCheckBox = new JCheckBox();
              lordJCheckBox.setBounds( 16, 112, 200, 24 );
              lordJCheckBox.setText( "1. Lord of The Rings" );
              questiontwoJPanel.add( lordJCheckBox );
                   // set up faceJCheckBox
              faceJCheckBox = new JCheckBox();
              faceJCheckBox.setBounds( 16, 159, 200, 24 );
              faceJCheckBox.setText( "2. Face Off" );
              questiontwoJPanel.add( faceJCheckBox );
              // set up piratesJCheckBox
              piratesJCheckBox = new JCheckBox();
              piratesJCheckBox.setBounds( 16, 206, 200, 24 );
              piratesJCheckBox.setText( "3. Pirates of The Caribean" );
              questiontwoJPanel.add( piratesJCheckBox );
              // set up inputJButton
              inputJButton = new JButton();
              inputJButton.setBounds(20, 256, 200, 21 );
              inputJButton.setText( "Input answer" );
              questiontwoJPanel.add( inputJButton );
    inputJButton.addActionListener(
         new ActionListener()
              //event handler called when user clicks inputJButton
              public void actionPerformed( ActionEvent event )
                   inputJButtonActionPerformed( event);
    // set up nest2JButton
              next2JButton = new JButton();
              next2JButton.setBounds( 155, 296, 94, 24 );
              next2JButton.setText( "Next" );
              questiontwoJPanel.add( next2JButton );
    contentPane.add(questiontwoJPanel);
    next2JButton.addActionListener(
         new ActionListener(){
              public void actionPerformed(ActionEvent e){
                   questionthree();
    } // end questiontwo
    public void questionthree()
         //setup questionthree JPanel
         questiontwoJPanel.setVisible(false);
         questionthreeJPanel = new JPanel();
         questionthreeJPanel.setLayout(null);
         questionthreeJPanel.setBounds(0, 0, 600, 400);
         questionthreeJPanel.setBackground( Color.GREEN);
         //setup howmuchJLabel
         howmuchJLabel = new JLabel();
         howmuchJLabel.setText("I'm a student and would be very greatful if you could donate some money as it would help me very much.");
         howmuchJLabel.setBounds(20, 20, 550, 70);
         howmuchJLabel.setFont(new Font("SansSerif",Font.BOLD,14));
         howmuchJLabel.setHorizontalAlignment(JLabel.CENTER);
         questionthreeJPanel.add(howmuchJLabel);
         //setup howmuchJPanel
         howmuchJPanel = new JPanel();
         howmuchJPanel.setLayout(null);
         howmuchJPanel.setBorder( new TitledBorder("Question 3"));
         howmuchJPanel.setBounds(10, 10, 570, 80);
         howmuchJPanel.setBackground( Color.GRAY);
         questionthreeJPanel.add(howmuchJPanel);
         //setup nameJLabel
         nameJLabel = new JLabel();
         nameJLabel.setText("Name");
         nameJLabel.setBounds(10, 160, 150, 24);
         nameJLabel.setFont(new Font("SansSerif",Font.BOLD,12));
         questionthreeJPanel.add(nameJLabel);
         //setup nameJTextField
         nameJTextField = new JTextField();
         nameJTextField.setBounds(125, 160, 200, 24 );
         questionthreeJPanel.add(nameJTextField);
         contentPane.add(questionthreeJPanel);
         //show JOptionMessages when user clicks on JCheckBoxes and inputJButton
    public void inputJButtonActionPerformed( ActionEvent event )
         //display error message if no JCheckBoxes is checked
         else ( ( !lordJCheckBox.isSelected() && !faceJCheckBox.isSelected && !piratesJCheckBox.isSelected() ) )
              //display error message
              JOptionPane.showMessageDialog( null, "Please check two boxes", JOptionPane.ERROR_MESSAGE );
         // if lordjcheckbox and pirates is selected = right
         else
              if ( ( lordJCheckBox.isSelected() && piratesJCheckBox.isSelected() ))
                   JOptionPane.showMessageDialog(null, "Thats RIGHT!");
              //if others are selected = wrong
              else
                   if ( (lordJCheckBox.isSelected() && faceJCheckBox.isSelected() ))
                        JOptionPane.showMessageDialog(null, "Thats WRONG");
                   else
                        ( (faceJCheckBox.isSelected() && piratesJCheckBox.isSelected() ))
                             JOptionPane.showMessageDialog(null, "Thats WRONG");
              // main method
              public static void main( String[] args )
              Mindboggler application = new Mindboggler();
              application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
              } // end method main
    }// end class

  • IntValue - ")" expected and Cannot Resolve Symbol

    I used intValue to convert an Integer to primitive (see below) and ran into syntax errors.
                    LogDataBean lb = new LogDataBean();
                    lb.setLog_time( ( String )row.get( "LOG_TIME" ) );
                    lb.setLog_pid( intValue( Integer )row.get( "LOG_PID" )); //where syntax error occur
                    lb.setLog_user( ( String )row.get( "LOG_USER" ) );the row.get( "LOG_PID" ) gets the value of the column "LOG_PID" from a database table and returns an object. Therefore, I first cast the object to Integer and then try to use the intValue to convert it to a primitive int.
    But, the statement resulted in compilation error: ")" expected.
    When I modified the statement a little bit by adding a pair of parenthesis:
                    lb.setLog_pid( intValue( ( Integer )row.get( "LOG_PID" ) ) ); //where syntax error occurI got "Cannot Resolve Symbol: intValue". I have import java.lang.Integer in the beginning of the class.

    Integer.parseInt(row.get( "LOG_PID" ))
    I'm assuming thats what you want to. Although you syntax is terribly wrong. Have a look at some tutorials.

  • Try/catch and 'cannot resolve symbol'

    I am relatively new to java programming and something has me puzzled...
    Why do I get a 'cannot resolve symbol' message when I include a variable definition in a try/catch section. When I put it/them before the 'try' statement it compiles as expected. How are statements inside a try compiled differently than those outside?
    try {
        StringBuffer pageBuffer = new StringBuffer();
        String inputLine;
        BufferedReader in = new BufferedReader(
           new InputStreamReader( theURL.openStream() ) );
        while ((inputLine = in.readLine()) != null) {
             System.out.println(inputLine);
            pageBuffer.append(inputLine);
        in.close();
    } catch (Exception ignored) {}C:\Projects\WebExplorer\PageVisitor.java:142: cannot resolve symbol
    symbol : variable pageBuffer
    location: class PageVisitor
         return pageBuffer.toString();
    Paul

    A try block is just like any other block delimited by {...} in that all variables declared inside it are local to that block. I.e. they are not visible or usable anywhere outside it. Your pageBuffer variable, for example, is a local variable that can only be used inside the try-block in which it is declared.
    Your obvious solution, knowing that, is to declare the variables outside the try and catch blocks. Remember to initialize them (even to null), otherwise the compiler will complain about variables that may not have been initialized.

  • Help.. incompatiable type and cannot resolve symbol error...

    I have this class Box
    class Box{
         private int width;
           private int height;
           private int depth;
           private int BoxCounter;
         public void click()
         BoxCounter = 0;
    }and in my main code, I'm calling it via
    private Box arrBox[];All this goes fine until I try to place code in to make array empty upon a selected action by
    if (color == blue) {arrBox = new Box();}Here I'm getting the error saying that its an incompatible type... it says I have Box but it requires class Box[]...(the ^ pointing at the word "new")
    also, I have this
    public void button()
    arrBox.click()
    }This returns the unable to resolve symbol error (the ^ points at the dot).... I tried changing things around but the problem persists, can someone point out where I hv gone wrong?
    Many thanks

    private Box arrBox[];The line above does not create an array, it only declares that the variable arrBox can refernce an array of type Box. Arrays are objects just like Box - you need a new Box[10], for example, to create the array.
    if (color == blue) {arrBox = new Box();}
    Here I'm getting the error saying that its an
    incompatible type... it says I have Box but it
    requires class Box[]...(the ^ pointing at the word
    "new")As previously stated, arrBox is a reference to an array of Box, not an object instance of Box.
    A lot of your trouble can be resolved by understanding how arrays work in java. Try here.
    http://java.sun.com/docs/books/tutorial/java/data/arrays.html
    You must create an array similar to creating any object. Next, you must create objects to go inside the array. It's difficult without knowing the rest of your code, but here goes.
    private Box[] arrBox = new Box[10];
    for(int index=0;index<arrBox.length;index++)  {
       int color = getColor(index); //I'm making this up
       if(color == blue) arrBox[index] = new Box();
    }The above code will create a new Box for any index where the color is blue. The indices where the color isn't blue are equal to null.

  • PLEASE HELP: cannot resolve symbol class

    it's showing me the error on the following lines 7 and 9
    it says cannot resolve symbol class Name and cannot resolve symbol class Phone
    I also have a package name addressBook and it contains two files Entry.java and Address.java
    Here is the code:
    import java.io.*;
    import addressBook.*;
    public class AddressDr
         public static void main(String[] args)throws IOException
              Name name;
              Address address;
              Phone phone;
              Entry entry;
              String first, last, middle, street, city, state, zip;
              int areaCode, number;
              BufferedReader in;
              in=new BufferedReader(new InputStreamReader(System.in));
              PrintWriter outFile;
              outFile=new PrintWriter(new FileWriter("Entries"));
              System.out.println("Quit entered fot the first name ends the " + "application.");
              System.out.print("Enter first name: ");
              first=in.readLine();
              while (first.compareTo("Quit") !=0)
                   System.out.print("Enter last name: ");
                   last=in.readLine();
                   System.out.print("Enter middle name: ");
                   middle=in.readLine();
                   name=new Name(first, last, middle);
                   System.out.print("Enter street address: ");
                   street=in.readLine();
                   System.out.print("Enter city: ");
                   city=in.readLine();
                   System.out.print("Enter state: ");
                   state=in.readLine();
                   System.out.print("Enter ZIP code: ");
                   zip=in.readLine();
                   address=new Address(street, city, state, zip);
                   System.out.print("Enter areaCode: ");
                   areaCode = Integer.parseInt(in.readLine());
                   System.out.print("Enter number: ");
                   number=Integer.parseInt(in.readLine());
                   phone=new Phone(areaCode, number);
                   entry= new Entry(name, address, phone);
                   entry.writeToFile(outFile);
                   System.out.print("Enter first name: ");
                   first=in.readLine();
              outFile.close();
    }

    OK. Here is how I did it.
    I have AddressDr which is Address driver.
    I have two files Address and Entry which in package addressBook.
    AddressDr:
    import java.io.*;
    import addressBook.*;
    public class AddressDr
         public static void main(String[] args)throws IOException
              Name name;
              Address address;
              Phone phone;
              Entry entry;
              String first, last, middle, street, city, state, zip;
              int areaCode, number;
              BufferedReader in;
              in=new BufferedReader(new InputStreamReader(System.in));
              PrintWriter outFile;
              outFile=new PrintWriter(new FileWriter("Entries"));
              System.out.println("Quit entered fot the first name ends the " + "application.");
              System.out.print("Enter first name: ");
              first=in.readLine();
              while (first.compareTo("Quit") !=0)
                   System.out.print("Enter last name: ");
                   last=in.readLine();
                   System.out.print("Enter middle name: ");
                   middle=in.readLine();
                   name=new Name(first, last, middle);
                   System.out.print("Enter street address: ");
                   street=in.readLine();
                   System.out.print("Enter city: ");
                   city=in.readLine();
                   System.out.print("Enter state: ");
                   state=in.readLine();
                   System.out.print("Enter ZIP code: ");
                   zip=in.readLine();
                   address=new Address(street, city, state, zip);
                   System.out.print("Enter areaCode: ");
                   areaCode = Integer.parseInt(in.readLine());
                   System.out.print("Enter number: ");
                   number=Integer.parseInt(in.readLine());
                   phone=new Phone(areaCode, number);
                   entry= new Entry(name, address, phone);
                   entry.writeToFile(outFile);
                   System.out.print("Enter first name: ");
                   first=in.readLine();
              outFile.close();
    Entry:
    package addressBook;
    import java.io.*;
    public class Entry
         Name name;
         Address address;
         Phone phone;
    public Entry(Name newName, Address newAddress, Phone phoneNumber)
         name = newName;
         address = newAddress;
         phone = phoneNumber;
    public Name knowName()
         return name;
    public Address knowAddress()
         return address;
    public Phone knowPhone()
         return phone;
    public void writeToFile(PrintWriter outFile)
         outFile.println(name.knowFirstName());
         outFile.println(name.knowLastName());
         outFile.println(name.knowMiddleName());
         oufFile.println(address.knowStreet());
         outFile.println(address.knowState());
         outFile.println(address.knowCity());
         outFile.println(address.knowZip());
         outFile.println(phone.knowAreaCode());
         outFile.println(phone.knowDigits());
    Address:
    package addressBook;
    public class Address
         String street;
         String city;
         String state;
         String zipCode;
         public Address(String newStreet, String newCity, String newState, String zip)
              street=newStreet;
              city=newCity;
              state=newState;
              zipCode=zip;
         public String knowStreet()
              return street;
         public String knowCity()
              return city;
         public String knowState()
              return state;
         public String knowZip()
              return zipCode;
    }

  • "cannot resolve symbol" when compiling a class that calls methods

    I am currently taking a Intro to Java class. This problem has my instructor baffled. If I have two classes saved in separate files, for example:
    one class might contain the constructor with get and set statements,
    the other class contains the main() method and calls the constructor.
    The first file compiles clean. When I compile the second file, I get the "cannot resolve symbol error" referring to the first class.
    If I copy both files to floppy and take them to school. I can compile and run them with no problem.
    If I copy the constructor file to the second file and delete the "public" from the class declaration of the constructor, it will compile and run at home.
    At home, I am running Windows ME. At school, Windows 2000 Professional.
    The textbook that we are using came with a CD from which I downloaded the SDK and Runtime Environment. I have tried uninstalling and reinstalling. I have also tried downloading directly from the Sun website and still the error persists.
    I came across a new twist tonight. I copied class files from the CD to my hard drive. 4 separate files. 3 of which are called by the 4th.
    I can run these with no problem.
    Any ideas, why I would have compile errors????
    Thanks!!

    Oooops ... violated....
    Well first a constructor should have the same name as the class name so in our case what we have actually created is a static method statementOfPhilosophy() in class SetUpSite and not a constructor.
    Now why does second class report unresolved symbol ???
    Look at this line
    Class XYZ=new XYZ();
    sounds familiar, well this is what is missing from your second class, since there is no object how can it call a method ...
    why the precompiled classes run is cuz they contain the right code perhaps so my suggestion to you is,
    1) Review the meaning and implementation of Constructors
    2) Ask your instructor to do the same ( no pun intended ... )
    3) Check out this for understanding PATH & CLASSPATH http://www.geocities.com/gaurav007_2000/java/
    4) Look at the "import" statement, when we have code in different files and we need to incorporate some code in another it is always a good idea to use import statement, that solves quite a few errors.
    5) Finally forgive any goof up on this reply, I have looked at source code after 12 months of hibernation post dot com doom ... so m a bit rusty... shall get better soon though :)
    warm regards and good wishes,
    Gaurav
    CW :-> Mother of all computer languages.
    I HAM ( Radio-Active )
    * OS has no significance in this error
    ** uninstalling and reinstalling ? r u nuttttttts ??? don't ever do that again unless your compiler fails to start, as long as it is giving a valid error it is working man ... all we need to do is to interpret the error and try to fix the code not the machine or compiler.

  • Factory method generateRandomCircle: "cannot resolve symbol"

    I have written 2 classes: Point and Circle, which uses Point objects in order to create a Circle object. I have created a factory method for Point, which creates random Point objects and a for Circle, which does the same. "newRandomInstance" works fine for Point, but "generateRandomCircle" throws a "cannot resolve symbol" error. "main" is inside Point class. What's the problem?
    Thanks
    ================================================
    import java.io.*;
    import java.lang.*;
    import java.util.*;
    public class Circle implements Cloneable
    public static Circle generateRandomCircle()
    int a= (int) (Math.random()* Short.MAX_VALUE);
    int b= (int) (Math.random()* Short.MAX_VALUE);
    Point p=new Point(a,b);
    int r= (int) (Math.random()* Short.MAX_VALUE);
    Circle c= new Circle(p,r);
    return c;
    ===============================================
    import java.io.*;
    import java.lang.*;
    import java.util.*;
    public class Point implements Cloneable, Comparable
    public static Point newRandomInstance()
    int x = (int) (Math.random() * Short.MAX_VALUE);
    int y = (int) (Math.random() * Short.MAX_VALUE);
    return new Point(x,y);
    public static void main (String[] args)
    Circle cRandom= generateRandomCircle(); //doesn't work
    System.out.println(cRandom.getCenter()+" "+ cRandom.getRadius());
    Point randomP= newRandomInstance(); //works OK
    randomP.printPoint();
    }

    I tried "Circle cRandom=
    Circle.generateRandomCircle(); " instead of "Circle
    cRandom= generateRandomCircle();" and it worked. Why
    did this happen?Because generateRandomCircle() exists in class Circle and not in class Point where your are trying to use it.
    >
    Function "newRandomInstance()" works either as
    "Point.newRandomInstance()" or as
    "newRandomInstance()", however. Why does this
    controversy exist?No controversy! Your main() is contained within class Point and as such knows about everything that is declared in class Point() but nothing about what is in class Circle unless you tell it to look in class Circle.

  • Cannot resolve symbol error while trying to define methods in a class

    Well, I'm fairly new to java and I'm trying to write a simple program that will take user input for up to 100 die and how many sides they have and will then roll them and output the frequencies of numbers occuring. I have overloaded the constructor for the Die class to reflect different choices the user may have when initializing the Die.
    Here is my code:import java.util.*;
    import java.io.*;
    public class Die
         private final int MIN_FACES = 4;
         private int numFaces;
         private int i = 0;
         private int faceValue;
         private Die currentDie;
         private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
         private String line = null;
         public Die()
              numFaces = 6;
              faceValue = 1;
         public Die (int faces)
              if (faces < MIN_FACES) {
                   numFaces = 6;
                   System.out.println ("Minimum number of faces allowed is 6.");
                   System.out.println ("Setting faces to 6... . . .  .  .  .   .   .   .");
              else
                   numFaces = faces;
              faceValue = 1;
    //Returns an array of Die Objects
         public Die (int num_die, int faces)
              numFaces = faces;
              Die[] protoDie = new Die[num_die];
              for (i = 0; i <= num_die-1; i++)
                   Die currentDie = new Die(numFaces);
                   protoDie = protoDie.initMultiDie(currentDie, i);
         public Die (double num_die)
              int numberOfDie = (int) num_die;
              Die[] protoDie = new Die[numberOfDie];
              System.out.print ("Enter the number of sides for die #" + i);
              for (i=0; i <= protoDie.length; i++) {
              do {
                   try {
                        line = br.readLine();
                        numFaces = Integer.parseInt(line);
                   catch (NumberFormatException nfe) {
                        System.out.println ("You must enter an integer.");
                        System.out.print ("Setting number of dice to 0, please reenter: ");
                   if (numFaces < 0) {
                        System.out.println ("The number of sides must be positive.");
                        numFaces *= -1;
                        System.out.println ("Number of sides is: " + numFaces);
                   else
                      if (numFaces = 0) {
                        System.out.println ("Zero dice is no fun. =[");
                        System.out.print ("Please reenter the number of sides: ");
                   numFaces = 0;
              while (numFaces == 0);
              Die currentDie = new Die(numFaces);
              protoDie[i] = protoDie.initMultiDie(currentDie, i);
              i = 0;
         public Die[] initMultiDie (Die[] protoDie, Die currentDie, int i)
              protoDie[i] = currentDie;
              return protoDie;
         public Die reInit (int sides)
              currentDie.roll();
              return currentDie;
         public int roll()
              faceValue = (int) (Math.random() * numFaces) + 1;
              return faceValue;
    }When I compile I get 2 errors at lines 42 and 73 saying:
    Cannot resolve symbol | symbol: method initMultiDie(Die, int) | location: class Die[] | protoDie[i] = protoDie.initMultiDie(currentDie, i)
    I've tried mixing things up with invoking the method, such as including protoDie in the parameter liist, instead of invoking the initMultiDie method thru the protoDie Die[] object. I'm a little confused as to what I can and cannot do with defining arrays of Objects like Die. Thank you for any input you may be able to provide.
    ~Lije

    I may as well just replace Die with Dice and allow
    Dice to represent a collection of 1 die.. I just like
    to cut on bloat and make my programs be as efficient
    as possible.Efficiency and avoiding code bloat are good goals, but you don't necessarily achieve it by creating the smallest number of classes. If you have N algorithms in M lines, then you have that many, regardless of whether they're in one class or two. A really long source file can be a worse example of bloat than two source files of half the size -- it can be harder to read, less clear in the design, and thus with more bugs...
    The important thing is clarity and a strong design.
    The weird thing is, that initMultiDie is
    what seems to be throwing up the error, but I don't
    see why. Meh, I'm sure I'll figure it out.Refactoring a class to make the design more transparent often helps you figure out bugs.

  • Cannot resolve symbol: method getCodeBase ()

    I`m creating a dice game that makes a sound when player wins or looses. Instaed I`m getting the following error message: Cannot resolve symbol: method getCodeBase (). I think this depends on the fact that I have a separate applet launcher but cannot figure out how to solve this, please help!!
    This is the applet launcher
    import javax.swing.*;
    import java.awt.*;
    // [MC] Public class DiceApplet
    public class DiceApplet extends JApplet
         // [MC] Constructor.
         public DiceApplet()
              // [MC] Sets the contentPane property. This method is called by the constructor.
              this.setContentPane(new DicePanel());
    This is the die class
    import java.awt.*;
    import javax.swing.*;
    // [MC] Public class Die
    public class Die extends JPanel
        // ======================================================================
        // [MC] Instance variable.
        private int myFaceValue;     // [MC] Value that shows on face of die.
        // [MC] End instance variable.
        // ======================================================================
        // [MC] Constructor.
        // [MC] Initialises die to blue background and initial roll.
        public Die()
              // [MC] Sets the background colour of the die to blue.
              setBackground(Color.blue);
              // [MC] Sets the foreground colour of the die to gray.
              setForeground(Color.gray);
              // [MC] Sets the border colour of the die to white.
              setBorder(BorderFactory.createMatteBorder(4, 4, 4, 4, Color.white));
              // [MC] Sets to random initial value.
              roll();
         }     // [MC] End constructor.
        // ======================================================================
        // [MC] Method roll.
        // [MC] Produces random roll in the range of 1 to 6.
        public int roll()
            int val = (int)(6*Math.random() + 1);   // [MC] Range from 1 to 6.
            setValue(val);
            return val;     // [MC] Returns a value from 1 to 6.
        }     // [MC] End method roll.
        // [MC] Method setValue
        // [MC] Sets the value of the die. Causes repaint.
        public void setValue(int dots)
            myFaceValue = dots;
            repaint();    // [MC] Value has changed, must repaint.
        } // [MC] End method setValue.
        // ======================================================================
        // [MC] Method getValue.
        // [MC] Returns result of last roll.
        public int getValue()
            return myFaceValue;
        } // [MC] End method getValue.
        // ======================================================================
        // [MC] Method paintComponent.
        // [MC] Draws dots of die face.
        public void paintComponent(Graphics g)
              // [MC] Call superclass's paint method.
            super.paintComponent(g);
              // [MC] Sets panel width.
            int w = getWidth();
            // [MC] Sets panel height.
            int h = getHeight();
              // [MC] Draws border.
            g.drawRect(0, 0, w-1, h-1);
            // Switch
            switch (myFaceValue)
                case 1: drawDot(g, w/2, h/2);
                        break;
                case 3: drawDot(g, w/2, h/2);
                case 2: drawDot(g, w/4, h/4);
                        drawDot(g, 3*w/4, 3*h/4);
                        break;
                case 5: drawDot(g, w/2, h/2);
                case 4: drawDot(g, w/4, h/4);
                        drawDot(g, 3*w/4, 3*h/4);
                        drawDot(g, 3*w/4, h/4);
                        drawDot(g, w/4, 3*h/4);
                        break;
                case 6: drawDot(g, w/4, h/4);
                        drawDot(g, 3*w/4, 3*h/4);
                        drawDot(g, 3*w/4, h/4);
                        drawDot(g, w/4, 3*h/4);
                        drawDot(g, w/4, h/2);
                        drawDot(g, 3*w/4, h/2);
                        break;
            } // [MC] End switch.
        }     // [MC] End method paintComponent.
        // [MC] Method drawDot.
        /** Utility method used by paintComponent(). */
        private void drawDot(Graphics g, int x, int y)
            // [MC] Gets panel width.
              int w = getWidth();
              // [MC] Gets panel height.
              int h = getHeight();
              // [MC] Local variable.
            int d;
            // [MC] Sets diameter of dot proportional to panel size.
            d = (w + h)/10;
              // [MC] Sets colour for dot to white.
              Color myDotColor = new Color(255, 255, 255);
              g.setColor(myDotColor);
             // [MC] Draws dot.
             g.fillOval(x-d/2, y-d/2, d, d);
        } // [MC] End method drawDot.
    This is the class giving the error message
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.border.*;
    import java.applet.AudioClip;
    import java.applet.Applet;
    import java.net.*;
    // [MC] Public class DicePanel
    public class DicePanel extends JPanel
        // ======================================================================
        // [MC] Instance variables.
        // [MC] Creates new instances of the component for the die.
        private Die myLeftDie;     // [MC] Component for left die.
        private Die myRightDie;     // [MC] Component for right die.
         // [MC] Creates the button (rollButton) to roll the dice.
         private     JButton rollButton = new JButton("Roll Dice");
         // [MC] Creates the text fields. Creates new instance of JTextField.
         // [MC] Creates the text field (rollNumberTextField) to display number of rolls.
         private JTextField rollNumberTextField = new JTextField(20);
         // [MC] Creates the text field (rollResultTextField) to display result of roll.
         private JTextField rollResultTextField = new JTextField(20);
         // [MC] Creates the text field (rollPointsTextField) to display the player`s points.
         private JTextField rollPointsTextField = new JTextField(20);
         // [MC] Creates the text field (gameFinalResultTextField) to display the final game result.
         private JTextField gameFinalResultTextField = new JTextField(20);
        // [MC] Initialises instance variables declared in the inner listeners.
        private int result = 0, resultLeft = 0, resultRight = 0;
         private int rolls = 0;
         private int finalResult = 0;
         private int points = 0;
         private boolean first = true;
         private AudioClip winClip = null;
         private AudioClip looseClip = null;
        // ======================================================================
        // [MC] Constructor. Creates border layout panel.
        DicePanel()
            // [MC] Creates the dice
            myLeftDie  = new Die();
            myRightDie = new Die();
        // ======================================================================
              // [MC] Creates the buttons.
              // [MC] Creates the button (newGameButton) to start new game.
            JButton newGameButton = new JButton("New Game");
              // *[MC] Creates the button (rollButton) to roll the dice.
            // *JButton rollButton = new JButton("Roll Dice");
            // [MC] Sets the font of the buttons.
            // [MC[ Sets the font of the button newGameButton.
            newGameButton.setFont(new Font("Batang", Font.BOLD, 20));
            // [MC[ Sets the font of the button rollButton.
            rollButton.setFont(new Font("Batang", Font.BOLD, 20));
                // [MC] Sets the button border format.
              // [MC] Sets the button with compound borders.
            Border compound;
              // [MC] Border format local variables.
            Border blackline, raisedetched, loweredetched, raisedbevel, loweredbevel, empty;
              // [MC] Initialises border formats.
              //blackline = BorderFactory.createLineBorder(Color.gray);
              raisedetched = BorderFactory.createEtchedBorder(EtchedBorder.RAISED);
              loweredetched = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
              raisedbevel = BorderFactory.createRaisedBevelBorder();
              //loweredbevel = BorderFactory.createLoweredBevelBorder();
              // [MC] Sets compound border format.
            compound = BorderFactory.createCompoundBorder(raisedetched, raisedbevel);
            // [MC] Sets the button (newGameButton) with compound border format.
            newGameButton.setBorder(compound);
            // [MC] Sets the button (rollButton) with compound border format.
              rollButton.setBorder(compound);
            // [MC] Adds listener.
            // [MC] Adds listener to rollButton.
            rollButton.addActionListener(new RollListener());
            // [MC] Adds listener to newGameButton.
            newGameButton.addActionListener(new NewGameListener());
        // ======================================================================
              // [MC] Creates the labels. Creates new instance of JLabel.
              // [MC] Creates the label (rollNumberLabel) for the number of rolls.
              JLabel rollNumberLabel = new JLabel("Roll Number");
              // [MC] Creates the label (rollResultLabel) for the result of roll.
              JLabel rollResultLabel = new JLabel("Roll Result");
              // [MC] Creates the label (rollPointsLabel) for the player`s points.
              JLabel rollPointsLabel = new JLabel("Player Points");
              // [MC] Creates the label (gameFinalResult) for the final game result.
              JLabel gameFinalResultLabel = new JLabel("Final Result");
              // [MC] Sets the label font.
              rollNumberLabel.setFont(new Font("Sansserif", Font.PLAIN, 10));
              rollResultLabel.setFont(new Font("Sansserif", Font.PLAIN, 10));
              rollPointsLabel.setFont(new Font("Sansserif", Font.PLAIN, 10));
              gameFinalResultLabel.setFont(new Font("Sansserif", Font.PLAIN, 10));
              // [MC] Sets the label title alignment.
              rollNumberLabel.setHorizontalAlignment(JLabel.CENTER);
              rollResultLabel.setHorizontalAlignment(JLabel.CENTER);
              rollPointsLabel.setHorizontalAlignment(JLabel.CENTER);
              gameFinalResultLabel.setHorizontalAlignment(JLabel.CENTER);
              // [MC] Sets the label border format.
              //rollNumberLabel.setBorder(loweredetched);
              //rollResultLabel.setBorder(loweredetched);
              //rollPointsLabel.setBorder(loweredetched);
              //gameFinalResultLabel.setBorder(loweredetched);
        // ======================================================================
              // [MC] Sets the text field font.
              rollNumberTextField.setFont(new Font("Sansserif", Font.PLAIN, 16));
              rollResultTextField.setFont(new Font("Sansserif", Font.PLAIN, 16));
              rollPointsTextField.setFont(new Font("Sansserif", Font.PLAIN, 16));
              gameFinalResultTextField.setFont(new Font("Sansserif", Font.BOLD, 16));
              // [MC] Sets the text field text alignment.
              rollNumberTextField.setHorizontalAlignment(JTextField.CENTER);
              rollResultTextField.setHorizontalAlignment(JTextField.CENTER);
              rollPointsTextField.setHorizontalAlignment(JTextField.CENTER);
              gameFinalResultTextField.setHorizontalAlignment(JTextField.CENTER);
              // [MC] Sets the text field text colour.
              gameFinalResultTextField.setForeground(Color.blue);
              // [MC] Sets the text field to not editable.
              rollNumberTextField.setEditable(false);
              rollResultTextField.setEditable(false);
              rollPointsTextField.setEditable(false);
              gameFinalResultTextField.setEditable(false);
        // ======================================================================
              // [MC] Gets sounds.
              winClip =  getAudioClip(getCodeBase(), "bunny1.au");
              looseClip =  getAudioClip(getCodeBase(), "bunny1.au");
        // ======================================================================
              // [MC] Sets the layout manager (GridBagLayout) for this container.
              this.setLayout(new GridBagLayout());
              // [MC] Creates new instance of GridBagConstraints.
              GridBagConstraints c = new GridBagConstraints();
              // [MC] Makes the component fill its display area entirely.
              c.fill = GridBagConstraints.BOTH;
              // [MC] Layouts components.
              // [MC] Adds the component newGameButton to this container.
              c.gridx = 0;     // [MC] Makes this component the leftmost column (column 1).
              c.gridy = 0;     // [MC] Makes this component the uppermost row (row 1).
              c.gridheight = 1;     // [MC] Specifies the number of rows the component uses (1 row).
              c.gridwidth = 2;     // [MC] Specifies the number of columns the component uses (2 columns).
              this.add(newGameButton, c);     // [MC] Adds the button newGameButton.
              // [MC] Adds the component rollButton to this container.
              c.gridx = 2;     // [MC] Makes this component the third column from left (column 3).
              c.gridy = 0;     // [MC] Make this component the uppermost row (row 1).
              c.gridheight = 1;     // [MC] Specifies the number of rows the component uses (1 rows).
              c.gridwidth = 2;     // [MC] Specifies the number of columns the component uses (2 columns).
              this.add(rollButton, c);     // [MC] Adds the button rollButton.
              // [MC] Adds the component rollNumberLabel to this container.
              c.gridx = 0;     // [MC] Makes this component the leftmost column (column 1).
              c.gridy = 3;     // [MC] Makes this component the third row from top (row 3).
              c.gridheight = 1;     // [MC] Specifies the number of rows the component uses (1 row).
              c.gridwidth = 1;     // [MC] Specifies the number of columns the component uses (1 column).
              c.weightx = 0.1;     // [MC] Requests any extra vertical (column) space.
              this.add(rollNumberLabel, c);     // [MC] Adds the label rollNumberLabel.
              // [MC] Adds the component rollResultLabel to this container.
              c.gridx = 1;     // [MC] Makes this component the second column from left (column 2).
              c.gridy = 3;     // [MC] Makes this component the third row from top (row 3).
              c.gridheight = 1;     // [MC] Specifies the number of rows the component uses (1 row).
              c.gridwidth = 1;     // [MC] Specifies the number of columns the component uses (1 column).
              this.add(rollResultLabel, c);     // [MC] Adds the label rollResultLabel.
              // [MC] Adds the component rollPointsLabel to this container.
              c.gridx = 2;     // [MC] Makes this component the third column from left (column 3).
              c.gridy = 3;     // [MC] Makes this component the third row from top (row 3).
              c.gridheight = 1;     // [MC] Specifies the number of rows the component uses (1 row).
              c.gridwidth = 1;     // [MC] Specifies the number of columns the component uses (1 column).
              this.add(rollPointsLabel, c);     // [MC] Adds the label rollPointsLabel.
              // [MC] Adds the component gameFinalResultLabel to this container.
              c.gridx = 3;     // [MC] Makes this component the fourth column from left (column 4).
              c.gridy = 3;     // [MC] Makes this component the third row from top (row 3).
              c.gridheight = 1;     // [MC] Specifies the number of rows the component uses (1 row).
              c.gridwidth = 1;     // [MC] Specifies the number of columns the component uses (1 column).
              this.add(gameFinalResultLabel, c);     // [MC] Adds the label gameFinalResultLabel.
              // [MC] Adds the component rollNumberTextField to this container.
              c.gridx = 0;     // [MC] Makes this component the leftmost column (column 1).
              c.gridy = 4;     // [MC] Makes this component the fourth row from top (row 4).
              c.gridheight = 1;     // [MC] Specifies the number of rows the component uses (1 row).
              c.gridwidth = 1;     // [MC] Specifies the number of columns the component uses (1 column).
              c.weightx = 0.1;     // [MC] Requests any extra vertical (column) space.
              this.add(rollNumberTextField, c);     // [MC] Adds the text field rollNumberTextField.
              // [MC] Adds the component rollResultTextField to this container.
              c.gridx = 1;     // [MC] Makes this component the second column from left (column 2).
              c.gridy = 4;     // [MC] Makes this component the fourth row from top (row 4).
              c.gridheight = 1;     // [MC] Specifies the number of rows the component uses (1 row).
              c.gridwidth = 1;     // [MC] Specifies the number of columns the component uses (1 column).
              this.add(rollResultTextField, c);     // [MC] Adds the text field rollResultTextField.
              // [MC] Adds the component rollPointsTextField to this container.
              c.gridx = 2;     // [MC] Makes this component the third column from left (column 3).
              c.gridy = 4;     // [MC] Makes this component the fourth row from top (row 4).
              c.gridheight = 1;     // [MC] Specifies the number of rows the component uses (1 row).
              c.gridwidth = 1;     // [MC] Specifies the number of columns the component uses (1 column).
              this.add(rollPointsTextField, c);     // [MC] Adds the text field rollPointsTextField.
              // [MC] Adds the component gameFinalResultTextField to this container.
              c.gridx = 3;     // [MC] Makes this component the fourth column from left (column 4).
              c.gridy = 4;     // [MC] Makes this component the fourth row from top (row 4).
              c.gridheight = 1;     // [MC] Specifies the number of rows the component uses (1 row).
              c.gridwidth = 1;     // [MC] Specifies the number of columns the component uses (1 column).
              this.add(gameFinalResultTextField, c);     // [MC] Adds the text field gameFinalResultTextField.
              // [MC] Adds the component myLeftDie to this container.
              c.gridx = 0;     // [MC] Makes this component the leftmost column (column 1).
              c.gridy = 1;     // [MC] Makes this component the second row from top (row 2).
              c.gridheight = 2;     // [MC] Specifies the number of rows the component uses (2 rows).
              c.gridwidth = 2;     // [MC] Specifies the number of columns the component uses (2 columns).
              c.weightx = 1.0;     // [MC] Requests any extra vertical (column) space.
              c.weighty = 1.0;     // [MC] Requests any extra horizontal (row) space.
              this.add(myLeftDie, c);     // [MC] Adds the component myLeftDie.
              // [MC] Adds the component myRightDie to this container.
              c.gridx = 2;     // [MC] Makes this component the third column from left (column 3).
              c.gridy = 1;     // [MC] Makes this component the second row from top (row 2).
              c.gridheight = 2;     // [MC] Specifies the number of rows the component uses (2 rows).
              c.gridwidth = 2;     // [MC] Specifies the number of columns the component uses (2 column).
              c.weightx = 1.0;     // [MC] Requests any extra column (vertical) space.
              c.weighty = 1.0;     // [MC] Requests any extra horizontal (row) space.
              this.add(myRightDie, c);     // [MC] Adds the component myRightDie.
        }     // [MC] end constructor
        // ======================================================================
        // [MC] Private class RollListener
        // [MC] Inner listener class for rollButton.
        private class RollListener implements ActionListener
            public void actionPerformed(ActionEvent e)
                // [MC] Rolls the dice.
                myLeftDie.roll();     // [MC] Rolls left die.
                myRightDie.roll();     // [MC] Rolls right die.
                   finalResult = 0; // [MC] If result = 0 then game is not over.
                   rolls++;     // [MC] Increments the number of rolls.
                  // [MC] Displays the roll number.
                    rollNumberTextField.setText(" " + rolls + " ");
                   // [MC] Returns the result (number of dots) of last roll.
                   resultLeft = myLeftDie.getValue();     // [MC] Returns the result of the left die.
                   resultRight = myRightDie.getValue();     // [MC] Returns the result of the right die.
                   result = resultLeft + resultRight;     // [MC] Returns the total result of dice.
                   // [MC] Displays the result of last roll.
                   rollResultTextField.setText(" " + result + " ");
                   // [MC] Sets the rules for the game.
                   // [MC] Sets the rules for the first roll of dice.
                   if (first)
                       // [MC] If the result is 2, 3 or 12 on the first throw, the player loses.
                       if (result == 2 || result == 3 || result == 12)
                             finalResult = 2; // [MC] If result = 2 then the player loses and the game is over.
                             gameFinalResultTextField.setText("LOOSE");
                             Toolkit.getDefaultToolkit().beep();
                           rollButton.setEnabled(false);     // [MC] Disable rollButton.
                             first = true; // [MC] Game over after first roll.
                       // [MC] If the result is 7 or 11 on the first throw, the player wins.
                        else if (result == 7 || result == 11)
                             finalResult = 1; // [MC] If result = 1 then the player wins and the game is over.
                             gameFinalResultTextField.setText("WIN");
                             //Toolkit.getDefaultToolkit().beep();
                           rollButton.setEnabled(false);     // [MC] Disable rollButton.
                             first = true;     // [MC] Game over after first roll.
                        // [MC] If the player didn`t win or lose then the results 4, 5, 6, 8, 9 or 10 become the player`s point.
                        else if (result == 4 || result == 5 || result == 6 || result == 8 || result == 9 || result == 10);
                             // [MC] Returns the player`s points.
                             points = result;     // [MC] Returns the player`s points.
                             // [MC] Displays the player`s points.
                             rollPointsTextField.setText(" " + points + " ");
                             first = false;     // [MC] Game is not over after first roll.
                   // [MC] Sets the rules for the next rolls (from second roll onwards) of the dice.
                   // [MC] If the result is 7, then the player loses.
                   else if (result == 7)
                        finalResult = 2;     // [MC] If result = 2 then the player loses and the game is over.
                        gameFinalResultTextField.setText("LOOSE");
                        Toolkit.getDefaultToolkit().beep();
                      rollButton.setEnabled(false);     // [MC] Disable rollButton.
                   // [MC] If the result is equal to the player`s point, then the player wins.
                   else if (result == points)
                        finalResult = 1;     // [MC] If result = 1 then the player wins and the game is over.
                        gameFinalResultTextField.setText("WIN");
                        winClip.play();
                        //Toolkit.getDefaultToolkit().beep();
                      rollButton.setEnabled(false);     // [MC] Disable rollButton.
              }     // [MC] End public void actionPerformed(ActionEvent e).
         }     // [MC] End private class RollListener.
        // ======================================================================
        // [MC] Private class NewGameListener
        // [MC] Inner listener class for newGameButton.
        private class NewGameListener implements ActionListener
              public void actionPerformed(ActionEvent e)
                   // [MC] Initialises instance variables.
                   first = true;     // [MC] Initialise dice roll to first roll.
                   rolls = 0;     // [MC] Initialises number of rolls to 0.
                   // [MC] Initialises text fields.
                   rollResultTextField.setText("");
                   rollNumberTextField.setText("");
                   rollPointsTextField.setText("");
                   gameFinalResultTextField.setText("");
                   rollButton.setEnabled(true);     // [MC] Enable rollButton.
            } // [MC] End public void actionPerformed(ActionEvent e).
         }// [MC] End private class NewGameListener implements ActionListener.
    } // [MC] End public class DicePanel extends JPanel.

    make a backup copy before these changes
    it now compiles, but I haven't run/tested it
    changed constructor to init(), extending Applet, not JApplet
    // [MC] Public class DiceApplet
    public class DiceApplet extends Applet
      // [MC] Constructor.
      public void init()
        // [MC] Sets the contentPane property. This method is called by the constructor.
        add(new DicePanel());
    }then the 'error lines' become
        winClip =  ((Applet)getParent()).getAudioClip(((Applet)getParent()).getCodeBase(), "bunny1.au");
        looseClip =  ((Applet)getParent()).getAudioClip(((Applet)getParent()).getCodeBase(), "bunny1.au");there might be additional problems when you run/test it, but this might get you started

  • Cannot resolve symbol: HashMap, put and strings

    Hi,
    why woudl I get a "cannot resolve symbol" at the line indicated by <============
    sec_cands[i] should be a String already.
    Can someone help me ?
    Thanks in advance.
    HashMap temp = new HashMap();
    String [] sec_cands = sec_ex.getTargetPhrases();
    int sec_length = sec_cands.length;
    String [] allCands = new String[total_length];
    if (sec_length > 0 ) {
    for (int i = 0; i < sec_cands.length; i++)
    allCands[fr_length+i] = sec_cands;
    temp.put(sec_cands[i], true); <=================

    Sorry, I accidentally deleted a subscript from a line. The real code is "
    HashMap temp = new HashMap();
    String [] sec_cands = sec_ex.getTargetPhrases();
    int sec_length = sec_cands.length;
    String [] allCands = new String[total_length];
    if (sec_length > 0 ) {
    for (int i = 0; i < sec_cands.length; i++)
    allCands[fr_length+i] = sec_cands;
    temp.put(sec_cands[i], true); <=================

  • Class error - cannot resolve symbol "MyDocumentListener"

    Hello,
    this is a groaner I'm sure, but I don't see the problem.
    Newbie-itis probably ...
    I'm not concerned with what the class does, but it would be nice for the silly thing to compile!
    What the heck am I missing for "MyDocumentListener" ?
    C:\divelog>javac -classpath C:\ CenterPanel.java
    CenterPanel.java:53: cannot resolve symbol
    symbol : class MyDocumentListener
    location: class divelog.CenterPanel
    MyDocumentListener myDocumentListener = new MyDocumentListener(); // define the listener class
    ^
    CenterPanel.java:53: cannot resolve symbol
    symbol : class MyDocumentListener
    location: class divelog.CenterPanel
    MyDocumentListener myDocumentListener = new MyDocumentListener(); // define the listener class
    ^
    2 errors
    package divelog;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.lang.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.filechooser.*;
    import javax.swing.text.*;
    public class CenterPanel extends JPanel implements ActionListener
    { // Opens class
    static private final String newline = "\n";
    private JTextArea comments;
    private JScrollPane scrollpane;
    private JButton saveButton, openButton;
    private JLabel whiteshark;
    private Box box;
    private BufferedReader br ;
    private String str;
    private JTextArea instruct;
    private File defaultDirectory = new File("C://divelog");
    private File fileDirectory = null;
    private File currentFile= null;
    public CenterPanel()
    { // open constructor CenterPanel
    setBackground(Color.white);
    comments = new JTextArea("Enter comments, such as " +
    "location, water conditions, sea life you observed," +
    " and problems you may have encountered.", 15, 10);
    comments.setLineWrap(true);
    comments.setWrapStyleWord(true);
    comments.setEditable(true);
    comments.setFont(new Font("Times-Roman", Font.PLAIN, 14));
    // add a document listener for changes to the text,
    // query before opening a new file to decide if we need to save changes.
    MyDocumentListener myDocumentListener = new MyDocumentListener(); // define the listener class
    comments.getDocument().addDocumentListener(myDocumentListener); // create the reference for the class
    // ------ Document listener class -----------
    class MyDocumentListener implements DocumentListener {
    public void insertUpdate(DocumentEvent e) {
    Calculate(e);
    public void removeUpdate(DocumentEvent e) {
    Calculate(e);
    public void changedUpdate(DocumentEvent e) {
    private void Calculate(DocumentEvent e) {
    // do something here
    scrollpane = new JScrollPane(comments);
    scrollpane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    saveButton = new JButton("Save Comments", new ImageIcon("images/Save16.gif"));
    saveButton.addActionListener( this );
    saveButton.setToolTipText("Click this button to save the current file.");
    openButton = new JButton("Open File...", new ImageIcon("images/Open16.gif"));
    openButton.addActionListener( this );
    openButton.setToolTipText("Click this button to open a file.");
    whiteshark = new JLabel("", new ImageIcon("images/gwhite.gif"), JLabel.CENTER);
    Box boxH;
    boxH = Box.createHorizontalBox();
    boxH.add(openButton);
    boxH.add(Box.createHorizontalStrut(15));
    boxH.add(saveButton);
    box = Box.createVerticalBox();
    box.add(scrollpane);
    box.add(Box.createVerticalStrut(10));
    box.add(boxH);
    box.add(Box.createVerticalStrut(15));
    box.add(whiteshark);
    add(box);
    } // closes constructor CenterPanel
    public void actionPerformed( ActionEvent evt )
    { // open method actionPerformed
    JFileChooser jfc = new JFileChooser();
    // these do not work !!
    // -- set the file types to view --
    // ExtensionFileFilter filter = new ExtensionFileFilter();
    // FileFilter filter = new FileFilter();
    //filter.addExtension("java");
    //filter.addExtension("txt");
    //filter.setDescription("Text & Java Files");
    //jfc.setFileFilter(filter);
         //Add a custom file filter and disable the default "Accept All" file filter.
    jfc.addChoosableFileFilter(new JTFilter());
    jfc.setAcceptAllFileFilterUsed(false);
    // -- open the default directory --
    // public void setCurrentDirectory(File dir)
    // jfc.setCurrentDirectory(new File("C://divelog"));
    jfc.setCurrentDirectory(defaultDirectory);
    jfc.setSize(400, 300);
    jfc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
    Container parent = saveButton.getParent();
    //========================= Test Button Actions ================================
    //========================= Open Button ================================
    if (evt.getSource() == openButton)
    int choice = jfc.showOpenDialog(CenterPanel.this);
    File file = jfc.getSelectedFile();
    /* a: */
    if (file != null && choice == JFileChooser.APPROVE_OPTION)
    String filename = jfc.getSelectedFile().getAbsolutePath();
    // -- compare the currentFile to the file chosen, alert of loosing any changes to currentFile --
    // If (currentFile != filename)
    // -- get the current directory name -------
    // public File getCurrentDirectory( );
    File f=new File(System.getProperty("user.dir"));
    fileDirectory = jfc.getCurrentDirectory();
    // -- remember the last directory used --
    if (defaultDirectory != fileDirectory)
    {defaultDirectory = fileDirectory;}
    try
    { //opens try         
    comments.getLineCount( );
    // -- clear the old data before importing the new file --
    comments.selectAll();
    comments.replaceSelection("");
    // -- get the new data ---
    br = new BufferedReader (new FileReader(file));
    while ((str = br.readLine()) != null)
    {//opens while
    comments.append(str);
    } //closes while
    } // close try
    catch (IOException ioe)
    { // open catch
    comments.append(newline +"Open command not successful:" + ioe + newline);
    } // close catch
    // ---- display the values of the directory variables -----------------------
    comments.append(
    newline + "The f directory variable contains: " + f +
    newline + "The fileDirectory variable contains: " + fileDirectory +
    newline + "The defaultDirectory variable contains: " + defaultDirectory );
    else
    comments.append("Open command cancelled by user." + newline);
    } //close if statement /* a: */
    //========================= Save Button ================================
    } else if (evt.getSource() == saveButton)
    int choice = jfc.showSaveDialog(CenterPanel.this);
    if (choice == JFileChooser.APPROVE_OPTION)
    File fileName = jfc.getSelectedFile();
    // -- get the current directory name -------
    // public File getCurrentDirectory( );
    File f=new File(System.getProperty("user.dir"));
    fileDirectory = jfc.getCurrentDirectory();
    // -- remember the last directory used --
    if (defaultDirectory != fileDirectory)
    {defaultDirectory = fileDirectory;}
    //check for existing files. Warn users & ask if they want to overwrite
    for(int i = 0; i < fileName.length(); i ++) {
    File tmp = null;
    tmp = (fileName);
    if (tmp.exists()) // display pop-up alert
    //public static int showConfirmDialog( Component parentComponent,
    // Object message,
    // String title,
    // int optionType,
    // int messageType,
    // Icon icon);
    int confirm = JOptionPane.showConfirmDialog(null,
    fileName + " already exists on " + fileDirectory
    + "\n \nContinue?", // msg
    "Warning! Overwrite File!", // title
    JOptionPane.OK_CANCEL_OPTION, // buttons displayed
                        // JOptionPane.ERROR_MESSAGE
                        // JOptionPane.INFORMATION_MESSAGE
                        // JOptionPane.PLAIN_MESSAGE
                        // JOptionPane.QUESTION_MESSAGE
    JOptionPane.WARNING_MESSAGE,
    null);
    if (confirm != JOptionPane.YES_OPTION)
    { //user cancels the file overwrite.
    try {
    jfc.cancelSelection();
    break;
    catch(Exception e) {}
    // ----- Save the file if everything is OK ----------------------------
    try
    { // opens try
    BufferedWriter bw = new BufferedWriter(new FileWriter(fileName));
    bw.write(comments.getText());
    bw.flush();
    bw.close();
    comments.append( newline + newline + "Saving: " + fileName.getName() + "." + newline);
    break;
    } // closes try
    catch (IOException ioe)
    { // open catch
    comments.append(newline +"Save command unsuccessful:" + ioe + newline);
    } // close catch
    } // if exists
    } //close for loop
    else
    comments.append("Save command cancelled by user." + newline);
    } // end-if save button
    } // close method actionPerformed
    } //close constructor CenterPanel
    } // Closes class CenterPanel

    There is no way to be able to see MyDocumentListener class in the way you wrote. The reason is because MyDocumentListener class inside the constructor itself. MyDocumentListener class is an inner class, not suppose to be inside a constructor or a method. What you need to do is simple thing, just move it from inside the constructor and place it between two methods.
    that's all folks
    Qusay

  • Cannot resolve symbol error when compiling a class that calls another class

    I've read all the other messages that include "cannot resolve symbol", but no luck. I've got a small app - 3 classes all in the same package. BlackjackDAO and Player compile OK, but BlackjackServlet throws the "cannot resolve symbol" (please see pertinent code below)...
    I've tried lots: ant and javac compiling, upgrading my version of tomcat, upgrading my version of jdk/jre, making sure my servlet.jar is being seen by the compiler (at least as far as I can see from the -verbose feedback)...any help would be GREAT! Thanks in advance...
    classes: BlackjackServlet, BlackjackDAO, Player
    package: myblackjackpackage
    tomcat version: 4.1.1.8
    jdk version: j2sdk 1.4.0
    ant version: 1.4.1
    I get the same error message from Ant and Javac...
    C:\Tomcat4118\src\webapps\helloblackjack\src\myblackjackpackage>javac *.java -verbose
    C:\Tomcat4118\src\webapps\helloblackjack>ant all -verbose
    compile error:
    BlackjackServlet.java:55: cannot resolve symbol
    symbol: method addPlayer (javax.servlet.http.HttpServletRequest,javax.servlet.http.Http
    ServletResponse)
    location: class myblackjackpackage.BlackjackServlet
              addPlayer(request, response);
    ^
    My code is:
    package myblackjackpackage;
    import java.io.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.lang.*;
    /** controller servlet in a web based blackjack game application @author Ethan Harlow */
    public class BlackjackServlet extends HttpServlet {
         private BlackjackDAO theBlackjackDAO;
         public void init() throws ServletException {
    String driver = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
    String dbUrl = "jdbc:microsoft:sqlserver://localhost:1433";
    String userid = "testlogin";
    String passwrd = "testpass";
         try {
         theBlackjackDAO = new BlackjackDAO(driver, dbUrl, userid, passwrd);
         catch (IOException exc) {
              System.err.println(exc.toString());
         catch (ClassNotFoundException cnf) {
              System.err.println(cnf.toString());
         catch (SQLException seq) {
              System.err.println(seq.toString());
    public void doPost(HttpServletRequest request, HttpServletResponse response)
              throws ServletException, IOException {
    doGet(request, response);
    public void doGet(HttpServletRequest request, HttpServletResponse response)
              throws ServletException, IOException {
         String command = request.getParameter("command");
         if (command == null || (command.equals("stats"))) {
         else if (command.equals("add")) {
              try {
    //the following line is caught by compiler
              addPlayer(request, response);
              response.setContentType("text/html");
              PrintWriter out = response.getWriter();
              out.println("<html>");
              out.println("<body>");
              out.println("<p>Hi, your command was " + request.getParameter("command") + "!!!</p>");
              out.println("</body>");
              out.println("</html>");
              catch (Exception exc) {
                   System.err.println(exc.toString());
         else if (command.equals("play")) {
         else if (command.equals("bet")) {
         else if (command.equals("hit")) {
         else if (command.equals("stand")) {
         else if (command.equals("split")) {
         else if (command.equals("double")) {
         else if (command.equals("dealerdecision")) {
         else if (command.equals("reinvest")) {
         else if (command.equals("changebet")) {
         else if (command.equals("deal")) {
    package myblackjackpackage;
    import java.io.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.lang.*;
    public class BlackjackDAO {
         private Connection myConn;
         public BlackjackDAO(String driver, String dbUrl, String userid, String passwrd)
                   throws IOException, ClassNotFoundException, SQLException {
              System.out.println("Loading driver: " + driver);
              Class.forName(driver);
              System.out.println("Connection to: " + dbUrl);
              myConn = DriverManager.getConnection(dbUrl, userid, passwrd);
              System.out.println("Connection successful!");
         public void addPlayer(HttpServletRequest request, HttpServletResponse response)
                   throws IOException, SQLException {
    //I've commented out all my code while debugging, so I didn't include
    //any here     
    compiler feedback
    C:\Tomcat4118\src\webapps\helloblackjack\src\myblackjackpackage>javac *.java -verbose
    [parsing started BlackjackDAO.java]
    [parsing completed 90ms]
    [parsing started BlackjackServlet.java]
    [parsing completed 10ms]
    [parsing started Player.java]
    [parsing completed 10ms]
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/Object.class)]
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/sql/Connection.class)]
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/String.class)]
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/io/IOException.class)]
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/ClassNotFoundException.class)]
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/sql/SQLException.class)]
    [loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/http/HttpServletRequ
    est.class)]
    [loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/http/HttpServletResp
    onse.class)]
    [loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/http/HttpServlet.cla
    ss)]
    [loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/GenericServlet.class
    [loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/Servlet.class)]
    [loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/ServletConfig.class)
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/io/Serializable.class)]
    [loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/ServletException.cla
    ss)]
    [checking myblackjackpackage.BlackjackDAO]
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/Throwable.class)]
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/Exception.class)]
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/System.class)]
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/io/PrintStream.class)]
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/io/FilterOutputStream.class)]
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/io/OutputStream.class)]
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/Class.class)]
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/sql/DriverManager.class)]
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/util/Properties.class)]
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/Error.class)]
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/RuntimeException.class)]
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/StringBuffer.class)]
    [wrote BlackjackDAO.class]
    [checking myblackjackpackage.BlackjackServlet]
    [loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/ServletRequest.class
    BlackjackServlet.java:55: cannot resolve symbol
    symbol : method addPlayer (javax.servlet.http.HttpServletRequest,javax.servlet
    .http.HttpServletResponse)
    location: class myblackjackpackage.BlackjackServlet
    addPlayer(request, response);
    ^
    [loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/ServletResponse.clas
    s)]
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/io/PrintWriter.class)]
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/io/Writer.class)]
    [checking myblackjackpackage.Player]
    [total 580ms]
    1 error
    C:\Tomcat4118\src\webapps\helloblackjack\src\myblackjackpackage>
    and here's the ant feedback...
    C:\Tomcat4118\src\webapps\helloblackjack>ant all -verbose
    Ant version 1.4.1 compiled on October 11 2001
    Buildfile: build.xml
    Detected Java version: 1.4 in: c:\j2sdk14003\jre
    Detected OS: Windows 2000
    parsing buildfile C:\Tomcat4118\src\webapps\helloblackjack\build.xml with URI =
    file:C:/Tomcat4118/src/webapps/helloblackjack/build.xml
    Project base dir set to: C:\Tomcat4118\src\webapps\helloblackjack
    Build sequence for target `all' is [clean, prepare, compile, all]
    Complete build sequence is [clean, prepare, compile, all, javadoc, deploy, dist]
    clean:
    [delete] Deleting directory C:\Tomcat4118\src\webapps\helloblackjack\build
    [delete] Deleting C:\Tomcat4118\src\webapps\helloblackjack\build\images\a_s.g
    if
    [delete] Deleting C:\Tomcat4118\src\webapps\helloblackjack\build\images\q_s.g
    if
    [delete] Deleting directory C:\Tomcat4118\src\webapps\helloblackjack\build\im
    ages
    [delete] Deleting C:\Tomcat4118\src\webapps\helloblackjack\build\index.html
    [delete] Deleting C:\Tomcat4118\src\webapps\helloblackjack\build\newplayer.ht
    ml
    [delete] Deleting C:\Tomcat4118\src\webapps\helloblackjack\build\WEB-INF\clas
    ses\myblackjackpackage\BlackjackDAO.class
    [delete] Deleting directory C:\Tomcat4118\src\webapps\helloblackjack\build\WE
    B-INF\classes\myblackjackpackage
    [delete] Deleting directory C:\Tomcat4118\src\webapps\helloblackjack\build\WE
    B-INF\classes
    [delete] Deleting C:\Tomcat4118\src\webapps\helloblackjack\build\WEB-INF\web.
    xml
    [delete] Deleting directory C:\Tomcat4118\src\webapps\helloblackjack\build\WE
    B-INF
    [delete] Deleting directory C:\Tomcat4118\src\webapps\helloblackjack\build
    prepare:
    [mkdir] Created dir: C:\Tomcat4118\src\webapps\helloblackjack\build
    [copy] images\a_s.gif added as C:\Tomcat4118\src\webapps\helloblackjack\bui
    ld\images\a_s.gif doesn't exist.
    [copy] images\q_s.gif added as C:\Tomcat4118\src\webapps\helloblackjack\bui
    ld\images\q_s.gif doesn't exist.
    [copy] index.html added as C:\Tomcat4118\src\webapps\helloblackjack\build\i
    ndex.html doesn't exist.
    [copy] newplayer.html added as C:\Tomcat4118\src\webapps\helloblackjack\bui
    ld\newplayer.html doesn't exist.
    [copy] WEB-INF\web.xml added as C:\Tomcat4118\src\webapps\helloblackjack\bu
    ild\WEB-INF\web.xml doesn't exist.
    [copy] omitted as C:\Tomcat4118\src\webapps\helloblackjack\build is up to
    date.
    [copy] images added as C:\Tomcat4118\src\webapps\helloblackjack\build\image
    s doesn't exist.
    [copy] WEB-INF added as C:\Tomcat4118\src\webapps\helloblackjack\build\WEB-
    INF doesn't exist.
    [copy] Copying 5 files to C:\Tomcat4118\src\webapps\helloblackjack\build
    [copy] Copying C:\Tomcat4118\src\webapps\helloblackjack\web\images\q_s.gif
    to C:\Tomcat4118\src\webapps\helloblackjack\build\images\q_s.gif
    [copy] Copying C:\Tomcat4118\src\webapps\helloblackjack\web\images\a_s.gif
    to C:\Tomcat4118\src\webapps\helloblackjack\build\images\a_s.gif
    [copy] Copying C:\Tomcat4118\src\webapps\helloblackjack\web\index.html to C
    :\Tomcat4118\src\webapps\helloblackjack\build\index.html
    [copy] Copying C:\Tomcat4118\src\webapps\helloblackjack\web\newplayer.html
    to C:\Tomcat4118\src\webapps\helloblackjack\build\newplayer.html
    [copy] Copying C:\Tomcat4118\src\webapps\helloblackjack\web\WEB-INF\web.xml
    to C:\Tomcat4118\src\webapps\helloblackjack\build\WEB-INF\web.xml
    compile:
    [mkdir] Created dir: C:\Tomcat4118\src\webapps\helloblackjack\build\WEB-INF\
    classes
    [javac] myblackjackpackage\BlackjackDAO.class skipped - don't know how to ha
    ndle it
    [javac] myblackjackpackage\BlackjackDAO.java added as C:\Tomcat4118\src\weba
    pps\helloblackjack\build\WEB-INF\classes\myblackjackpackage\BlackjackDAO.class d
    oesn't exist.
    [javac] myblackjackpackage\BlackjackServlet.java added as C:\Tomcat4118\src\
    webapps\helloblackjack\build\WEB-INF\classes\myblackjackpackage\BlackjackServlet
    .class doesn't exist.
    [javac] myblackjackpackage\Player.java added as C:\Tomcat4118\src\webapps\he
    lloblackjack\build\WEB-INF\classes\myblackjackpackage\Player.class doesn't exist
    [javac] Compiling 3 source files to C:\Tomcat4118\src\webapps\helloblackjack
    \build\WEB-INF\classes
    [javac] Using modern compiler
    [javac] Compilation args: -d C:\Tomcat4118\src\webapps\helloblackjack\build\
    WEB-INF\classes -classpath
    "C:\Tomcat4118\src\webapps\helloblackjack\build\WEB-I
    NF\classes;
    C:\tomcat4118\common\classes;
    C:\tomcat4118\common\lib\activation.jar;
    C:\tomcat4118\common\lib\ant.jar;
    C:\tomcat4118\common\lib\commons-collections.jar;
    C:\tomcat4118\common\lib\commons-dbcp.jar;
    C:\tomcat4118\common\lib\commons-logging-api.jar;
    C:\tomcat4118\common\lib\commons-pool.jar;
    C:\tomcat4118\common\lib\jasper-compiler.jar;
    C:\tomcat4118\common\lib\jasper-runtime.jar;
    C:\tomcat4118\common\lib\jdbc2_0-stdext.jar;
    C:\tomcat4118\common\lib\jndi.jar;
    C:\tomcat4118\common\lib\jta.jar;
    C:\tomcat4118\common\lib\mail.jar;
    C:\tomcat4118\common\lib\mysql_uncomp.jar;
    C:\tomcat4118\common\lib\naming-common.jar;
    C:\tomcat4118\common\lib\naming-factory.jar;
    C:\tomcat4118\common\lib\naming-resources.jar;
    C:\tomcat4118\common\lib\servlet.jar;
    C:\tomcat4118\common\lib\tools.jar;
    C:\j2sdk14003\lib\tools.jar;
    C:\tomcat4118\ant141\lib\servlet.jar;
    C:\tomcat4118\ant141\lib\jaxp.jar;
    C:\tomcat4118\ant141\lib\crimson.jar;
    C:\tomcat4118\ant141\lib\ant.jar;
    C:\Tomcat4118\src\webapps\helloblackjack;
    C:\mysql\jdbc_dvr\mm.mysql.jdbc-1.2c;
    C:\Program Files\SQLserverjdbcdriver\lib\msbase.jar;
    C:\Program Files\SQLserverjdbcdriver\lib\msutil.jar;
    C:\Program Files\SQLserverjdbcdriver\lib\mssqlserver.jar"
    -sourcepath C:\Tomcat4118\src\webapps\helloblackjack\src -g -O
    [javac] Files to be compiled:
    C:\Tomcat4118\src\webapps\helloblackjack\src\myblackjackpackage\BlackjackDAO
    .java
    C:\Tomcat4118\src\webapps\helloblackjack\src\myblackjackpackage\BlackjackSer
    vlet.java
    C:\Tomcat4118\src\webapps\helloblackjack\src\myblackjackpackage\Player.java
    [javac] C:\Tomcat4118\src\webapps\helloblackjack\src\myblackjackpackage\Blac
    kjackServlet.java:55: cannot resolve symbol
    [javac] symbol : method addPlayer (javax.servlet.http.HttpServletRequest,j
    avax.servlet.http.HttpServletResponse)
    [javac] location: class myblackjackpackage.BlackjackServlet
    [javac] addPlayer(request, response);
    [javac] ^
    [javac] 1 error
    BUILD FAILED
    C:\Tomcat4118\src\webapps\helloblackjack\build.xml:212: Compile failed, messages
    should have been provided.
    at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:559)
    at org.apache.tools.ant.Task.perform(Task.java:217)
    at org.apache.tools.ant.Target.execute(Target.java:184)
    at org.apache.tools.ant.Target.performTasks(Target.java:202)
    at org.apache.tools.ant.Project.executeTarget(Project.java:601)
    at org.apache.tools.ant.Project.executeTargets(Project.java:560)
    at org.apache.tools.ant.Main.runBuild(Main.java:454)
    at org.apache.tools.ant.Main.start(Main.java:153)
    at org.apache.tools.ant.Main.main(Main.java:176)
    Total time: 1 second
    C:\Tomcat4118\src\webapps\helloblackjack>

    yes!
    early on i tried: BlackjackDAO.addPlayer(request, response);
    instead of: theBlackjackDAO.addPlayer(request, response);
    you rock - thanks a ton

Maybe you are looking for

  • The page cannot be found

    I have an Intel 3.2Ghz Pentium, with 2GB of RAM and over 400GB of HDDs, on my home computer. I have installed Windows XP Professional, including all patches, updates, etc. I wanted to learn ABAP and I bought the ABAP Objects book by H.Keller, S.Kruge

  • WL Apache plugin BUG: ConnectTimeoutSecs does not work.

    We have a Servlet that calls an Entity Bean that performs a process that takes about 15 seconds to return. I noticed that the Weblogic to Apache bridge times out in 10 seconds, calling the servlet about 4 times. I then proceeded to change the Connect

  • Query for create manual tabular form using apex collection using item textfield with autocomplete

    can we create a manual tabular form inside item textfield with autocomplete ? how it is possible? with Apex_item API used for this item. i used this code for creat  cascading select list select seq_id, APEX_ITEM.SELECT_LIST_FROM_QUERY(         p_idx 

  • How to restrict mutiple user clicks with asynchrounous behavior of FLEX

    I have developed a flex application and it has a datagrid, and on double clicking on the datagrid, I am showing a popup window ( the code in the popup window has call to httpService.send(), to get the data and display). Before the popup is opened, th

  • SCSM 2012 Forms (related items tab)

    Hi, We are using SCSM in our Production environment. I have a question about the "Select Object" function on Related Items Tab. When we  click on Add button on Related Items Tab under (lets say) "Configuration Items: Computer, Services and People" se