[help] cannot find symbol

I'm trying to work on lessons from a book called Java Server Faces. Only problem is there seems to be a java file i cannot compile. Maybe someone here can see whats up?
here is the error i get when i run javac TableData.java
TableData.java:4: cannot find symbol
symbol  : class Name
location: class com.corejsf.TableData
private static final Name[] names = new Name[] {
                     ^
TableData.java:11: cannot find symbol
symbol  : class Name
location: class com.corejsf.TableData
public Name[] getNames() { return names;}
       ^
TableData.java:4: cannot find symbol
symbol  : class Name
location: class com.corejsf.TableData
private static final Name[] names = new Name[] {
                                        ^
TableData.java:5: cannot find symbol
symbol  : class Name
location: class com.corejsf.TableData
new Name("William", "Dupont"),
    ^
TableData.java:6: cannot find symbol
symbol  : class Name
location: class com.corejsf.TableData
new Name("Anna", "Keeney"),
    ^
TableData.java:7: cannot find symbol
symbol  : class Name
location: class com.corejsf.TableData
new Name("Mariko", "Randor"),
    ^
TableData.java:8: cannot find symbol
symbol  : class Name
location: class com.corejsf.TableData
new Name("John", "Wilson")here is the code
package com.corejsf;
public class TableData {
private static final Name[] names = new Name[] {
new Name("William", "Dupont"),
new Name("Anna", "Keeney"),
new Name("Mariko", "Randor"),
new Name("John", "Wilson")
public Name[] getNames() { return names;}
}I believe i have all my jar files properly located in webapps/xxx/web-inf/lib
but i could be wrong..
thanks

If its a sample application from some place they should have provide it. Otherwise if the Name class usage is simple you can create the class file yourself.
Subsequently you can create you own jar file for this using the
jar cvf [jar file name].jar [package folders]\*.class
and place it in WEB-INF/lib

Similar Messages

  • Help - cannot find symbol error

    Can someone help me? I am getting "cannot find symbol" error in my code and cannot figure out why. Here is my code:
    public class toyInventory
    private String[] toyInventory = {"ball", "bat", "bear", "car", "doll", "game", "glove", "playstation", "train"};
    private int[] nineArray = {0,0,0,0,0,0,0,0};
    int invItems = 0;
    public void countToy()
    String orderInput[] = {"bear", "train", "car", "ball", "doll", "ball", "train", "doll", "game", "train", "bear", "doll", "train", "car", "ball", "bat", "glove", "bat", "b", "doll", "bear", "ball", "doll", "bat", "car", "glove", "train", "doll", "bear"};
    int noMatch;
    for(int a = 0; a < orderInput.length; a++)
    noMatch = 0;
    for(int b = 0; b < toyInventory.length; b++)
    if(orderInput[a] == toyInventory)
    noMatch = 1;
    break;
    if(noMatch == 0)
    invItems = 1;
    public void printItems()
    for(int c = 0; c < toyInventory.length; c++)
    if (countToy[c] > 4)<-------- cannot find symbol error here
    System.out.print("*");
    System.out.print(toyInventory[c] + "\t" + countToy[c] + "\n"); <----cannot find symbol error here also
    System.out.print("The number of invalid items in the order is" + invItems);
    public static void main( String[] args)
    toyInventory collection = new toyInventory ();
    collection.countToy();
    collection.printItems();

    public void countToy()
    String orderInput[] = {"bear", "train", "car", "ball", "doll", "ball", "train", "doll", "game", "train", "bear", "doll", "train", "car", "ball", "bat", "glove", "bat", "b", "doll", "bear", "ball", "doll", "bat", "car", "glove", "train", "doll", "bear"};In the above code you have declared countToy() as method and while in the below lines you are calling countToy[] as an array. So please check that...
    if (countToy[c] > 4)<-------- cannot find symbol error here
    System.out.print("*");
    System.out.print(toyInventory[c] + "\t" + countToy[c] + "\n"); <----cannot find symbol error here also
    }

  • Need help with class info and cannot find symbol error.

    I having problems with a cannot find symbol error. I cant seem to figure it out.
    I have about 12 of them in a program I am trying to do. I was wondering if anyone could help me out?
    Here is some code I am working on:
    // This will test the invoice class application.
    // This program involves a hardware store's invoice.
    //import java.util.*;
    public class InvoiceTest
         public static void main( String args[] )
         Invoice invoice1 = new Invoice( "1234", "Hammer", 2, 14.95 );
    // display invoice1
         System.out.println("Original invoice information" );
         System.out.println("Part number: ", invoice1.getPartNumber() );
         System.out.println("Description: ", invoice1.getPartDescription() );
         System.out.println("Quantity: ", invoice1.getQuantity() );
         System.out.println("Price: ", invoice1.getPricePerItem() );
         System.out.println("Invoice amount: ", invoice1.getInvoiceAmount() );
    // change invoice1's data
         invoice1.setPartNumber( "001234" );
         invoice1.setPartDescription( "Yellow Hammer" );
         invoice1.setQuantity( 3 );
         invoice1.setPricePerItem( 19.49 );
    // display invoice1 with new data
         System.out.println("Updated invoice information" );
         System.out.println("Part number: ", invoice1.getPartNumber() );
         System.out.println("Description: ", invoice1.getPartDescription() );
         System.out.println("Quantity: ", invoice1.getQuantity() );
         System.out.println("Price: ", invoice1.getPricePerItem() );
         System.out.println("Invoice amount: ", invoice1.getInvoiceAmount() );
    and that uses this class file:
    public class Invoice
    private String partNumber;
    private String partDescription;
    private int quantityPurchased;
    private double pricePerItem;
         public Invoice( String ID, String desc, int purchased, double price )
              partNumber = ID;
         partDescription = desc;
         if ( purchased >= 0 )
         quantityPurchased = purchased;
         if ( price > 0 )
         pricePerItem = price;
    public double getInvoiceAmount()
         return quantityPurchased * pricePerItem;
    public void setPartNumber( String newNumber )
         partNumber = newNumber;
         System.out.println(partDescription+" has changed to part "+newNumber);
    public String getPartNumber()
         return partNumber;
    public void setDescription( String newDescription )
         System.out.printf("%s now refers to %s, not %s.\n",
    partNumber, newDescription, partDescription);
         partDescription = newDescription;
    public String getDescription()
         return partDescription;
    public void setPricePerItem( double newPrice )
         if ( newPrice > 0 )
    pricePerItem = newPrice;
    public double getPricePerItem()
    return pricePerItem;
    Any tips for helping me out?

    System.out.println("Part number:
    "+invoice1.getPartNumber;
    The + sign will concatenate invoice1.getPartNumber()
    after "Part number: " forming only one String.I added the plus sign and it gives me more errors:
    C:\>javac InvoiceTest.java
    InvoiceTest.java:16: operator + cannot be applied to java.lang.String
            System.out.println("Part number: ",   + invoice1.getPartNumber() );
                                                  ^
    InvoiceTest.java:17: cannot find symbol
    symbol  : method getPartDescription()
    location: class Invoice
            System.out.println("Description: ", + invoice1.getPartDescription() );
                                                          ^
    InvoiceTest.java:17: cannot find symbol
    symbol  : method println(java.lang.String,int)
    location: class java.io.PrintStream
            System.out.println("Description: ", + invoice1.getPartDescription() );
                      ^
    InvoiceTest.java:18: cannot find symbol
    symbol  : method getQuantity()
    location: class Invoice
            System.out.println("Quantity: ", + invoice1.getQuantity() );
                                                       ^
    InvoiceTest.java:18: cannot find symbol
    symbol  : method println(java.lang.String,int)
    location: class java.io.PrintStream
            System.out.println("Quantity: ", + invoice1.getQuantity() );
                      ^
    InvoiceTest.java:19: cannot find symbol
    symbol  : method println(java.lang.String,double)
    location: class java.io.PrintStream
            System.out.println("Price: ", + invoice1.getPricePerItem() );
                      ^
    InvoiceTest.java:20: cannot find symbol
    symbol  : method println(java.lang.String,double)
    location: class java.io.PrintStream
            System.out.println("Invoice amount: ", + invoice1.getInvoiceAmount() );
                      ^
    InvoiceTest.java:24: cannot find symbol
    symbol  : method setPartDescription(java.lang.String)
    location: class Invoice
            invoice1.setPartDescription( "Yellow Hammer" );
                    ^
    InvoiceTest.java:25: cannot find symbol
    symbol  : method setQuantity(int)
    location: class Invoice
            invoice1.setQuantity( 3 );
                    ^
    InvoiceTest.java:30: operator + cannot be applied to java.lang.String
            System.out.println("Part number: ", + invoice1.getPartNumber() );
                                                ^
    InvoiceTest.java:31: cannot find symbol
    symbol  : method getPartDescription()
    location: class Invoice
            System.out.println("Description: ", + invoice1.getPartDescription() );
                                                          ^
    InvoiceTest.java:31: cannot find symbol
    symbol  : method println(java.lang.String,int)
    location: class java.io.PrintStream
            System.out.println("Description: ", + invoice1.getPartDescription() );
                      ^
    InvoiceTest.java:32: cannot find symbol
    symbol  : method getQuantity()
    location: class Invoice
            System.out.println("Quantity: ", + invoice1.getQuantity() );
                                                       ^
    InvoiceTest.java:32: cannot find symbol
    symbol  : method println(java.lang.String,int)
    location: class java.io.PrintStream
            System.out.println("Quantity: ", + invoice1.getQuantity() );
                      ^
    InvoiceTest.java:33: cannot find symbol
    symbol  : method println(java.lang.String,double)
    location: class java.io.PrintStream
            System.out.println("Price: ", + invoice1.getPricePerItem() );
                      ^
    InvoiceTest.java:34: cannot find symbol
    symbol  : method println(java.lang.String,double)
    location: class java.io.PrintStream
            System.out.println("Invoice amount: ", + invoice1.getInvoiceAmount() );
                      ^
    16 errors

  • Help! Getting the cannot find symbol error.

    Hello everyone. I have gone throught my whole program and I am still getting a cannot find symbol error. What does this error mean exactly? Here is the code below. I am trying to color a background using a comobox method.
    import java.awt.BorderLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.ButtonGroup;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.border.EtchedBorder;
    import javax.swing.border.TitledBorder;
    import java.awt.GridLayout;
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import javax.swing.JComboBox;
    public class ComboboxFrame extends JFrame
        public ComboboxFrame()
            colorPanel = new JPanel();
            colorPanel.setPreferredSize(new Dimension(PANEL_WIDTH, PANEL_HEIGHT));
            getContentPane().add(colorPanel, BorderLayout.CENTER);
            class ChoiceListener implements ActionListener
                public void actionPerformed(ActionEvent event)
                    setbackgroundColor();
            listener = new ChoiceListener();
            createControlPanel();
            setbackgroundColor();
            pack();
        private void createControlPanel()
          JPanel colorPanel = createComboBox();
          JPanel controlPanel = new JPanel();
          controlPanel.setLayout(new GridLayout(1, 1));
          controlPanel.add(colorPanel);
          getContentPane().add(
             controlPanel, BorderLayout.SOUTH);
       public JPanel createComboBox()
          colorCombo = new JComboBox();
          colorCombo.addItem("Red");
          colorCombo.addItem("Green");
          colorCombo.addItem("Blue");
          colorCombo.setEditable(true);
          colorCombo.addActionListener(listener);
          JPanel panel = new JPanel();
          panel.add(colorCombo);
          return panel;
       public void setbackgroundColor()
           String color = (String)colorCombo.getSelectedItem();
           colorPanel.setbackgroundColor(new backgroungColor(color));
           colorPanel.repaint();
       private JPanel colorPanel; 
       private static final int PANEL_WIDTH = 300;
       private static final int PANEL_HEIGHT = 300;
       private JComboBox colorCombo;
       private ActionListener listener;
    }The line with the error is: colorPanel.setbackgroundColor(new backgroungColor(color));
    Here is the second file
    import javax.swing.JFrame;
    public class backgroundTest
        public static void main(String[] args)
            JFrame frame = new comboboxFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.show();
    }Any help would be appreciated. Thank you

    Hello everyone. I have gone throught my whole
    program and I am still getting a cannot find symbol
    error. "Symbol" here means variable or method name (or maybe class name, but I think it will specifically bitch about classnames in that case).
    String foo = "foo";
    System.out.println(zoo); // no such variable as zoo. So...
    colorPanel.setbackgroundColor(new backgroungColor(color));Looks like colorPanel or setbackgroundColor(new backgroungColor doesn't exist.
    Note that spelling and capitalization count. Java's really anal that way.

  • Please help. Cannot find symbol Error!

    I have been working on this code for days now. It keeps coming up with errors. The error says cannot find symbol. I will bold the areas that say that. I got it down to 23 from 42 but now I have no idea what the problem is. any help is greatly appreciated!! I only added a couple of them mainly because it is overwhelming. I can add the rest of someone replies. Thank you again. Oh and the Classpath is set right. I am compiling from the desktop where I have the file also. That was the first thing I checked after reading other threads related to this issue. :O)
    import javax.swing.*;
    import java.awt.event.*;
    public class InventoryPart4 extends JFrame
         private JTextArea text;
         private Inventory inv;
         private int view;
         public InventoryPart4() {
              super("Product");
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // quit if the window is closed
              view = 0; // current one showing
              Product product;
              inv = new Inventory(4);
              product = new Product(1, "Salad", 3, 4.95); here
              inv.add(product, 0);
    product = new Product(2, "Dressing", 6, 3.00); here          
    inv.add(product, 1);
    product = new Product(3, "Bacon Bits", 2, 1.75);*here*
              inv.add(product, 2);
    product = new Product(4, "Croutons", 1, 1.75); here
              inv.add(product, 3);
              // sort
              inv.sort();
              // output
              for (int i = 0; i < 4; i++) {
                   System.out.println(inv.get(i));
              // total val
              System.out.printf("Total=$%.2f", inv.totalValue());
              //gui
              JPanel panel = new JPanel();
              panel.setLayout(new BoxLayout(panel,BoxLayout.Y_AXIS));
              text = new JTextArea(10,50);
              text.setEditable(false);
              panel.add(text);
              showProduct();
              JButton next = new JButton("Next");
    here          next.addProduct(new Product() {
                   public void actionPerformed(ActionEvent e) {
                        if (view < inv.size()-1) view++;
                        else view = 0;
                        showProduct();
              panel.add(next);
              getContentPane().add(panel);
         // view an item
         public void showProduct() {
              text.setText("Product Details:\n");
              text.append(inv.get(view).toString()+"\n");
              text.append(String.format
                        ("Value of all the Contents: $%.2f", inv.totalValue()));
         public static void main(String args [])
              InventoryPart4 invt = new InventoryPart4();
              invt.pack();
              invt.setVisible(true);
         } //end main
    } // end class InventoryPart1
    class Product {
    private int ProductItem;
    private int ProductStock;
    private double ProductPrice;
    public Product(int item, int stock, double price) {
    ProductItem = item;
    ProductStock = stock;
    ProductPrice = price;
    } //end three-argument constructor
    // set Product Item
    public void setProductItem(int item) {
    ProductItem = item; here
    } //end method set Product Item
    //return Product Item
    public int getsProductItem() {
    return productItem;
    } //end method get product Item
    //set Product Stock
    public void setProductStock(int stock) {
    productStock = stock;
    } //end method set Product Stock
    //return Product Stock
    public int getProductStock() {
    return productStock;
    } //end method get Product Stock
    public void setProductPrice(double price) {
    productPrice = price;
    } //end method setproductPrice
    //return Product Price
    public double getProductPrice() {
    return ProductPrice;
    } //end method get Product Price
    //calculate inventory value
    public double value() {
    return productPrice * productStock;
    }// end method get productPrice and productStock
    @Override
    public String toString() {
    return String.format("item=%3d units=%d price=%.2f value=%.2f",
    productItem, productStock, productPrice, value());
    }//end class Product
    class Inventory {
         private Product[] list;
         // constructor
         public Inventory(int size) {
              list = new Product[size];
         // complete value
         public double totalValue() {
              double val = 0.0;
              for (int i = 0; i < list.length; i++) {
                   val += list.value();
              return val;
         // add an item
         public void add(Product i, int p) {
              list[p] = i;
         // get an item
         public Product get(int i) {
              return list[i];
         // sort by name
         public void sort() {
              // bubble sort
              int n = list.length;
              for (int search = 1; search < n; search++) {
                   for (int i = 0; i < n-search; i++) {
                        if (list[i].getProductItem().compareToIgnoreCase(list[i+1].getProductItem()) > 0) {
                             // swap
                             Product temp = list[i];
                             list[i] = list[i+1];
                             list[i+1] = temp;
         public int size() {
              return list.length;
    //extended class
    class Contents extends Product {
         private String Contents;
         // constructor
         public Contents(int item, String name, int units, double price) {
              super(item,name,units, price);
              this.contents = contents;
         // getter
         public String getContents() {
              return Contents;
         // total value with the 5% fee
         public double value() {
              return super.value()*1.05;
         // just the 5% fee
         public double fee() {
              return super.value()*0.05;
         // setter
         public void setContents(String contents) {
              this.contents = contents;
         public String toString()
              return super.toString() + String.format(" fee=%.2f contents=%-20s",
                        fee(), contents);

    The error says cannot find symbol.It says more than that. It says what symbol it cannot find, and it points to the line of code where the symbol was used.
              product = new Product(1, "Salad", 3, 4.95); *here*So it can't find a class called Product with an accessible constructor Product(int, String, int, double).
    product = new Product(2, "Dressing", 6, 3.00); *here*          
    inv.add(product, 1);
    product = new Product(3, "Bacon Bits", 2, 1.75);*here*
              inv.add(product, 2);
    product = new Product(4, "Croutons", 1, 1.75); *here*
              inv.add(product, 3);Ditto.
              JButton next = new JButton("Next");
    *here*          next.addProduct(new Product() {JButton doesn't have an addProduct() method.
    public Product(int item, int stock, double price) {This constructor doesn't match the constructor you are calling above, and there are no other constructors.
    ProductItem = item; *here*You must have a typo. But don't use inital capitals on field names: use them only on class names.
    return productItem;Here is evidence that you have a typo. Java is case-sensitive. Either the field is caled 'ProductItem' or it is called 'productItem', not both.
              // bubble sortDo you have to do this for the homework? Bubble sort is never used in real code except by people who don't know what they're talking about. Use Collections.sort().
              super(item,name,units, price);You should be getting a compile error here too. Ther is no such constructor for Product.
              return Contents;And here.

  • Cannot Find Symbol Error, please help.

    I am brand new to Java, so sorry if this question is obvious, but I keep receiving the following error when i try and compile the following code Circle.java
    Circle.java:17: cannot find symbol
    symbol : constructor Point()
    location: class pointClass.Point
    ^
    Circle.java:18: cannot find symbol
    symbol : method Point(double,double)
    location: class pointClass.Point
    super.Point(x,y); //set center to (x,y)
    ^
    2 errors
    I cant seem to figure out why I am getting this error, any help that anyone could provide would be greatly appreciated.
    This is the code for Circle.java:
    package circleClass;
    import pointClass.*;
    public class Circle extends Point
    private double radius; //Add a double radius field.
    public Circle()
    super(0,0); //call Point?s constructor initializing center to (0,0)
    radius = 0.0; //set radius to 0.0
    public Circle(double x, double y, double r)
    super.Point(x,y); //set center to (x,y)
    radius = r; //set radius to r
    public double r()
    return radius; //returns radius.
    public double getArea()
    return Math.PI*(radius*radius); //returns area of Circle object
    public double getCircumference()
    return 2*Math.PI*radius; //returns circumference of Circle object
    public String toString()
    return "center: ("+x+","+y+")"+"\nradius: "+r; //returns String that will give
    //output of the format...
    //center: (x,y)
    //radius: r
    If it helps, this is the code for pointClass:
    package pointClass;
    public class Point
    private double xcoor,ycoor;
    public static final Point ORIGIN = new Point();
    private Point()
    xcoor = 0;
    ycoor = 0;
    public Point(double x, double y)
    xcoor = x;
    ycoor = y;
    public double x()
    return xcoor;
    public double y()
    return ycoor;
    public String toString()
    return "(" + xcoor + "," + ycoor + ")";
    public static double distance(Point p, Point q)
    double dx = q.xcoor - p.xcoor;
    double dy = q.ycoor - p.ycoor;
    return Math.sqrt(dx*dx + dy*dy);
    Thanks for your help.

    {color:#000080}Both of your classes need to be in the same package, not each one in a package of its own. You have imported pointClass.Pont in Circle.java, but I don't think that's what you want to do. For a better understanding of packages, read{color}
    http://java.sun.com/docs/books/tutorial/java/package/index.html
    And post code like this:
    [code]CODE[/code] is displayed as CODE{color:#000080}db{color}

  • Please help with cannot find symbol error. Been struggling all day :(

    Hi all. :)
    Writing a game for my phone with KToolbar and have been getting a cannot find symbol error for every variable and method I try to use across Classes. I've looked all over and though it seems a common problem I always either don't understand or can't get working the various solutions. Example of my errors:
    C:\...\BTK800i.java:197: cannot find symbol
    symbol : variable youSayWhat
    location: class HelloCanvas
              youSayWhat=key;
              ^
    If I try BTK800i.variable or BTK800i.message I get a new error.
    C:\...\src\BTK800i.java:184: non-static method newOrdersSarge() cannot be referenced from a static context
              BTK800i.newOrdersSarge();
              ^
    Both these errors apply to both variables and methods. It only happens when I'm using methods/variables of one class in another, am I using public and private incorrectly? It doesn't seem to make a difference if I make variables public or leave them private, I'm trying to get to them with a public method within a private class. Is it something else? I really have no idea. :(
    Here's my code, it's long enough to be a tiresome read so I've tried to skip what I know isn't relevant.
    public class BTK800i extends MIDlet {
         private Display myDisplay;
         private HelloCanvas myCanvas;
         public int youSayWhat;
            //a whole bunch more skipped here, but I'm fairly certain it's not anything that'll help find a solution
         public BTK800i() {
              paused=false;
    public void startApp() throws MIDletStateChangeException {
              if( paused ) {
                   myCanvas.repaint();
              else {
                   myDisplay=Display.getDisplay(this);
                   myCanvas=new HelloCanvas();
                   myDisplay.setCurrent(myCanvas);
                   myCanvas.setFullScreenMode(true);
                   youSayWhat=0;
                           //again with the skipping, more code not related
    public void newOrdersSarge() {
    //whole bunch of code
    //other methods skipped
    class HelloCanvas extends Canvas {
         public void keyPressed (int key) {
              youSayWhat=key;
              repaint ();
    //skippage
    }The stuff I skipped is mainly either more of the same sorta thing or maths/writing to screen stuff.
    Thanks alot to anyone who helps. I'm really struggling with this. :(
    Dan.

    But I have been reading them :(
    My next-door neighbour unfortunately is an 80-something married man, but I will go have a looksie about static and instances.
    I thought the point of public variables was that other classes could use them, is this wrong?
    Also does this mean that to use the variables from my BTK class in the HelloCanvas class I need to first instantiate BTK? I don't understand how that works as the code starts running from the BTK class in the first place :S I guess more reading will help with this.
    Thanks very much for replying. :)
    Edit:
    OK I have read up on it but I don't think I found anything I hadn't read before. I tried to make a new class which I could instantiate to hold all the variables and methods I wanted everything to be able to access, but that went disastrously. Am I right in understanding that there are no global variables in Java? :s
    Edited by: Dan69 on Apr 17, 2010 1:15 PM

  • Help with 'cannot find symbol' error

    Ive written the following code. It is an excerpt from my entire class.
    When I try to compile the code I get the error:-
    cannot find symbol
    Symbol: variable playerRun1
    location: this class
    public void analysePlayerMove()
              if (playerGo == true)
                   if (playerMove.getComponentCount() == 0)
                        JOptionPane.showMessageDialog(this, "You Have Not Made A Move", "Empty Move", JOptionPane.ERROR_MESSAGE);
                   else
                        if (areTherePickUps == false)
                             for (int j=0; j<playerMove.getComponentCount(); j++)
                                  //reversing the players hand, because what is displayed on the GUI is reversed
                                  Component[] playerRun = playerMove.getComponentsInLayer(playerMove.DEFAULT_LAYER);
                                  Component[] playerRun1 = new Component[playerRun.length];
                                  int reverse = playerRun.length-1;
                                  for (int k=0; k<playerRun.length; k++)
                                       playerRun1[k] = playerRun[reverse];
                                       reverse--;
                             if (acePlayed == true && playerRun1.length == 1)
                                  if (playerRun1[0] != acePlayedSuit)
                                       JOptionPane.showMessageDialog(this, "Your Move Is Not Valid", "Invalid Move", JOptionPane.ERROR_MESSAGE);
                                  else
                                       //remove the cards from the players move hand and add them to the bottom of the shredded deck
         }I dont understand why I am getting this error, I clearly define the variable.

    Yes, but the variable is declared inside a block and so it's local to that block. You can't use it outside its scope, which is the block in which you declared it. Re-read the section of your book about variable scope.

  • Help a Beginner? cannot find symbol error?

    class Box {
         double width;
         double height;
         double depth;
    Box(Box ob) {
              width = ob.width;
              height = ob.height;
              depth = ob.depth;
    Box(double w, double h, double d) {
         width = w;
         height = h;
         depth = d;
    double volume() {
         return width * height * depth;
    class BoxWeight extends Box {
         double weight;
         BoxWeight(double w, double h, double d, double m) {
              width = w;
              height = h;
              depth = d;
              weight = m;
    class DemoBoxWeight {
         public static void main(String[] args) {
              BoxWeight mybox1 = new BoxWeight(10, 20, 35, 34);
              double vol;
              vol = mybox1.volume();
              System.out.println("Weight of mybox1 is " + mybox1.weight);
    okay, this is basically from a book, but when I compile it in TextPad, it reads
    C:\Documents and Settings\Guest 1\Desktop\EPGY C015\Box\Box.java:27: cannot find symbol
    symbol : constructor Box()
    location: class Box
         BoxWeight(double w, double h, double d, double m) {
         ^
    1 error
    Tool completed with exit code 1
    Why is that and how can I fix it? :P

    Whenever you extend a class (here you're extending Box with BoxWeight), and create the subclass's constructor, the parent class's (or super class's) constructor gets called first whether it is explicitly called or not. So here in the BoxWeight constructor, the Box constructor is implicitly called:
    BoxWeight(double w, double h, double d, double m) {
      // even though you don't specify it, the Box() constructor is called here. 
      // it's as if you have here the call:
      super();
      width = w;
      height = h;
      depth = d;
      weight = m;
    }If you don't specify the super(), it get's implicitly called as the first call in the BoxWeight constructor. Notice that the implicit constructor has no parameters. Since Box does not have a constructor without parameters, this will throw an error. To get around this, you should explicitly call the super constructor with its proper parameters as the first method called in your BoxWeight constructor:
    BoxWeight(double w, double h, double d, double m) {
      super(w, h, d);  // *** here ***
      width = w;
      height = h;
      depth = d;
      weight = m;
    }

  • Java Studio Enterprise 8.1 and jdk1.6 - cannot find symbol

    Hi,
    I am using subj. The problem I have is that I declared 2-3 classes with methods in one package. I made an object of the class and use intellisense to navigate to the method I need but when I try to compile the code I have "cannot find symbol" error on the method I intellisensed to. It seems to me that it is IDE problem.
    Does anyone know how to work around it?
    The code is below, in case you are interested.
    package webservice;
    import java.io.*;
    public class Main {
    /** Creates a new instance of Main */
    public Main() {
    * @param args the command line arguments
    public static void main(String[] args) {
    String filename = null;
    String timestamp = null;
    try {
    Q q = new Q();
    timestamp = "2007-06-01";
    QList ql = q.getList(timestamp);
    System.out.println("--------------Ok-------------");
    catch(Exception e) {
    System.out.println("An Exception thrown in Main(). e = "+e.toString());
    package webservice;
    public class Q {
    public Q() {
    public QList getList(String timestamp) {
    QList result = null;
    return result;
    Thanks,
    Dmitry

    Thanks for that Kris.
    I found the root of my problem. In this example I used a remote webservice to retrieve some data. It happened to be that the generated class file from wsdl and my custom class had the same name.
    So, instead of reporting as ambiguous definition error the ide picked up the wrong class and did not find the method I intended to use.
    Hopefully it will help someone else having the same problem.
    Dmitry

  • Issue with - "cannot find symbol - variable JOptionPane"

    need some help, got the below loop and want it to be able to loop by the number input by the input dialog. when i compile it i get an error in BlueJ. the error is "cannot find symbol - variable JOptionPane". Any help. have tried a few things however cannot get this to work at all. any suggestions?
    public void numberLoop()
    String qA = JOptionPane.showInputDialog(null,"How many times should this be completed (e.g. 1,2,3,4)?","Question",JOptionPane.QUESTION_MESSAGE);
    int qA2 = Integer.parseInt(qA);
    for (int startNum = 1; startNum <= qA2; startNum++)
    System.out.println(startNum + " squared is " + (startNum * startNum));
    }

    never mind i fixed it. forgot the below.
    import javax.swing.JOptionPane;
    LOL

  • Cannot find symbol     class Usernamebean

    hi i am new in j2ee
    can some body help to give the solution.
    i am always thankfull to everybody
    i have a servlet where i am calling a bean of same package but servlet not compile giving that error
    cannot find symbol class Usernamebean
    servlet code
    package ecomm; import java.sql.*; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.util.*; import bengalcom.*; public class Loginservelet extends HttpServlet { public void doGet(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException { try {         String accnum=req.getParameter("username");   String pinnum=req.getParameter("password"); try { Class.forName("com.mysql.jdbc.Driver"); Connection dbcon=DriverManager.getConnection("jdbc:mysql://localhost/ecomm","root",""); PreparedStatement s = dbcon.prepareStatement("select * from vendordetails where email = ? and password = ? and blocking='No' "); s.setString(1,accnum); s.setString(2,pinnum); ResultSet result=s.executeQuery(); boolean rowfound=false; rowfound=result.next();   if(rowfound==true) { String vname=result.getString("fname"); String  vid=result.getString("vid"); String email=result.getString("email");   UsernameBean nameBean =new UsernameBean();   nameBean.setFirstName(accnum); HttpSession session = req.getSession(true); session.setAttribute("vname",vname); session.setAttribute("vid",vid); session.setAttribute("email",email);   RequestDispatcher dispatcher=getServletContext().getRequestDispatcher("/earea.jsp?vname=vname&vid=vid&email=email"); dispatcher.forward(req,res); dbcon.close(); } else{ RequestDispatcher dispatcher=getServletContext().getRequestDispatcher("/eblock.jsp"); dispatcher.forward(req,res); }   } catch(ClassNotFoundException e) { } } catch(SQLException e) { System.out.println(e.toString()); } } public void doPost(HttpServletRequest req, HttpServletResponse res)         throws ServletException, IOException     {         doGet(req, res);     } }

    Hi,
    java is case sensitive, Check the case in class name.
    Regards,
    Ram

  • Java Error : cannot find symbol , symbol : class (jdk 1.6.0)

    Dear All,
    Please help me.
    I am running javac from a .bat file and i set the classpath in the bat file as follows.
    echo on
    :start
    set classpath = "C:\Program Files\Java\jdk1.6.0\bin;"
    set classpath = "C:\Program Files\Java\jdk1.6.0\jre\..\lib\tools.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\rt.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\i18n.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\sunrsasign.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\jce.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.6.0\jre\classes;C:\Program Files\Java\jdk1.6.0\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\ext\ldapsec.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\ext\mysql-connector-java-5.0.0-beta-bin.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\ext\sunjce_provider.jar; C:\Program Files\Java\jdk1.6.0\ideset\system;C:\Program Files\Java\jdk1.6.0\ideset\system;C:\Program Files\Java\jdk1.6.0\studio\system;C:\Program Files\Java\jdk1.6.0\studio\modules\ext\j2ee-1.3.jar;C:\Program Files\Java\jdk1.6.0\studio\modules\ext\jaas-1.0.jar;C:\Program Files\Java\jdk1.6.0\studio\modules\autoload\activation.jar;C:\Program Files\Java\jdk1.6.0\studio\modules\ext\jms-1.0.2b.jar;C:\Program Files\Java\jdk1.6.0\studio\modules\ext\jta-spec1_0_1.jar;C:\Program Files\Java\jdk1.6.0\studio\modules\autoload\mail.jar;C:\Program Files\Java\jdk1.6.0\studio\modules\ext\AbsoluteLayout.jar;C:\Program Files\Java\jdk1.6.0\studio\modules\ext\sql.jar;C:\Program Files\Java\jdk1.6.0\studio\modules\ext\rowset.jar;C:\Program Files\Java\jdk1.6.0\studio\lib\ext\jdbc20x.zip;C:\Program Files\Java\jdk1.6.0\studio\modules\ext\servlet-2.3.jar;C:\Program Files\Java\jdk1.6.0\studio\beans\TimerBean.jar;c:\Program Files\Java\jdk1.6.0\ideset\tomcat401_base;C:\sms\com\;"
    cd C:\sms
    javac mainP.java
    pause
    i have few class files which are inherited to the main program using ' import com.Connection; '
    i am getting errors like
    mainP.java:482: cannot find symbol
    symbol : class Connection
    location: class mainP
    Connection connection = new Connection(ipAddress, port);
    I think it is because of some classpath error.
    please advice me.......
    Viju

    Actually, you have NO CLUE what he's trying to doActually he said what he is trying to do in his posting. It's no mystery. But that's all the information that's available. If you know something that isn't posted here why not say so?
    Your reply was a snide, rude, "You're stupid for doing it that way" answerMy reply was neither snide nor rude and implied none of what you impute to it. It was a proper and constructive suggestion. You are entitled to disagree with it, but that doesn't justify this immoderate outburst.
    Bottom line is, you chose to be nastyBottom line is you're just making this up. You are imputing motives to me without evidence. Don't do that.
    You are the type of person that makes searching forums and posting questions for assistance a near waste of time.I doubt that you'll find many regulars here that would agree with that assertion. When you have made over 16,000 posts here over ten years as I have, come back and we'll discuss it some more.
    Go back to grade school and ...I suggest you try it yourself. You're not adding anything except noise to the discussion. Try curbing your temper, and while you're at it have a good look at the Code of Conduct for these forums. You're verging on personal abuse here.
    And, additionally, I've used ANT in the past. Batch files are FAR AND AWAY easier to set up.In your opinion. I disagree entirely, and I have eleven years' experience with Java to back it up.
    As for CLASSPATH, I haven't done anything about setting it beyond installing the JDK since about 1999, and it has a dot in it as we speak.

  • Cannot find symbol class error

    hi there ,
    i am creating a min class that links several classes and i am doing the following
    public class Main{
         public static void main(String[] args){
         classOne a = new classOne();
    classTwo b = new classTwo();
    classThree c = new classThree();
    // more classes with the same as above
    i am saving all the classes in the same folder , and i am having this error twice with each line that i creat an instance for a class
    cannot find symbol
    symbol : class classOne

    are your classes all in the same package? do you in fact use packages?
    Your best bet to get help here is by creating a Short, Self Contained, Correct (Compilable), Example or SSCCE. This is a small application that you create that is compilable and runnable, and demonstrates your error, but contains no extraneous, unnecessary code that is not associated with your problem. To see more about this and how to create this, please look at this link:
    http://homepage1.nifty.com/algafield/sscce.html
    Remember, this code must be compilable and runnable.
    Also, if you do post your code, please use code tags so that your code will be well-formatted and readable. To do this, either highlight your code block and press the "code" button at the top above the message block or place the tag &#91;code&#93; at the top of your block of code and the tag &#91;/code&#93; at the bottom, like so:
    &#91;code&#93;
       // your code block goes here
    &#91;/code&#93;

  • Inheritance - Cannot find Symbol

    Hello!
    After many hours of searching for the answer, i have decided to brave getting a grilling for asking something trivial.
    I'm creatating a system and so far the problem i am having is inheritance.
    The superclass compiles fine, no problems:
    package Boats;
    public abstract class Boat
         protected String name;
         protected int price;
         protected int id;          
         protected String type;          
         protected boolean hire;
         public boat(int boatID, String boatName, int cost, String boatType)
            name = boatName;
              price = cost;
              id = boatID;
              type = boatType;
            hire = false;
    }however, the subclass of pedal boat won't compile:
    package Boats;
    public abstract class PedalBoat extends Boat
         private String colour;
        public PedalBoat(int id, String boatName, int cost, String boatType, String c)
            super(id, boatName, cost, boatType);
              colour = c;
            super.hire = false;
    }both of these class files are in the same folder 'Boats', but when i compile PedalBoat, the following message is displayed:
    "PedalBoat.java:2: cannot find symbol
    symbol: class Boat
    public abstract class PedalBoat extends Boat
    ^
    Any thoughts or help or links to anywhere that has answered this before?
    Thanks!

    You'll want the following directory structure. The C:\projects part is arbitrary. It's what comes after it that matters.
    C:\projects\Boats\Boat.java
    C:\projects\Boats\PedalBoat.javaThen, CD to C:\projects, and execute
    javac -cp . Boats/*.javaAs a side note, to go with the flow convention-wise, I'd suggest renaming your Boats package to boats. Package names are conventionally all lowercase.
    [Javapedia: Classpath|http://wiki.java.net/bin/view/Javapedia/ClassPath]
    [How Classes are Found|http://java.sun.com/j2se/1.5.0/docs/tooldocs/findingclasses.html]
    [Setting the class path (Windows)|http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/classpath.html]
    [Setting the class path (Solaris/Linux)|http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/classpath.html]
    [Understanding the Java ClassLoader|http://www-106.ibm.com/developerworks/edu/j-dw-javaclass-i.html]
    java -cp .;<any other directories or jars> YourClassNameYou get a NoClassDefFoundError message because the JVM (Java Virtual Machine) can't find your class. The way to remedy this is to ensure that your class is included in the classpath. The example assumes that you are in the same directory as the class you're trying to run.
    javac -classpath .;<any additional jar files or directories> YourClassName.javaYou get a "cannot resolve symbol" message because the compiler can't find your class. The way to remedy this is to ensure that your class is included in the classpath. The example assumes that you are in the same directory as the class you're trying to run.

Maybe you are looking for

  • Can't upload photo with Flash player

    Here's a 24 second video documenting the problem: http://www.youtube.com/watch?v=-wx10t-A3AU I have a Retina Macbook Pro running Mountain Lion 10.8.1. Brand new computer. The take a photo feature that uses Flash does not appear to work on Tumblr. I h

  • Photo transfer from ipod to new macbk pro gone bad

    I successfully transfered my music from ipod classic (80gb) using senuti. Then did "transfer purchases" option in itunes to recover the rest. Then acquired touch copy app. to handle photos from ipod only to find out, when I started app., that all my

  • TS1717 Windows 7: switch between several users - freezes with second user

    when i open my account on my comp and start i tunus  then when my frend whants on i get on and close itunes and then he gets  switches user and he gets on to his i tunes and when he goes to open his preferecens  it will frezze  but it will play music

  • Please help me with my z

    hi there,?so, i got a 30g zen vison 4 days ago, and while i am really hapy with the player, i cannot get it to conect to my desktop. I tried all the methods i could fish out of the other similar topics to mine (fix patch, uploading to MP, downgradng

  • Problems with Views based on a Hierarchical Query

    Datamodeler 3.1.3.706 (SQL Dev 3.2.10.09): When creating a view that utilizes a Hierarchical Query, the Query Builder encounters various difficulties: When pasting in SQL code, if the view is saved without first clicking the update diagram button, th