Compiler error: "cannot find symbol" - constructor

Dear all,
I keep getting the compiler error "cannot find symbol" - constructor AWTEvent() for the following class. It's supposed to extend AWTEvent to give me my own event to be fired. What could be wrong?
import java.awt.*;
import java.awt.event.*;
public class MyButtonEvent extends AWTEvent
     public MyButtonEvent()
}Thanks a lot!
N

When you do this
public MyButtonEvent()
}you are implicitly calling the super class constructor with no parameters
That is:
AWTEvent();
you can think of it as
public MyButtonEvent()
     AWTEvent(); // <-- automatically generated for you
     //the rest of your stuff
}the problem is that AWTEvent has no such constructor, so you need to explicitly put another constructor in your constructor as the first statement. This other constructor has to be one that exists in AWTEvent.

Similar Messages

  • Compile error : Cannot find symbol

    hello, i'm having trouble compiling a bean that resorts to another bean's public operation. Im trying to make a shopping cart which takes individual item orders such as item name and quantity and place them within an array list called cart in another bean. The errors i get when im trying to compile is:
    cannot find symbol
    symbol : class OrderItem
    location: class beans.WidgetOrder
               public void setItem(OrderItem o){cart.add(o);}I've looked at other threads and heard that quicktime can intervein with the classpath, so i deleted that, and also checked that CLASSPATH is set to C:\Program Files\Java\jre1.6.0_04\lib\ext\QTJava which it is, but the javabeans are set in the same path so i don't know what difference that is.

    Are you using an IDE?
    Is the OrderItem class in the beans package?
    You should have a path structure like some/path/beans where the WidgetOrder.class file will reside inside the beans directory. If OrderItem is in the beans package, then when you compile you should use something like "javac -cp some/path WidgetOrder.java"

  • Compile error "cannot find symbol" THE ANSWER

    people who want to know the answer to this question follow these steps:
    When you install QuickTime 7 it messes up the Classpath, which you can find under: Start/Settings/Control Panel. Double click System. Click the Advanced tab and then the Environment Variables button.
    I suggest that you install QuickTime 6.5 and then check that the Java
    functions are working correctly. Then go to the Classpath setting for the
    JDK, and insert a ;(semi colon) at the start of the
    path.
    I FEEL LIKE DANCING

    Want to know something Disco Duck? I knew the answer all along but didn't want to help you given your crosspost and the attitude you displayed after being called on it.

  • [Greenfoot] "cannot find symbol - constructor Plotter"?

    I am attempting to make a sinusoid plotter as part of my math class. Using Greenfoot, I have created a class Plotter, which is supposed to accept amplitude, frequency, vertical displacement, and phase displacement and then plot the resulting sinusoid. Everything works fine, except when I try to compile the program I get an error message "cannot find symbol - constructor Plotter(float,float,float,float)" when I compile the World object which creates the Plotter object. My call in the World object's constructor:
    GraphWorld()
    // Create the field, which is 800x450 pixels.
    super(800, 450, 1);
    // These will eventually be set by a prompt to the user.
    float amp = 1;
    float freq = 1;
    float vd = 0;
    float pd = 0;
    addObject(new Plotter(amp,freq,vd,pd), 0, 225);
    }I am currently using a workaround by changing the code directly within the Plotter class, but I would like to find the source of the problem.

    Grey_Ghost wrote:
    It should.That's what the compiler thinks too.
    Here is the constructor as it is defined in class Plotter:
    public void Plotter(float Amplitude, float Frequency, float VertDisp, float PhaseDisp)
    amplitude = Amplitude;
    frequency = Frequency;
    vertDisp = VertDisp;
    phaseDisp = PhaseDisp;
    Except that's not a constructor. Constructors don't have return values.

  • Error : 'cannot find symbol getText()'

    please check my java coding. when I compile it, the error: 'cannot find symbol
    getText() ' is appear. What wrong with this coding.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class buatAction
    public static void main(String[] args)
    JFrame f= new JFrame("Contoh Action");
    f.setSize(150,200);
    f.setLocation(200,200);
    f.addWindowListener(new WindowAdapter()
    public void windowClosing(WindowEvent we)
    System.exit(0);
    //setkan button
    final JPanel OK = new JPanel();
    JButton buttonOK = new JButton("OK");
    OK.add(buttonOK);
    final JPanel txt = new JPanel();
    JTextField inputText = new JTextField(15);
    inputText.setFont(new Font("Serif", Font.PLAIN, 12));
    txt.add(inputText);
    Container content = f.getContentPane( );
    content.setLayout(new GridLayout(1,1));
    content.add(txt);
    content.add(OK);
    buttonOK.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent ae)
    String ayat = txt.getText().getActionCommand();
    System.out.println(ayat);
    f.setVisible(true);
    }

    please check my java coding. when I compile it, the error: 'cannot find symbol
    getText() ' is appear. What wrong with this coding.
    final JPanel txt = new JPanel();...
    buttonOK.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent ae)
    String ayat = txt.getText().getActionCommand();
    System.out.println(ayat);
    });Final variable 'txt' is a JPanel. JPanels don't have a 'getText()' method; hence
    the compiler diagnostics message.
    kind regards,
    Jos
    ps. better stick your code between [code] ... [/code] tags for readability reasons.

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

  • Error: cannot find symbol method Text

    Hi
    I want to make an index for txt files by using Lucene, it got an error: cannot find symbol method Text. what is it about? Does it mean the Text is not in Field?
    thank you v much
    pls look into my code:
    package TestLucene;
    import java.io.File;
    import java.io.FileReader;
    import java.io.Reader;
    import java.util.Date;
    import org.apache.lucene.analysis.Analyzer;
    import org.apache.lucene.analysis.standard.StandardAnalyzer;
    import org.apache.lucene.document.Document;
    import org.apache.lucene.document.Field;
    import org.apache.lucene.index.IndexWriter;
    import org.apache.lucene.document.Fieldable;
    import java.io.Serializable;
    * This class demonstrate the process of creating index with Lucene
    * for text files
    public class Lucene {
         public static void main(String[] args) throws Exception{
              //indexDir is the directory that hosts Lucene's index files
            File   indexDir = new File("D:\\luceneIndex");
            //dataDir is the directory that hosts the text files that to be indexed
            File   dataDir  = new File("D:\\luceneData");
            Analyzer luceneAnalyzer = new StandardAnalyzer();
            File[] dataFiles  = dataDir.listFiles();
            IndexWriter indexWriter = new IndexWriter(indexDir,luceneAnalyzer,true);
            long startTime = new Date().getTime();
            for(int i = 0; i < dataFiles.length; i++){
                 if(dataFiles.isFile() && dataFiles[i].getName().endsWith(".txt")){
              System.out.println("Indexing file " + dataFiles[i].getCanonicalPath());
              Document document = new Document();
              Reader txtReader = new FileReader(dataFiles[i]);
              document.add(Field.Text("path",dataFiles[i].getCanonicalPath()));
              document.add(Field.Text("contents",txtReader));
              indexWriter.addDocument(document);
    indexWriter.optimize();
    indexWriter.close();
    long endTime = new Date().getTime();
    System.out.println("It takes " + (endTime - startTime)
    + " milliseconds to create index for the files in directory "
              + dataDir.getPath());

    Hal-.- wrote:
    I downloaded Lucene from its homepage, I have tried Lucene 2.3.0 and Lucene 2.2.0, but same errors occurs which is cannot find symbol method Text.
    I checked class Field under Lucene, it doesn't have Text function. Well there you go. You can't call methods that don't exist.
    What should I do to add two Fields "path" & "contents" into Document?It seems very likely that the object that represents an indexed document, has some way to express the concepts of "path" and "contents". You should probably just read the docs some more.
    But other than that I have no idea. Ask on a Lucene forum.

  • Error:Cannot find symbol Symbol Constructor

    Anyone who can help..
    I need to write a program that has two camera's and define a camera class so it prints out the total of the camera's at the end. I keep getting different errors it seems like I fix one and another one pops up, but this one has me confused. It is the following program:
    public class Program2
              public static void main (String [] args)
                   Camera home = new Camera(10);
                   Camera work = new Camera(30);
                   home.takePic();
                   home.takePic();
                   home.takePic();
                   home.erasePic();
                   home.printNum();
                   home.takePic();
                   home.takePic();
                   home.eraseAll();
                   home.printNum();
                   work.takePic();
                   work.takePic();
                   work.printNum();
         class Camera
         public Camera ();
              private int pictures;
                   pictures = 0;
              public void takePic()
                   pictures++;
              public void erasePic()
                   pictures--;
              public void eraseAll()
                   pictures = 0;
              public void printNum()
                   System.out.println("This camera has " + pictures +
                        " on it.");
    and I get this error:
    Program2.java:5: cannot find symbol
    symbol : constructor Camera(int)
    location: class Camera
                   Camera home = new Camera(10);
                   ^
    Program2.java:6: cannot find symbol
    symbol : constructor Camera(int)
    location: class Camera
                   Camera work = new Camera(30);
                   ^
    Anyone know what is going on? I am so confused any help would be absolutely wonderful!
    Thanks,
    K

    Program2.java:5: cannot find symbol
    symbol : constructor Camera(int)
    location: class Camera
    Camera home = new Camera(10);
    It says, when it tries to execute the statement
    Camera home = new Camera(10);
    It could not find the Camera(int) constructor, since you have provided such constructor in your program.
    Just add the following constructor in your program, and it should work.
    public Camera (int pictures);
    this.pictures = pictures;
    Nice to meet you.

  • Cannot find symbol:constructor

    here is my code...
    package org.tiling.didyoumean;
    import java.io.IOException;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.BufferedReader;
    import org.apache.lucene.index.Term;
    import org.apache.lucene.queryParser.ParseException;
    import org.apache.lucene.search.Query;
    import org.apache.lucene.search.TermQuery;
    import org.apache.lucene.search.spell.SpellChecker;
    import org.apache.lucene.store.Directory;
    import org.apache.lucene.store.FSDirectory;
    import org.apache.commons.cli.ParseException;
    public class spell {
         public static void main(String args[]){
              System.out.println("hi");
         String spellIndex = "C://opt//lucene//didyoumean//indexes//spell";
         SpellChecker spellChecker = new SpellChecker(spellIndex);
         String[] similarWords = spellChecker.suggestSimilar("jva", 1);
         System.out.println(similarWords[0]);
    }and the error i am kept getting is
    C:\Documents and Settings\sumit-i\Desktop\didyoumean\didyoumean-1.0\src\java>javac org/tiling/didyoumean/spell.java
    org\tiling\didyoumean\spell.java:29: cannot find symbol
    symbol  : constructor SpellChecker(java.lang.String)
    location: class org.apache.lucene.search.spell.SpellChecker
            SpellChecker spellChecker = new SpellChecker(spellIndex);
                                        ^
    1 errorany ideas..plzz

    here is the Directory.java,....please help me if you can....actually i have a deadline to submit this..but i am not getting this...
    package org.apache.lucene.store;
    * Licensed to the Apache Software Foundation (ASF) under one or more
    * contributor license agreements.  See the NOTICE file distributed with
    * this work for additional information regarding copyright ownership.
    * The ASF licenses this file to You under the Apache License, Version 2.0
    * (the "License"); you may not use this file except in compliance with
    * the License.  You may obtain a copy of the License at
    *     http://www.apache.org/licenses/LICENSE-2.0
    * Unless required by applicable law or agreed to in writing, software
    * distributed under the License is distributed on an "AS IS" BASIS,
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    * See the License for the specific language governing permissions and
    * limitations under the License.
    import java.io.IOException;
    /** A Directory is a flat list of files.  Files may be written once, when they
    * are created.  Once a file is created it may only be opened for read, or
    * deleted.  Random access is permitted both when reading and writing.
    * <p> Java's i/o APIs not used directly, but rather all i/o is
    * through this API.  This permits things such as: <ul>
    * <li> implementation of RAM-based indices;
    * <li> implementation indices stored in a database, via JDBC;
    * <li> implementation of an index as a single file;
    * </ul>
    * Directory locking is implemented by an instance of {@link
    * LockFactory}, and can be changed for each Directory
    * instance using {@link #setLockFactory}.
    * @author Doug Cutting
    public abstract class Directory {
      /** Holds the LockFactory instance (implements locking for
       * this Directory instance). */
      protected LockFactory lockFactory;
      /** Returns an array of strings, one for each file in the
       * directory.  This method may return null (for example for
       * {@link FSDirectory} if the underlying directory doesn't
       * exist in the filesystem or there are permissions
       * problems).*/
      public abstract String[] list()
           throws IOException;
      /** Returns true iff a file with the given name exists. */
      public abstract boolean fileExists(String name)
           throws IOException;
      /** Returns the time the named file was last modified. */
      public abstract long fileModified(String name)
           throws IOException;
      /** Set the modified time of an existing file to now. */
      public abstract void touchFile(String name)
           throws IOException;
      /** Removes an existing file in the directory. */
      public abstract void deleteFile(String name)
           throws IOException;
      /** Renames an existing file in the directory.
       * If a file already exists with the new name, then it is replaced.
       * This replacement is not guaranteed to be atomic.
       * @deprecated
      public abstract void renameFile(String from, String to)
           throws IOException;
      /** Returns the length of a file in the directory. */
      public abstract long fileLength(String name)
           throws IOException;
      /** Creates a new, empty file in the directory with the given name.
          Returns a stream writing this file. */
      public abstract IndexOutput createOutput(String name) throws IOException;
      /** Returns a stream reading an existing file. */
      public abstract IndexInput openInput(String name)
        throws IOException;
      /** Returns a stream reading an existing file, with the
       * specified read buffer size.  The particular Directory
       * implementation may ignore the buffer size.  Currently
       * the only Directory implementations that respect this
       * parameter are {@link FSDirectory} and {@link
       * org.apache.lucene.index.CompoundFileReader}.
      public IndexInput openInput(String name, int bufferSize) throws IOException {
        return openInput(name);
      /** Construct a {@link Lock}.
       * @param name the name of the lock file
      public Lock makeLock(String name) {
          return lockFactory.makeLock(name);
       * Attempt to clear (forcefully unlock and remove) the
       * specified lock.  Only call this at a time when you are
       * certain this lock is no longer in use.
       * @param name name of the lock to be cleared.
      public void clearLock(String name) throws IOException {
        if (lockFactory != null) {
          lockFactory.clearLock(name);
      /** Closes the store. */
      public abstract void close()
           throws IOException;
       * Set the LockFactory that this Directory instance should
       * use for its locking implementation.  Each * instance of
       * LockFactory should only be used for one directory (ie,
       * do not share a single instance across multiple
       * Directories).
       * @param lockFactory instance of {@link LockFactory}.
      public void setLockFactory(LockFactory lockFactory) {
          this.lockFactory = lockFactory;
          lockFactory.setLockPrefix(this.getLockID());
       * Get the LockFactory that this Directory instance is
       * using for its locking implementation.  Note that this
       * may be null for Directory implementations that provide
       * their own locking implementation.
      public LockFactory getLockFactory() {
          return this.lockFactory;
       * Return a string identifier that uniquely differentiates
       * this Directory instance from other Directory instances.
       * This ID should be the same if two Directory instances
       * (even in different JVMs and/or on different machines)
       * are considered "the same index".  This is how locking
       * "scopes" to the right index.
      public String getLockID() {
          return this.toString();
       * Copy contents of a directory src to a directory dest.
       * If a file in src already exists in dest then the
       * one in dest will be blindly overwritten.
       * @param src source directory
       * @param dest destination directory
       * @param closeDirSrc if <code>true</code>, call {@link #close()} method on source directory
       * @throws IOException
      public static void copy(Directory src, Directory dest, boolean closeDirSrc) throws IOException {
          final String[] files = src.list();
          if (files == null)
            throw new IOException("cannot read directory " + src + ": list() returned null");
          byte[] buf = new byte[BufferedIndexOutput.BUFFER_SIZE];
          for (int i = 0; i < files.length; i++) {
            IndexOutput os = null;
            IndexInput is = null;
            try {
              // create file in dest directory
              os = dest.createOutput(files);
    // read current file
    is = src.openInput(files[i]);
    // and copy to dest directory
    long len = is.length();
    long readCount = 0;
    while (readCount < len) {
    int toRead = readCount + BufferedIndexOutput.BUFFER_SIZE > len ? (int)(len - readCount) : BufferedIndexOutput.BUFFER_SIZE;
    is.readBytes(buf, 0, toRead);
    os.writeBytes(buf, toRead);
    readCount += toRead;
    } finally {
    // graceful cleanup
    try {
    if (os != null)
    os.close();
    } finally {
    if (is != null)
    is.close();
    if(closeDirSrc)
    src.close();
    please let me know....if you any idea about it..
    thanks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Client error, cannot find symbol

    Hello, I just finished my project and my client keeps giving me this error, I do not know what is going on. It doesn't look like I did anything really wrong. Any help is appreciated!
    HomeClient.java:14: cannot find symbol
    symbol  : constructor Home(int,int,int)
    location: class Home
         Home home1 = new Home( 1, 123, 1);
    Class
    import java.io.Serializable;
    public class Home implements Serializable
         private int rooms;
         private int squareFootage;
         private boolean basement;
         public Home ( int startRooms,
              int startSquareFootage,
              boolean startBasement )
              rooms = startRooms;
              squareFootage = startSquareFootage;
              basement = startBasement;
         public String toString()
              return "Rooms: " + rooms
              + " Square Footage: " +squareFootage
              + " Basement: " +basement;
    Client Program
    import java.io.FileOutputStream;
    import java.io.ObjectOutputStream;
    import java.io.FileInputStream;
    import java.io.ObjectInputStream;
    import java.io.FileNotFoundException;
    import java.io.EOFException;
    import java.io.IOException;
    public class HomeClient
         public static void main( String [] args )
         Home home1 = new Home( 1, 123, 1);
         try
              FileOutputStream fos = new FileOutputStream
                             ( "objects", false);
              ObjectOutputStream oos = new ObjectOutputStream( fos );
              oos.writeObject( home1 );
              oos.close();
         catch ( FileNotFoundException fnfe ) {
              System.out.println( "Unable to write to objects" );
         catch ( IOException ioe ) {
              ioe.printStackTrace();
    }

    ok, not really getting this, same problem. Any advice of what is wrong as far as the methods. I'm really trying to get this!
    import java.io.Serializable;
    public class Home implements Serializable
         private int rooms;
         private int squareFootage;
         private boolean basement;
         public Home ( int startRooms,
                               int startSquareFootage,
                               boolean startBasement )
              rooms = startRooms;
              squareFootage = startSquareFootage;
              basement = startBasement;
         public String toString()
              return "Rooms: " + rooms
                         + " Square Footage: " +squareFootage
                         + " Basement: " +basement;
         public int getRooms()
              return rooms;
         public int getSquareFootage()
              return squareFootage;
         public boolean getBasement()
              return basement;
         public void setRooms( int newRooms )
              rooms = newRooms;
         public void setSquareFootage( int newSquareFootage )
              squareFootage = newSquareFootage;
         public void setBasement( boolean newBasement )
              basement = newBasement;
    }

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

  • Compiling error - cannot resolve symbol

    Hi,
    I am working on writing out this basic code for a project. When I compile, I get an error "Cannot resolve symbol" for the gpa variable. Please help!
    My intention is to use the hours and points from the crHours and nbrPoints methods, and use them to calculate GPA in the grPtAvg method:
    public class Student
         public static void main(String[]args)
    idNum();
    crHours();
    nbrpoints();
    gpa = grPtAvg(hours, points);
    System.out.println("Student's GPA is " + gpa);
    public static void idNum()
    int id = 2520;
    System.out.println("Student's ID is " + id);
    public static float crHours()
    float hours = 5;
    System.out.println("Student's credit hours are " + hours);
    return hours;
    public static float nbrpoints()
    float points = 22;
    System.out.println("Student's earned points are " + points);
    return points;
    public static float grPtAvg(float hours, float points)
    float gpa;
    gpa = points / hours;
    System.out.println("Student's computed GPA is " + gpa);
    return gpa;

    That's because you're doing the same thing (in a somewhat different way) with those.
    The variables: hours and points have already been returned to main methd, right?Yes, but then the main method ignores them.
    So, they should be available at this point in the code, is that right?Available in the sense that you can read them, but not in the sense that there are hours and points variables within scope in the main method.
    You want to do this:
    public static void main(String[] args) {
       idNum();
       float hours = crHours();
       float points = nbrpoints();
       //create a new float
       float myComputetdGpa = grPtAvg(hours, points);
       System.out.println("Student's GPA is " + myComputedGpa);
    }

  • Error: Cannot find symbol: Variable Name

    Hi Guys,
    I'm having some trouble with a piece of code. The error that I'm getting is:
    program.java:17: cannot find symbol
    symbol : variable name
    location: class program
    name.CTI(names[0].charAt(0));
    ^
    My Code is shown here:
    import java.io.*;
    import java.lang.*;
    class program{
         public static void main(String[] args){
              String names [] = {"brian", "stu", "mouse"};
              program name = new program ();
              name.sortArrayStr(names);
              //name.CTI(names[0].charAt(0));
         public void sortArrayStr( String[] names ){
              name.CTI(names[0].charAt(0));
         public int CTI ( char letter ){
              char c = letter;
            int k = (int) c;
            System.out.println("ASCII  = "  + k + ".");
              return k;
    }What I'm trying to do is get the name.CTI method caled from within sortArrayStr. When i call name.CTI from main it works fine, (commented part) but when i try from sortArrayStr I get this problem.
    Anyone have any ideas?
    Many Thanks

    Variable name is a local variable defined in method main, so it can not be referenced by writing name in another method like sortArrayStr.
    The good news is, if you want to call CTI from sortArrayStr, just do it:
    public void sortArrayStr( String[] names ){
        CTI(names[0].charAt(0));
    }

  • Compiler error cannot resolve symbol

    Hi people,
    i'm having this compile time error that, when i create a class and calling that class in another class gives the error cannot resolve symbol classname and it also happened when i created a bean and referencing the bean class in another bean when i'm using Jsp. thanks in advance.

    It would be helpful if you post the exact error message. If you use a system Classpath, then it must contain the root directory for the package directory(s).
    For example, if the source code for a file starts with
    package my.package;
    and you have a directory structure c:\myjava\classes\my\package then the Classpath must contain c:\myjava\classes.

  • Error: cannot find symbol

    Hi all,
    I have this piece of code inside try/catch block:
    for (int i=0; i<nodeList.getLength(); i++)
                     Node node = nodeList.item(i);
                        NamedNodeMap attributes = node.getAttributes();
                     Node namedItem = attributes.getNamedItem("event_ID");
                     if (node.getNodeName().equals("events") && namedItem != null)
                        nameValueMap.put("event_ID", namedItem.getNodeValue());                 
                     if (!node.getNodeName().equals("events") && !node.getNodeName().equals("event"))
                        nameValueMap.put(node.getNodeName(), node.getTextContent());
                    } I receive the following error:
    home/LogParserDOM.java:281: cannot find symbol
    symbol  : method getTextContent()
    location: interface org.w3c.dom.Node
                        nameValueMap.put(node.getNodeName(), node.getTextContent()); Does anybody have any idea why am I receiving this error? Why all other methods that I'm using from interface org.w3c.dom.Node like: getAttributes(), getNodeValue(), getNodeName(), ... can be found and the error happens at: getTextContent()?
    Any help is greatly appreciated.

    Check the API.
    org.w3c.dom Interface Node:
    String getTextContent() throws DOMExceptionThis method is not in JDK 1.4.2 API docs, it looks like it was added 1.5. May be you are using 1.4.2?

Maybe you are looking for