What does "cannot find symbol"

i got this when i was writing a program
2 errors found:
File: C:\Documents and Settings\Project1.java [line: 7]
Error: cannot find symbol
symbol : class Scanner
location: class Project1
File: C:\Documents and Settings\\Project1.java [line: 7]
Error: cannot find symbol
symbol : class Scanner
location: class Project1
What does this mean?

2 errors found:
File: C:\Documents and Settings\Project1.java [line: 7]
Error: cannot find symbol
symbol : class Scanner
ocation: class Project1try using:
import java.util.Scanner;or
import java.util.*;this should work.

Similar Messages

  • Please! WHY? Why does the main class cannot find symbol symbol : constructor Car(double) location: class Car?

    Why does the main class cannot find symbol symbol : constructor Car(double) location:
    class Car .. ??
    class Car
    { //variable declaration
    double milesStart; double milesEnd; double gallons;
    //constructors
    public Car(double start, double end, double gall)
    { milesStart = start; milesEnd = end; gallons = gall; }
    void fillUp(double milesE, double gall)
    { milesEnd = milesE; gallons = gall; }
    //methods
    double calculateMPG()
    { return (milesEnd - milesStart)/gallons; }
    boolean gashog() { if(calculateMPG()<15) { return true; } else { return false; } }
    boolean economycar() { if(calculateMPG()>30) { return true; } else { return false; } } }
    import java.util.*; class MilesPerGallon
    { public static void main(String[] args)
         double milesS, milesE, gallonsU;
         Scanner scan = new Scanner(System.in);
         System.out.println(\"New car odometer reading: 00000\");
          Car car = new Car(milesS); car.fillUp(milesE, gallonsU);
         System.out.println(\"New Miles: \" + milesE); milesE = scan.nextDouble();
         System.out.println(\"Gallons used: \" + gallonsU);
         gallonsU = scan.nextDouble();
         System.out.println( \"MPG: \" + car.calculateMPG() );
         if(car.gashog()==true) { System.out.println(\"Gas Hog!\");
          if(car.economycar()==true) { System.out.println(\"Economy Car!\");
         } System.out.println(\"\");
         milesS = milesS + milesE;
         System.out.println(\"Enter new miles\");
          milesE = scan.nextDouble();
         System.out.println(\"Enter gallons used: \");
          gallonsU = scan.nextDouble();
         car.fillUp(milesE, gallonsU);
         System.out.println(\"Initial miles: \" + milesS);
         System.out.println(\"New Miles: \" + milesE);
         System.out.println(\"Gallons used: \" + gallonsU);
         System.out.println( \"MPG: \" + car.calculateMPG() );
         System.out.println(\"\"); } }

    Why does the main class cannot find symbol symbol : constructor Car(double) location:
    class Car .. ??
    Please tell us which line of code you posted shows 'Car (double)'.
    The only constructor that I see is this one:
    Car(double start, double end, double gall)

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

  • 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

  • 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 even though it's there.

    I am having an issue compiling a java class in oracle. I have a java class that will run an executable. I want to call that java class from a difference class and when I try to compile that class, it fails with Cannot Find Symbol.
    This is what errors, and it errocs when I declare ec as ExecCMD.
    CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "MS_FS_FUNCTIONS" AS
    import java.io.*;
    import java.util.*;
    import java.sql.*;
    import oracle.sql.*;
    import ms_fs_execcmd.ExecCMD.*;
    public class exportPDF
        public static String export_PDF(String p_pdf_contents)
            ExecCMD ec ;
           ec = new ExecCMD("ExportPDFData.exe");
            return "string";
    This is the class im trying to call.
    CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED MS_FS_EXECCMD AS
    package ms_fs_execcmd;
    import java.util.*;
    import java.io.*;
    public class ExecCMD
        public static void main(String args[])
            try
            {   if (args.length > 0 ){        
                    Runtime rt = Runtime.getRuntime();
                    Process proc = rt.exec(args[0]);
                    InputStream stderr = proc.getErrorStream();
                    InputStreamReader isr = new InputStreamReader(stderr);
                    BufferedReader br = new BufferedReader(isr);
                    String line = null;
                    System.out.println("<ERROR>");
                    while ( (line = br.readLine()) != null)
                    System.out.println(line);
                    System.out.println("</ERROR>");
                    int exitVal = proc.waitFor();
                    System.out.println("Process exitValue: " + exitVal);
            } catch (Throwable t)
                t.printStackTrace();
    here is the error message.
    [Error]  (0: 0): MS_FS_FUNCTIONS:11: cannot find symbol
    [Error]  (0: 0): symbol  : constructor ExecCMD(java.lang.String)
    [Error]  (0: 0): location: class ExecCMD
    [Error]  (0: 0):        ec = new ExecCMD("ExportPDFData.exe");
    [Error]  (0: 0):             ^
    [Error]  (0: 0): 1 error

    Bill,
    I'm having exactly the same problem with trying to install Portal 4.0. Has
    anybody given you an answer to this problem?
    Thanks,
    Bill Goggin wrote:
    I recently moved my evaluation copy of WebLogic 6.1 SP 1 from /opt to
    /usr/local on my RedHat 7.1 box. WebLogic runs fine from the new
    location. However, when I try to install my evaluation copy of WLPortal
    4.0, it insists that WebLogic 6.1 SP 1 is not installed in my BEA_HOME,
    even though it is. I've uninstalled and re-installed WebLogic many
    times, but it still won't work. Does the uninstall miss some files? Has
    anyone else had this problem?

  • Cannot find symbol error when compiling in different packages

    Hey all,
    I'm trying to divide my project into a sensible hierarchy. This is what I want:
    MyProject
    MyProject/src ................................. where all the source files are (no further directories)
    MyProject/classes
    MyProject/classes/Main.class
    MyProject/classes/classes2 ................ sorry for not being creative XD
    MyProject/classes/classes2/Age.classNow, Age uses Main, and this is where the trouble is. I'm using javac directly to compile Age, and this is how I'm doing it:
    //from MyProject
    javac -cp classes src/Age.javaAnd I get this error:
    bla bla bla...cannot find symbol
    symbol  : variable Main
    location: class classes2.Age
              years = (byte)(Main.year - m.getYear());
                             ^Main is already compiled and in place.
    Also, this is how Age.java starts:
    package classes2;
    public class Age
    {...etcI'm using JCreator as an IDE (and using it's own build function, the same error occurs, which is why I tried directly compiling the file).
    Why can't javac find Main.class? I tried searching Google, but my particular problem didn't seem to crop up.
    Hope I provided enough information, and ask if more is needed.
    Many thanks :)

    If Main is not in a package (which it appears not to be), then it cannot be referenced by any class that is in a package. If Main is in a package, then you'll need to refer to it by it's fully-qualified name (or import it as such) if it's not in the same package as the class that's referring to it, and Main.class will have to be in a directory that corresponds to its package.
    Also, though the compiler may not require it, your source code directory structure should match your package hierarchy.

  • E.getSource()         cannot find symbol - variable e

    I'm currently developing a program for course I'm in that needs to allow a user to open a file, scan the information out of it and display the results.
    I'm currently stuck on an error that's really confused me. On the line: if (e.getSource() == readButton) { 
    the compiler displays the following <cannot find symbol - variable e>.
    If anyone could advise me as to my mistake I'd be very happy.
       public void readData(){
        this.textArea.setText(""); // clear the text area, ready to append new strings.
        fc = new JFileChooser();
               File file = null;
               FileReader reader = null;
               if (e.getSource() == readButton) {
                int rValue = fc.showOpenDialog(Plotter.this);
                if (rValue == JFileChooser.APPROVE_OPTION) {
                    File file = fc.getSelectedFile();
                    reader = new FileReader(file);
                    log.append("Opening: " + file.getName() + "." + newline);
                else {
                    log.append("Open cancelled by user." + newline);
                log.setCaretPosition(log.getDocument().getLength());
                Scanner input = new Scanner(file);
                while (input.hasNextLine()){
             input.close();
        }

    scphan wrote:
    I guess you probably didn't see the post previous to yours ;). Just 2 minutes difference;Yes I did read that post. That is what prompted me to say I think they are doing it wrong. OP suggested that the readData method needed the ActionEvent to be passed as a parameter. Whereas I believe the actionPerformed method should be handle the event and the readData method should do just that: read data.
    public void actionPerformed(ActionEvent e) {
        if (e.getSource() == readButton) {
            readData();
    private void readData() {
        // method just reads the file
        // no need to handle event here
    }

  • Jdk6 - cannot find symbol

    Hi,
    I've just encountered a problem compiling with sun jdk6, that I've never met before.
    I've the class Arch that uses objects of the class Node.
    I compile the Node class without any problem ( javac -cp "../lib/*" it/bcdm/di/core/Node.java); but while compiling the Arch class after that, I get
    cannot find symbol
    symbol : class Node
    location: class it.bcdm.di.core.Arch
         private Node da = null;
         ^
    Either the Node and the Arch class stay within the same folder it/bcdm/di/core.
    I've already tried to include within the classpath, the path of the folder containing the file Node.class, in this way:
    javac -cp "../lib/*;it/bcdm/di/core/*" it/bcdm/di/core/Arch.java
    and I've also already tried this:
    export CLASSPATH=$CLASSPATH:/pathOfMyProject/it/bcdm/di/core/
    and also
    export PATH=$PATH:/pathOfMyProject/it/bcdm/di/core/
    but unsuccessful...
    this is the output of the verbose compilation mode:
    [parsing started it/bcdm/di/core/Arch.java]
    [parsing completed 35ms]
    [search path for source files: ../lib/*,it/bcdm/di/core/*]
    [search path for class files: /usr/lib/jvm/java-6-sun-1.6.0.07/jre/lib/resources.jar,/usr/lib/jvm/java-6-sun-1.6.0.07/jre/lib/rt.jar,/usr/lib/jvm/java-6-sun-1.6.0.07/jre/lib/sunrsasign.jar,/usr/lib/jvm/java-6-sun-1.6.0.07/jre/lib/jsse.jar,/usr/lib/jvm/java-6-sun-1.6.0.07/jre/lib/jce.jar,/usr/lib/jvm/java-6-sun-1.6.0.07/jre/lib/charsets.jar,/usr/lib/jvm/java-6-sun-1.6.0.07/jre/classes,/usr/lib/jvm/java-6-sun-1.6.0.07/jre/lib/ext/sunpkcs11.jar,/usr/lib/jvm/java-6-sun-1.6.0.07/jre/lib/ext/sunjce_provider.jar,/usr/lib/jvm/java-6-sun-1.6.0.07/jre/lib/ext/localedata.jar,/usr/lib/jvm/java-6-sun-1.6.0.07/jre/lib/ext/dnsns.jar,../lib/*,it/bcdm/di/core/*]
    [loading java/lang/Comparable.class(java/lang:Comparable.class)]
    [loading java/lang/Object.class(java/lang:Object.class)]
    [loading java/lang/String.class(java/lang:String.class)]
    it/bcdm/di/core/Arch.java:5: cannot find symbol
    symbol : class Node
    location: class it.bcdm.di.core.Arch
         private Node da = null;
         ^
    it/bcdm/di/core/Arch.java:6: cannot find symbol
    symbol : class Node
    location: class it.bcdm.di.core.Arch
         private Node a = null;
         ^
    [loading java/lang/ClassCastException.class(java/lang:ClassCastException.class)]
    it/bcdm/di/core/Arch.java:49: cannot find symbol
    symbol : class Node
    location: class it.bcdm.di.core.Arch
         public Node getFrom(){
         ^
    it/bcdm/di/core/Arch.java:52: cannot find symbol
    symbol : class Node
    location: class it.bcdm.di.core.Arch
         public Node getTo(){
         ^
    it/bcdm/di/core/Arch.java:72: cannot find symbol
    symbol : class Node
    location: class it.bcdm.di.core.Arch
         public void setFrom(Node x){
         ^
    it/bcdm/di/core/Arch.java:75: cannot find symbol
    symbol : class Node
    location: class it.bcdm.di.core.Arch
         public void setTo(Node y){
         ^
    [checking it.bcdm.di.core.Arch]
    [loading java/lang/Error.class(java/lang:Error.class)]
    [loading java/lang/RuntimeException.class(java/lang:RuntimeException.class)]
    [loading java/lang/Exception.class(java/lang:Exception.class)]
    [loading java/lang/Throwable.class(java/lang:Throwable.class)]
    this is my java version:
    java version "1.6.0_07"
    Java(TM) SE Runtime Environment (build 1.6.0_07-b06)
    Java HotSpot(TM) Server VM (build 10.0-b23, mixed mode)
    and I made these attempts either in debian and in windows XP, with the same java version installed.
    have you any idea to solve this compilation error?

    warnerja wrote:
    masijade, I think you might be confused as to what the OP is doing with that asterisk. As yawmark shed some light on it earlier, the wildcard lets the user conveniently include all .jar files it finds in the /lib directory, as if the user did this:
    -cp /lib/one.jar;/lib/two.jar;/lib/three.jar
    (assuming the /lib directory contains one.jar, two.jar, and three.jar)Yes, I know, but the op is complaining that he just compiled "Node", then by compiling "Arch" it could not find "Node", which means it won't be in those jars, anyway. (Edit: If he had used a -d option, the classes would have been in that directory, but then the "*", I believe, would hinder, not help, at least in respect to those newly compiled classes.)
    Also, OP, if you are not specifiying a -d option, then you also need to include "." on the classpath, as the classfiles will appear "in place" (i.e. right alongside the corresponding java files when compiled using the above command), which means that "." must also be on the classpath (as that is the "root" for the newly compiled classes).
    Edit Again, Although I will admit I hadn't remembered about the "*" being a new feature in 6 (though now that it has been mentioned as such I do remember having read about it, once).

  • Cannot find symbol symbol : class Item location: package platypos.services.

    Well, I am having a few problems getting this java file to compile.
    /home/brandon/Desktop/platypos/services/order/Seat.java
    package platypos.services.order;
    import platypos.services.order.Item;
    import java.util.Vector;
    public class Seat
        private int             _number;
        private Vector<Item>    _items  = new Vector<Item>();
        public static void main(String args[])
            System.out.println("Hello");
    }here is my terminal session:
    brandon@Aspire5100:~$ javac /home/brandon/Desktop/platypos/services/order/Seat.java
    /home/brandon/Desktop/platypos/services/order/Seat.java:17: cannot find symbol
    symbol  : class Item
    location: package platypos.services.order
    import platypos.services.order.Item;
                                  ^
    /home/brandon/Desktop/platypos/services/order/Seat.java:23: cannot find symbol
    symbol  : class Item
    location: class platypos.services.order.Seat
        private Vector<Item>    _items  = new Vector<Item>();
                       ^
    /home/brandon/Desktop/platypos/services/order/Seat.java:23: cannot find symbol
    symbol  : class Item
    location: class platypos.services.order.Seat
        private Vector<Item>    _items  = new Vector<Item>();
                                                     ^
    3 errors/home/brandon/Desktop/platypos/services/order/Item.java is packaged as follows
    package platypos.services.order;and has been successfully compiled to Item.class in the same directory.
    I am using the latest JDK on Ubuntu 8.04
    I am a bit more skilled in C++ and am trying to learn java, anyone got any clues as to what I am doing wrong?
    Thank you

    yep, here is an abridged version of the Item.java file. and it has been successfully compiled to Item.class
    package platypos.services.order;
    import java.util.Vector;
    class Item
         // Constructor     
         public Item(String name)
              SetName(name);     
        // Main Function
        public static void main(String args[])
    }Edited by: javaperson on Apr 30, 2008 11:01 PM

  • Error: cannot find symbol implements..

    I have an interface and I'm trying to implement.
    package data_structures;
    public interface ListADT<E> extends Iterable<E> {
    //Method Signatures
    and
    package data_structures;
    public class LinkedListDS<E> implements ListADT<E> {
    //Code
    And when I try to compile the class I get
    LinkedListDS.java:3 error: cannot find symbol
    public class LinkedListDS<E> implements ListADT<E> {
    ____________________________________^
    symbol: class ListADT
    And I'm not really sure what I'm doing wrong here or what exactly Java wants me to do to correct this error.

    What are you using to compile?  If the command line, and not an IDE which will do this for you, then compile the interface, first.

  • "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) {
    }

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

  • Cannot find symbol - XStream xstream = new XStream();

    Hello everyone! :D I'm currently working on something that can load 'configuration' (some kind of cache) via. XML files.
    To do so I made a instance of the Object class:
        public static Object load(File file)
            try
                InputStream is = new GZIPInputStream(new FileInputStream(file));
                Object rv = xstream.fromXML(is);
                return rv;
            catch (IOException ioe) {
                System.err.println(ioe.getMessage());
            return null;
        }And I have initialized the XStream class like this: private final static XStream xstream = new XStream();And yes I have imported this: import com.thoughtworks.xstream.XStream;But still I get this annoying error...
    I store the xstream.jar in a folder named lib. (Together with some other JAR's like: xpp3, mina, hex-string and such things).
    If you need more of my code just tell me and I'll post.

    I do know that I don't need code but i need to use the javac.exe program. But I don't get a (s)(h)(i)(t) of how I can add my lib folder to the compiler, in a classpath. But here's what my compiler says: DataConversions.java:3: package com.bombaydigital.vault does not exist
    import com.bombaydigital.vault.HexString;
                                  ^
    PersistenceManager.java:6: package com.thoughtworks.xstream does not exist
    import com.thoughtworks.xstream.*;
    ^
    PersistenceManager.java:10: cannot find symbol
    symbol  : class XStream
    location: class org.rscdaemon.client.util.PersistenceManager
        public static XStream xstream = new XStream();
                      ^
    DataConversions.java:279: cannot find symbol
    symbol  : variable HexString
    location: class org.rscdaemon.client.util.DataConversions
            return HexString.bufferToHex(md.digest());
                   ^
    PersistenceManager.java:10: cannot find symbol
    symbol  : class XStream
    location: class org.rscdaemon.client.util.PersistenceManager
        public static XStream xstream = new XStream();
                                            ^
    5 errorsAnd this is the folder where my XStream.jar is located. C:\Documents and Settings\Benjamin Dahse\Client\libAnd this is how I'm compiling: "C:/programmer/Java/jdk1.6.0_10/bin/javac.exe" *.java <-- so far XD.
    I suppose this was the information you required so now please, please, please, make my compiler ;).

  • "cannot find symbol" error in compiling

    I'm just begining to learn Java and I have the "Teach yourself Java in 21 Days" book. I can't get the code to work and every time I compile the VolcanoRobot.java, I get this error:
    "VolcanoRobot.java:25: cannot find symbol
    symbol : method showAttributes()
    location: class VolcanoRobot
    dante.showAttributes();
    ^
    VolcanoRobot.java:28: cannot find symbol
    symbol : method showAttributes()
    location: class VolcanoRobot
    dante.showAttributes();
    ^
    VolcanoRobot.java:31: cannot find symbol
    symbol : method showAttributes()
    location: class VolcanoRobot
    dante.showAttributes();
    ^
    VolcanoRobot.java:34: cannot find symbol
    symbol : method showAttributes()
    location: class VolcanoRobot
    dante.showAttributes();
    ^
    4 errors"
    and here is my code:
    "class VolcanoRobot {
    String status;
    int speed;
    float temperature;
    void checkTemperature() {
    if (temperature > 700) {
    status = "returning home";
    speed = 8;
    void showAtrributes() {
    System.out.println("Status: " +status);+
    +System.out.println("Speed: "+ speed);
    System.out.println("Temperature: " + temperature);
    public static void main(String[] arguments) {
    VolcanoRobot dante = new VolcanoRobot();
    dante.status = "exploring";
    dante.speed = 2;
    dante.temperature = 510;
    dante.showAttributes();
    System.out.println("Increasing speed to 3.");
    dante.speed = 3;
    dante.showAttributes();
    System.out.println("Changing temperature to 670.");
    dante.temperature = 670;
    dante.showAttributes();
    System.out.println("Checking the temperature.");
    dante.checkTemperature();
    dante.showAttributes();
    }"

    Use code tags when you post code.
    Post the code that produces the error - the code that you posted does not.
    The code you posted has the following errors
    VolcanoRobot.java:18: ')' expected
                    System.out.println("Status: " status);
                                                 ^
    VolcanoRobot.java:18: illegal start of expression
                    System.out.println("Status: " status);
                                                        ^
    VolcanoRobot.java:19: ')' expected
                    System.out.println("Speed: " speed);
                                                ^
    VolcanoRobot.java:19: illegal start of expression
                    System.out.println("Speed: " speed);Once those errors are fixed you get the errors that you posted.
    VolcanoRobot.java:25: cannot find symbolThe number in that line (25) tells you the exact line where the error appeared. Although sometimes the cause might be a line before that.
    It also tells you specifically what it doesn't like. In this case 'showAttributes'.
    Hint: So look at that line carefully. And look at the method carefully that that is supposed to call. They are not the same.

Maybe you are looking for