Driver.java:6: cannot find symbol

Simple things but I keep getting an error.... It's pointing to the period in atmMenu.run();
public class Driver
     public static void main( String [] args )
          Menu atmMenu = new Menu();
          atmMenu.run();
}

Note that you could have saved a bit of "to and fro"-ing if you had actually put the compiler message in the original post, rather than just the location. You made someone guess what the message might be. If you want help, you should do all you can to make it easy for people to help you.
And what you need to do is add a run() method to Menu.

Similar Messages

  • 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.

  • Java code Cannot find symbol problem

    I'm triing to compile three classes they are in the same directory yet it still says Cannot find symbol I can't find any thing in the spelling...
    file #1
    package banking;
    import java.util.*;
    public class Bank {
         private ArrayList<Account> accounts = new ArrayList<Account>();
         private int numOfCust;
         public void addCustomer(String fName, String lName){
              numOfCust += 1;
              accounts.add(Customer(fName, lName));
         public int getNumOfCustomers(){
              return numOfCust;
         public Account getCustomer(int custNum){
              return accounts.get(custNum);
    }Next Class used in above:
    package banking;
    public class Account {
         private double balance;
         public Account(double init_balance){
              balance = init_balance;
         public double getBalance(){
              return balance;
         public boolean deposit(double amount){
              if (amount < 0)
                   return false;
              else
                   balance += amount;
                   return true;
         public boolean withdraw(double amount){
              if (balance < amount)
                   return false;
              else
                   balance -= amount;
                   return true;
    }The last class:
    package banking;
    public class Customer {
         private String firstName;
         private String lastName;
         private Account account;
         public Customer(String fName, String lName){
              firstName = fName;
              lastName = lName;
         public String getFirstName(){
              return firstName;
         public String getLastName(){
              return lastName;
         public Account getAccount(){
              return account;
         public Account setAccount(Account acct){
              account = acct;
              return account;
    }

    here are the errors it gives..
    it is an assignment in a java class..
    OO-Programming methods..
    C:\JavaProgs\banking>javac Bank.java
    Bank.java:8: cannot find symbol
    symbol : class Account
    location: class banking.Bank
    private ArrayList<Account> accounts = new ArrayList<Account>();
    ^
    Bank.java:20: cannot find symbol
    symbol : class Account
    location: class banking.Bank
    public Account getCustomer(int custNum){
    ^
    Bank.java:8: cannot find symbol
    symbol : class Account
    location: class banking.Bank
    private ArrayList<Account> accounts = new ArrayList<Account>();
    ^
    Bank.java:13: cannot find symbol
    symbol : method Customer(java.lang.String,java.lang.String)
    location: class banking.Bank
    accounts.add(Customer(fName, lName));
    ^
    4 errors

  • Java:3: cannot find symbol

    i'm learning java
    but when i do a java projram i got a error
    hare is that
    Test1.java:3: cannot find symbol
    symbol : variable Out
    location: class java.lang.System
    System.Out.Println("john");
    ^
    1 error
    i got this error. i see "." this symbol
    then what should i do ?

    Java is case-sensitive. Don't type "Out" and "Println" when you're supposed to type "out" and "println".
    Try this:
    System.out.println("john");

  • Max3.java:17: cannot find symbol

    Hi guys,
    Need some help here..
    This is my code:
    import java.util.Scanner;
    import static java.lang.Math.*;
    public class Max3{
         public static void main (String[] args)     {
         Scanner kb = new Scanner(System.in);
         System.out.print ("Enter 1st number:");
         int first = kb.nextInt();
         System.out.print ("Enter 2nd number:");
         int second = kb.nextInt();
         System.out.print ("Enter 3rd number:");
         int third = kb.nextInt();
         System.out.println (Math.max(first,second,third));
    ===================================================================
    This is the error im getting :
    Max3.java:17: cannot find symbol
    symbol : method max(int,int,int)
    location: class java.lang.Math
    System.out.println (Math.max(first,second,third));
    ^
    1 error
    ====================================================================
    Do i need to import the math? i read from somewhere that Math class is contained in the Java.lang package, and we therefore don't have to import it ...

    I tried again, same error.
    Edited Maths.max to only max
    ========================================
    import java.util.Scanner;
    import static java.lang.Math.*;
    public class Max3{
         public static void main (String[] args)     {
         Scanner kb = new Scanner(System.in);
         System.out.print ("Enter 1st number:");
         int first = kb.nextInt();
         System.out.print ("Enter 2nd number:");
         int second = kb.nextInt();
         System.out.print ("Enter 3rd number:");
         int third = kb.nextInt();
         System.out.println (max(first,second,third));
    =================================================
    Error:
    C:\kenny>javac Max3.java
    Max3.java:17: cannot find symbol
    symbol : method max(int,int,int)
    location: class Max3
    System.out.println (max(first,second,third));
    ^
    1 error
    Thanks for spending some time on this!

  • "Simon2.java:37: cannot find symbol

    Im coming up with this error. Does anyone know what I'm missing.
    Thankyou for any response
    "Simon2.java:37: cannot find symbol
    symbol : method getPane()
    location: class Simon2
    Container pane = getPane();
    ^
    1 error"
    public Component createComponents(){
    JButton button;
    Container pane = getPane();
    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    pane.setLayout(gridbag);
    button = new JButton("Holy Shit!");
    c.gridx = 0;
    c.gridy = 0;
    gridbag.setConstraints(button, c);
    pane.add(button);
    return pane;
    button.setMnemonic(KeyEvent.VK_I);
    button.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e) {
    }

    Here's all the code so far, where have I gone wrong
    Simon2.java:37: cannot find symbol
    symbol : method getContentPane()
    location: class Simon2
    Container contentPane = getContentPane();
    ^
    1 error
    mport javax.swing.*;
    import javax.swing.UIManager;
    import java.awt.*;
    import java.awt.event.*;
    import com.l2fprod.gui.plaf.skin.*;
    import javax.swing.JButton;
    public class Simon2 {
    public static void main(String[] args) {
    try {
    Skin theSkinToUse = SkinLookAndFeel.loadThemePack("chaNinja-Bluethemepack.zip");
    SkinLookAndFeel.setSkin(theSkinToUse);
    UIManager.setLookAndFeel(new SkinLookAndFeel());
    } catch (Exception e){ }
    JFrame.setDefaultLookAndFeelDecorated(true);
    JFrame fr = new JFrame("Simon2");
    Simon2 app = new Simon2();
    Component contents = app.createComponents();
    fr.getContentPane().add(contents, BorderLayout.CENTER);
    fr.addWindowListener(new WindowAdapter(){
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    fr.setTitle("AnimalDance");
    fr.setSize(500, 200);
    fr.setVisible(true);}
    public Component createComponents(){
    JButton button;
    Container contentPane = getContentPane();
    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    contentPane.setLayout(gridbag);
    button = new JButton("Holy birds!");
    c.gridx = 0;
    c.gridy = 0;
    gridbag.setConstraints(button, c);
    contentPane.add(button);
    return contentPane;
    button.setMnemonic(KeyEvent.VK_I);
    button.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e) {
    }

  • Unable to compile "SerialDemo.java", many "cannot find symbols" errors

    I have all the correct files in their respective directory.
    comm.jar in jre\lib\bin,
    javax.comm.properties in jre\lib
    win32com.dll in jre\bin
    I extracted all the whole of SerialDemo into one folder and started compiling from there. But it doesn't work. I keep getting many "cannot find symbol" errors. They are usually referred to by:
    SerialParameters
    SerialConnection
    AlertDialog
    SerialConnectionException
    SerialDemo.java is not edited and was compiled directly. All of my files are in one folder (AlertDialog.java compiles fine and is in the same folder, etc)
    I was wondering what might be the cause of it. I'm currently using a Windows XP Service Pack 2, IBM P3 Laptop. I was reading "http://forum.java.sun.com/thread.jspa?threadID=674514&messageID=3941560"
    And I found out it works fine on Win2k OS. Why is this so? I'm getting the exact same error as he stated on his last post and I tried looking for a solution and decided to turn to you guys. I'd really appreciate some help, if any. Thanks in advance.

    I followed the PlatformSpecific. I realised that I
    added one for JRE when it wasn't required. The
    problem was solved.
    Thank you so much, the both of you. My stupid mistake
    caused quite a bit of havoc. I apologise.No need to apologise; The confusing part is that when you download
    a jre, that's just what your get: a jre, but when you download the jdk
    you not just get the jdk and the jre but you get a second jre with them,
    stored under the jdk directory.
    To the programmer that second jre is useless, it is used internally by
    the jdk tools.
    kind regards,
    Jos

  • Java:8: cannot find symbol

    I did this small program for practice the Inheritance
    public class CalPrestDirecto extends CalPrestamo {
    public double Cuota = 0;
    public double mtoPrestamo = 0;
    public int preTiempo = 0;
    // a constructors
    public CalPrestDirecto (double Monto, int Tiempo) {
         mtoPrestamo = Monto;
    preTiempo = Tiempo;
    // a method
    public double cuotaprestdirecto() {
    Cuota = (mtoPrestamo * preTiempo);
    return Cuota;
    I compile the program and it say me. It doesn't find the constructor CalPrestamo, but this is the CalPrestamo
    import java.lang.String;
    public class CalPrestamo {
    public double Cuota = 0;
    public double mtoPrestamo = 0;
    public double tsaPrestamo = 0;
    public double intPrestamo = 0;
    public String tipPrestamo;
    // a constructors
    public CalPrestamo (double Monto, double Tasa,
    double Interes, String Tipo) {
         mtoPrestamo = Monto;
    tsaPrestamo = Tasa;
    intPrestamo = Interes;
    tipPrestamo = Tipo;
    // a method
    public double cuotaprestamo() {
    if (tipPrestamo == "f") {
    Cuota = (mtoPrestamo * tsaPrestamo); }
    else if (tipPrestamo == "v") {
    Cuota = tsaPrestamo; }
    else {
    Cuota = 1.00; };
    return Cuota;
    //(mtoPrestamo * tsaPrestamo);
    I think the problem is path or classpath for location of something.
    Somebody help about this small mistake.

    public class CalPrestamo
         public static double Cuota = 0;
         public double mtoPrestamo = 0;
         public double tsaPrestamo = 0;
         public double intPrestamo = 0;
         public String tipPrestamo;
         public CalPrestamo(double Monto,double Tasa,double Interes,String Tipo)
              mtoPrestamo = Monto;
              tsaPrestamo = Tasa;
              intPrestamo = Interes;
              tipPrestamo = Tipo;
         public double cuotaprestamo()
              if (tipPrestamo == "f")
                   Cuota = (mtoPrestamo * tsaPrestamo);
              else if (tipPrestamo == "v")
                   Cuota = tsaPrestamo;
              else
                   Cuota = 1.00;
              return Cuota;
         public static void main(String args[ ])     
              System.out.println(Cuota);
    O/p
    0.0
    The Above One is the Program. Copy and paste the code. It will work.
    I hope you understood the problem.

  • Java:57: cannot find symbol class _cls2

    Due to our loss of a software engineer who started this ongoing project many many moons ago I've come to compile it, but have the following error.
    I'm using netbeans 5.5 and JKD1.5 U12
    I've fixed all of the errors apart from this one:-
    table = new _cls2(model);
    Now the _cls2 class has not be defined anywhere, so I presume it should have been included within an old library file.... or have I got this worng.
    Any help appreciated I seem to be coming across the same websites over and over again whilst searching.....

    if its included in some other library you have somewhere then you need to import that library.

  • Java cannot find symbol [Color type]

    * Parked car class
    * class properties are
    * - Car Color
    * - Car Model
    * - Car Make
    * - License Number
    * - Number of minutes car has been parked
    public class ParkedCar {
    // Field declarations for class ParkedCar
    // declare color datatype (enum)
    Color CarColor;
    String CarModel,
    CarMake,
    LicenseNumber;
    double TimeParkedMinutes;
    public ParkedCar() {
    CarColor = Color.NOTSPECIFIED;
    CarModel = "NOT SPECIFIED";
    CarMake = "NOT SPECIFIED";
    LicenseNumber = "NOT SPECIFIED";
    TimeParkedMinutes = 0.0;
    } // end no arg constructor method for ParkedCar class
    public ParkedCar(Color parkedColor, String parkedModel, String parkedMake, String parkedLicense, double parkedMinutes) {
    CarColor = parkedColor;
    CarModel = parkedModel;
    CarMake = parkedMake;
    LicenseNumber = parkedLicense;
    TimeParkedMinutes = parkedMinutes;
    } // end constructor ParkedCar
    public Color getColor() {
    return CarColor;
    public String getModel() {
    return CarModel;
    public String getMake() {
    return CarMake;
    public String getLicenseNumber() {
    return LicenseNumber;
    public double getTimeParkedMinutes() {
    return TimeParkedMinutes;
    } // end class ParkedCar
    I keep getting this compilation error
    ParkedCar.java:21: cannot find symbol
    symbol  : class Color
    location: class Color.ParkedCar
    Color CarColor;
    The enumerated data type Color is declared within a separate class file. This code will compile when Color is defined within this class. Seems that enums are somewhat of a strange breed. Any ideas?
    Last edited by estex198 (2009-04-06 17:07:43)

    found some example code. I'm definately doing something wrong here. Do I need an import statement somewhere? I found some example code on a tutorial site. The enumerated data type Days is only accessible to members of EnumTest if its declaration is within the class EnumTest (as opposed to storing the enum declaration in its own .java file.
    public class EnumTest {
    public enum Day {
    SUNDAY, MONDAY, TUESDAY, WEDNESDAY,
    THURSDAY, FRIDAY, SATURDAY
    Day day;
    public EnumTest(Day day) {
    this.day = day;
    public void tellItLikeItIs() {
    switch (day) {
    case MONDAY: System.out.println("Mondays are bad.");
    break;
    case FRIDAY: System.out.println("Fridays are better.");
    break;
    case SATURDAY:
    case SUNDAY: System.out.println("Weekends are best.");
    break;
    default: System.out.println("Midweek days are so-so.");
    break;
    public static void main(String[] args) {
    EnumTest firstDay = new EnumTest(Day.MONDAY);
    firstDay.tellItLikeItIs();
    EnumTest thirdDay = new EnumTest(Day.WEDNESDAY);
    thirdDay.tellItLikeItIs();
    EnumTest fifthDay = new EnumTest(Day.FRIDAY);
    fifthDay.tellItLikeItIs();
    EnumTest sixthDay = new EnumTest(Day.SATURDAY);
    sixthDay.tellItLikeItIs();
    EnumTest seventhDay = new EnumTest(Day.SUNDAY);
    seventhDay.tellItLikeItIs();
    If I were to store the enum declaration in its own file then it should look something like this(?):
    public enum Day {
    SUNDAY, MONDAY, TUESDAY, WEDNESDAY,
    THURSDAY, FRIDAY, SATURDAY
    Thanks for your time.

  • Xerces cannot find symbol problem

    In my program I get an Xml from an exist database and want to place it in the hard drive.
    I have made the xerces imports I need:
    import org.apache.xerces.domx.XGrammarWriter.OutputFormat;
    import org.apache.xml.serialize.XMLSerializer;I have the jar on my classpath.and the code I am getting trouble with is:
    OutputFormat format = new OutputFormat(doc2);
                        format.setIndenting(true);
                        XMLSerializer serializer = new XMLSerializer(new FileOutputStream(new File("C:\\Configuration\\XmlCopy.xml")), format);I get the following errors
    C:\.....\Wizard1.java:2946: cannot find symbol
    symbol  : constructor OutputFormat(org.w3c.dom.Document)
    location: class org.apache.xerces.domx.XGrammarWriter.OutputFormat
                        OutputFormat format = new OutputFormat(doc2);
    C:\.....\Wizard1.java:2947: cannot find symbol
    symbol  : method setIndenting(boolean)
    location: class org.apache.xerces.domx.XGrammarWriter.OutputFormat
                        format.setIndenting(true);
    C:\....\Wizard1.java:2948: cannot find symbol
    symbol  : constructor XMLSerializer(java.io.FileOutputStream,org.apache.xerces.domx.XGrammarWriter.OutputFormat)
    location: class org.apache.xml.serialize.XMLSerializer
                        XMLSerializer serializer = new XMLSerializer(new FileOutputStream(new File("C:\\Configuration\\XmlCopy.xml")), format);Any ideas about what I'm doing wrong?

    StruL wrote:
    Instead of GrammarWriter.OutPutFormat.class it says GrammarWriter$OutPutFormat.class.
    relevant or plain stupid?
    Neither really,
    GrammarWriter.OutPutFormat is the name of the class,
    GrammarWriter$OutPutFormat.class is the file into which the class is stored.
    As to you problem the error messages you posted referred to
    C:\.....\Wizard1.java:2946: cannot find symbol
    symbol  : constructor OutputFormat(org.w3c.dom.Document)
    location: class org.apache.xerces.domx.XGrammarWriter.OutputFormatnote dom*x* and XGrammarWriter ,
    this is not the same as dom.GrammarWriter...

  • Cannot find symbol : class ! problem

    Hello,
    I have 2 java files (CD.java & CDCatalog.java) in a package called "testPackage". I can compile CD.java, but CDCatalog.java (that creates CD instances) gives following error - cannot find symbol symbol : class CD
    Below are the 2 files, please tell me why I get this errors , thanks!
    1) CDCatalog.java
    package testPackages;
    import java.util.Hashtable;
    //import testPackages.CD;
    public class CDCatalog {
    /** The CDs, by title */
    private Hashtable catalog;
    public CDCatalog( ) {
    catalog = new Hashtable( );
    // Seed the catalog
    addCD(new CD("Nickel Creek", "Nickel Creek", "Sugar Hill"));
    addCD(new CD("Let it Fall", "Sean Watkins", "Sugar Hill"));
    addCD(new CD("Aerial Boundaries", "Michael Hedges", "Windham Hill"));
    addCD(new CD("Taproot", "Michael Hedges", "Windham Hill"));
    public void addCD(CD cd) {
    if (cd == null) {
    throw new IllegalArgumentException("The CD object cannot be null.");
    catalog.put(cd.getTitle( ), cd);
    2) CD.java
    package testPackages;
    public class CD {
    private String title;
    private String artist;
    private String label;
    public CD( ) {
    // Default constructor
    public CD(String title, String artist, String label) {
    this.title = title;
    this.artist = artist;
    this.label = label;
    public String getTitle( ) {
    return title;
    public void setTitle(String title) {
    this.title = title;
    public String getArtist( ) {
    return artist;
    public void setArtist(String artist) {
    this.artist = artist;
    public String getLabel( ) {
    return label;
    public void setLabel(String label) {
    this.label = label;
    public String toString( ) {
    return "'" + title + "' by " + artist + ", on " +
    label;
    }

    just tried it as well, no problems, provided you
    compile CD.java firstI just tried from the shell ans look at this...
    E:\testPackages>dir
    Volume in drive E is MYFLASHDISK
    Volume Serial Number is 483B-B160
    Directory of E:\testPackages
    05/24/2006  07:48 PM    <DIR>          .
    05/24/2006  07:48 PM    <DIR>          ..
    05/24/2006  07:20 PM             1,143 CD.java
    05/24/2006  07:50 PM             1,053 CD.class
    05/24/2006  07:56 PM               972 CDCatalog.java
                   3 File(s)          3,168 bytes
                   2 Dir(s)   1,024,503,808 bytes free
    E:\testPackages>javac -cp e:\testPackages CDCatalog.java
    CDCatalog.java:30: cannot find symbol
    symbol  : class CD
    location: class testPackages.CDCatalog
        public void addCD(CD cd) {
                          ^
    CDCatalog.java:24: cannot find symbol
    symbol  : class CD
    location: class testPackages.CDCatalog
            addCD(new CD("Nickel Creek", "Nickel Creek", "Sugar Hill"));
                      ^
    CDCatalog.java:25: cannot find symbol
    symbol  : class CD
    location: class testPackages.CDCatalog
            addCD(new CD("Let it Fall", "Sean Watkins", "Sugar Hill"));
                      ^
    CDCatalog.java:26: cannot find symbol
    symbol  : class CD
    location: class testPackages.CDCatalog
            addCD(new CD("Aerial Boundaries", "Michael Hedges", "Windham Hill"));
                      ^
    CDCatalog.java:27: cannot find symbol
    symbol  : class CD
    location: class testPackages.CDCatalog
            addCD(new CD("Taproot", "Michael Hedges", "Windham Hill"));
                      ^
    5 errors
    E:\testPackages>I am now officially confused. I even specified the exact path to the CD.class file and javac still didnt like it.
    I'll dig some more. It has to be related to the classpath some how..
    JJ
    Still Stumped.. I'll sleep on it..
    Message was edited by:
    Java_Jay

  • Cannot find symbol error - Constructor

    Hi Folks,
    i am getting the following errors when the code is compiled. Please help! The code is as below. This code is for the laptop configuration. I have 2 classes, computer.java and Wclass.java with the WIn.java(main class)
    Also, how do i read the input from the radiobutton in the action performed
    WClass.java:13: cannot find symbol
    symbol : constructor Computer()
    location: class Computer
    Computer computer = new Computer();
    ^
    WClass.java:181: append(java.lang.String) in javax.swing.JTextArea cannot be applied to (java.lang.String,java.lang.String)
    Out.append("Computer Configuration for %s\n", computer.getName()
    ^
    WClass.java:182: append(java.lang.String) in javax.swing.JTextArea cannot be applied to (java.lang.String,float)
    Out.append("Processor:\t\t\t \n", computer.getProcessor());
    ^
    WClass.java:183: append(java.lang.String) in javax.swing.JTextArea cannot be applied to (java.lang.String,float)
    Out.append("HardDisk: \t\t\t \n", computer.getHarddisk());
    ^
    WClass.java:184: append(java.lang.String) in javax.swing.JTextArea cannot be applied to (java.lang.String,float)
    Out.append("RAM: \t\t\t \n", computer.getRam());
    ^
    WClass.java:185: append(java.lang.String) in javax.swing.JTextArea cannot be applied to (java.lang.String,float)
    Out.append("ProcessorSpeed:\t\t \n", computer.getProcessorSpeed(
    ^
    WClass.java:186: append(java.lang.String) in javax.swing.JTextArea cannot be applied to (java.lang.String,float)
    Out.append("Printer: \t\t\t \n", computer.getPrinter());
    ^
    WClass.java:187: append(java.lang.String) in javax.swing.JTextArea cannot be applied to (java.lang.String,float)
    Out.append("Inbuilt Wireless LAN: \t\t\n", computer.getWireless(
    ^
    WClass.java:188: append(java.lang.String) in javax.swing.JTextArea cannot be applied to (java.lang.String,float)
    Out.append("Floppy(External):\t\t \n", computer.getFloppy());
    ^
    WClass.java:189: append(java.lang.String) in javax.swing.JTextArea cannot be applied to (java.lang.String,float)
    Out.append("DVD Writer:\t\t\t \n", computer.getDVD());
    ^
    WClass.java:190: append(java.lang.String) in javax.swing.JTextArea cannot be applied to (java.lang.String,float)
    Out.append("CD Writer :\t\t\t \n", computer.getCdw());
    ^
    WClass.java:191: cannot find symbol
    symbol : method getTotal()
    location: class Computer
    Out.append("Total \t\t\t \n", computer.getTotal());
    ^
    12 errors
    import java.awt.event.*;
    import javax.swing.*;
    import java.awt.*;
    import java.util.*;
    import java.awt.event.*;
    public class Computer
         private String name;
         private float Processor_cost;
         private float total_cost;
         private float harddrive_cost;
         private float ram_cost;
         private float psspeed_cost;
         private float printer_cost;
         private float wireless_cost;
         private float floppy_cost;
         private float dvd_cost;
         private float cdwriter_cost;
         float pc[] = {1000f, 700f, 650f, 1200f};
         float hd[] = {0, 100f, 150f};
         float ps[] = {0, 100f, 125f};
         float ram[] = {0, 60f};
         float aa[] = {50f, 110f};
         float drive[] = {110f, 220f, 20};
         double T = 0.0;
    public Computer(String Cname, int pcost, float tcost, int hcost, float rcost,
    int pscost, float prcost, float wcost, float fcost, float dvdcost, float cdrwcost)
         name = Cname;
         Processor_cost = pc[pcost];
         total_cost = tcost;
         harddrive_cost = hd[hcost];
         ram_cost = rcost;
         psspeed_cost = ps[pscost];
         printer_cost = prcost;
         wireless_cost = wcost;     
         floppy_cost = fcost;
         dvd_cost = dvdcost;
         cdwriter_cost = cdrwcost;
    public void setName(String Cname)
         name = Cname;
    public String getName()
         return name;
    public void setProcessor(int pcost)
         Processor_cost = pc[pcost];
    public float getProcessor()
         return Processor_cost;
    public void setHarddisk(int hcost)
         harddrive_cost = hd[hcost];
    public float getHarddisk()
         return harddrive_cost;
    public void setRam(int rcost)
         ram_cost = rcost;
    public float getRam()
         return ram_cost;
    public void setProcessorSpeed(int pscost)
         psspeed_cost = ps[pscost];
    public float getProcessorSpeed()
         return psspeed_cost;
    public void setPrinter(float prcost)
         printer_cost = prcost;
    public float getPrinter()
         return printer_cost;
    public void setWireless(float wcost)
         wireless_cost = wcost;
    public float getWireless()
         return wireless_cost;
    public void setFloppy(float fcost)
         floppy_cost = fcost;
    public float getFloppy()
         return floppy_cost;
    public void setDVD(float dvdcost)
         dvd_cost = dvdcost;
    public float getDVD()
         return dvd_cost;
    public void setCdw(float cdrwcost)
         cdwriter_cost = cdrwcost;
    public float getCdw()
         return cdwriter_cost;
    //public String show()
    //     String out;
         //return out.format();
    public double Total()
         T = getProcessor() + getHarddisk() + getRam() + getProcessorSpeed() + getPrinter() + getWireless() + getFloppy() + getDVD() + getCdw();
         return T;
    import java.awt.event.*;
    import javax.swing.*;
    import java.awt.*;
    import java.util.*;
    public class WClass extends JFrame implements ActionListener
         Computer computer = new Computer();
         private JPanel P1;
         private JPanel P2;
         private JButton submit;
         private JButton clear;
         private JTextArea Out;
         private JLabel name;
         private JTextField Custname;
         private JComboBox processor;
         private JComboBox harddrive;
         private JRadioButton ram1;
         private JRadioButton ram2;
         private JRadioButton ram3;
         private JPanel radiopanel;
         private ButtonGroup radiogroup;
         private JComboBox processorsd;
         private JLabel L1;
         private JCheckBox printer;
         private JCheckBox lan;
         private JLabel L2;
         private JCheckBox fpy;
         private JCheckBox dvd;
         private JCheckBox cdrw;
         private JLabel L3;
         private JLabel L4;
         private JLabel L5;
         private JLabel L6;
         private JLabel L7;
         private JLabel L8;
         private JLabel L9;
         private Container c;
         int row;
         float prncost = 50f;
         float wlan = 110f;
         float fppy = 110f;
         float dvdw = 220f;
         float cdw = 20f;
         public WClass()
              super("Laptop Configuration");
              P1 = new JPanel();
              P1.setLayout(new GridLayout(10,2,5,10));
              P2 = new JPanel(new BorderLayout());
              name = new JLabel("Customer Name");
              P1.add(name);
              Custname = new JTextField(10);
              Custname.addActionListener(this);
              P1.add(Custname);
              L3 = new JLabel("Processor");
              P1.add(L3);
              String p[] = {"Pentium 4", "Celeron", "AMD", "Intel Centrino"};
              processor = new JComboBox(p);
              processor.setMaximumRowCount(3);
              P1.add(processor);
              L4 = new JLabel("Hard Disk");
              P1.add(L4);
              String h[] = {"30 GB", "40 GB", "60 GB"};
              harddrive = new JComboBox(h);
              harddrive.setMaximumRowCount(2);
              P1.add(harddrive);
              L5 = new JLabel("RAM");
              P1.add(L5);
              radiopanel = new JPanel();
              radiopanel.setLayout(new GridLayout(1,2));
              ram1 = new JRadioButton("256 MB", true);
              ram2 = new JRadioButton("512 MB", false);
              radiopanel.add(ram1);
              radiopanel.add(ram2);
              radiogroup = new ButtonGroup();
              radiogroup.add(ram1);
              radiogroup.add(ram2);
              P1.add(radiopanel);
              L6 = new JLabel("Processor Speed");
              P1.add(L6);
              String ps[] = {"1.8 GHz", "2.2 GHz", "2.8 GHz"};
              processorsd = new JComboBox(ps);
              processorsd.setMaximumRowCount(2);
              P1.add(processorsd);
              L1 = new JLabel("Additional Accessories");
              P1.add(L1);
              printer = new JCheckBox("Ink Jet Printer");
              lan = new JCheckBox("Inbuilt Wireless LAN");
              P1.add(printer);
              L7 = new JLabel("");
              P1.add(L7);
              P1.add(lan);
              L2 = new JLabel("Drives");
              P1.add(L2);
              fpy = new JCheckBox("Floppy(External)");
              dvd = new JCheckBox("DVD Writer");
              cdrw = new JCheckBox("CD Writer");
              P1.add(fpy);
              L8 = new JLabel("");
              P1.add(L8);
              P1.add(dvd);
              L9 = new JLabel("");
              P1.add(L9);
              P1.add(cdrw);
              c = getContentPane();
              add(P1, BorderLayout.NORTH);
              submit = new JButton("Submit");
              clear = new JButton("Clear");
              Out = new JTextArea(10,5);
              P2.add(submit, BorderLayout.WEST);
              P2.add(clear, BorderLayout.EAST);
              P2.add(Out,BorderLayout.CENTER);
              add(P2, BorderLayout.SOUTH);
         public void actionPerformed(ActionEvent event)
              if(event.getSource() == submit)
              computer.setName(name.getText());
              computer.setProcessor(processor.getSelectedIndex());
              computer.setHarddisk(harddrive.getSelectedIndex());
              //computer.setRam(radiogroup.getAccessibleContext());
              computer.setProcessorSpeed(processorsd.getSelectedIndex());
              if(printer.isSelected())
                   computer.setPrinter(prncost);
              if(lan.isSelected())
                   computer.setWireless(wlan);
              if(fpy.isSelected())
                   computer.setFloppy(fppy);
              if(dvd.isSelected())
                   computer.setDVD(dvdw);
              if(cdrw.isSelected())
                   computer.setCdw(cdw);
              Out.append("Computer Configuration for %s\n", computer.getName());
              Out.append("Processor:\t\t\t \n", computer.getProcessor());
              Out.append("HardDisk: \t\t\t \n", computer.getHarddisk());
              Out.append("RAM: \t\t\t \n", computer.getRam());
              Out.append("ProcessorSpeed:\t\t \n", computer.getProcessorSpeed());
              Out.append("Printer: \t\t\t \n", computer.getPrinter());
              Out.append("Inbuilt Wireless LAN: \t\t\n", computer.getWireless());
              Out.append("Floppy(External):\t\t \n", computer.getFloppy());
              Out.append("DVD Writer:\t\t\t \n", computer.getDVD());
              Out.append("CD Writer :\t\t\t \n", computer.getCdw());
              Out.append("Total \t\t\t \n", computer.getTotal());
              if(event.getSource() == clear)
                   Custname.setText("");
                   Out.setText("");
                   ram1 = new JRadioButton("256 MB", true);
                   c.setLayout(new GridLayout(10,2,5,10));
    import javax.swing.JFrame;
    public class Win
         public static void main(String args[])
              WClass window = new WClass();
              window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE );
              window.setSize( 500,550);
              window.setVisible( true);
    }

    When you make a class, the compiler often gives you an empty constructor. The Computer class for example would have the following constructor.
    public Computer(){ }This means you can write code, as you did in the third program like the following.
    Computer c = new Computer();However if you write your own constructor such as:
    public Computer(String Cname, int pcost, float tcost, int hcost, float rcost,
    int pscost, float prcost, float wcost, float fcost, float dvdcost, float cdrwcost)Then an empty constructor is not supplied. So you must write your own if you want one or you must use the one that you created.
    You can create as many constructors as you like, so long as they all take different arguments

  • Newbie question: cannot find symbol symbol: class STRING

    I've just decided to teach myself some java, and on my first try something's going wrong and I don't know what it is.
    I'm currently doing this tutorial: http://java.sun.com/docs/books/tutorial/uiswing/learn/example1.html
    and everything is good until I try to compile it and I get this error in the cmd
    HelloWorldSwing.java:30: cannot find symbol
    cannot find symbol
    symbol: class STRING
    everything has been written verbatim from the tutorial, including "import javax.swing.*;"
    What's wrong with it and how do I fix it?

    Hi,
    I saw the coding that You had given a link in your post. Change the following
        public static void main(String[] args) {bye for now
    sat

  • Cannot find symbol class entry

    .\ListGraph.java:26: cannot find symbol
    symbol : class Entry
    location: class Map
    for(Map.Entry<Stad,List<ListEdge>> me : nodes.entrySet())
    ^
    1 error
    this is what i get when i try to compile this code, its the lowest part thats getting errors:
    import java.util.*;
    import java.util.Map.*;
    import java.util.Map.Entry;
    class ListGraph{
         private HashMap<Stad,List<ListEdge>> nodes =
              new HashMap<Stad,List<ListEdge>>();
         public void addNode(Stad ny){
              nodes.put(ny, new ArrayList<ListEdge>());
         public void connect(Stad from, Stad to, String n, int v){
              List<ListEdge> fromList = nodes.get(from);
              List<ListEdge> toList = nodes.get(to);
              ListEdge e1 = new ListEdge(to, n, v);
              fromList.add(e1);
              ListEdge e2 = new ListEdge(from, n, v);
              toList.add(e2);
         public String toString(){
              String ret = "";
              for(Map.Entry<Stad,List<ListEdge>> me : nodes.entrySet())
                   ret += me.getKey()+": "+me.getValue()+"\n";
              return ret;
    }

    Bananen123 wrote:
    .\ListGraph.java:26: cannot find symbol
    symbol : class Entry
    location: class MapI don't get the same error, so I'm not sure what code you are actually trying to compile. Do you happen to have defined another class named Map in the default package?
    Also, please use code tags when posting code. Example: import java.util.*;
    import java.util.Map.*;
    import java.util.Map.Entry;
    class ListGraph{
        private HashMap<Stad,List<ListEdge>> nodes =
            new HashMap<Stad,List<ListEdge>>();
        public void addNode(Stad ny){
            nodes.put(ny, new ArrayList<ListEdge>());
        public void connect(Stad from, Stad to, String n, int v){
            List<ListEdge> fromList = nodes.get(from);
            List<ListEdge> toList = nodes.get(to);
            ListEdge e1 = new ListEdge(to, n, v);
            fromList.add(e1);
            ListEdge e2 = new ListEdge(from, n, v);
            toList.add(e2);
        public String toString(){
            String ret = "";
            for(Map.Entry<Stad,List<ListEdge>> me : nodes.entrySet())
                ret += me.getKey()+": "+me.getValue()+"\n";
            return ret;
    class Stad {}
    class ListEdge{ ListEdge(Stad s, String str, int i) {} }~

Maybe you are looking for