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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

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

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

  • Re: cannot find symbol constructor Arc2D

    hi
    The subject might suggest this is should be posted in java2d forum but I believe this is related to basic programmming knowledge. So please take a look at it.
    I am trying to create a subclass to the Arc2D abstract class. Although it works fine when I change the superclass to Arc2D.Double. Could some body point the mistakes.
    I greatly appreciate any help.
    here is the error.
    symbol  : constructor Arc2D()
    location: class java.awt.geom.Arc2D
        public Arc(Graphics2D g2, int x0, int y0, int mdptx, int mdpty, int x1, int y1,int clickCount){
    1 error
    BUILD FAILED (total time: 0 seconds)here is the code in the class.
    package Drawing2d;
    import java.awt.BasicStroke;
    import java.awt.Color;
    import java.awt.Graphics2D;
    import java.awt.Shape;
    import java.awt.geom.Arc2D;
    import java.awt.geom.Point2D;
    import java.awt.geom.Rectangle2D;
    public class Arc extends Arc2D implements Shape{
        Circle aeli;
        SketchEnvironment SE;   
        int[] coord = new int[4];
        double width;
        double startAngle,endAngle, extent;
        float[] dashPattern = { 5, 2, 2, 2 };
        double x0,y0;
        Arc2D.Double ar;
        Point2D.Double pts[] = new Point2D.Double[3];
        public Arc(Graphics2D g2, int x0, int y0, int mdptx, int mdpty, int x1, int y1,int clickCount){
            ar = new Arc2D.Double();
            if(clickCount == 1){
            g2.setStroke(new BasicStroke(1, BasicStroke.CAP_BUTT,BasicStroke.JOIN_MITER, 10,
                                      dashPattern, 0));      
            //aeli.mainColor = Color.GREEN;                   
            width =  java.lang.Math.sqrt(java.lang.Math.pow((x1- x0),2)
                    + java.lang.Math.pow((y1 - y0) ,2));
            g2.setColor(Color.GREEN);
            g2.drawOval((int)(x0 - width), (int)(y0 - width),(int) (2*width), (int)(2*width));       
            else if(clickCount == 2 || clickCount == 3){           
                startAngle = Math.toDegrees(Math.atan2((mdpty - y0),(mdptx - x0)));
                endAngle = Math.toDegrees(Math.atan2((y1 - y0),(x1 - x0)));
                double extent = getExtent(startAngle, endAngle);  
                width = java.lang.Math.sqrt(java.lang.Math.pow((mdptx- x0),2)
                    + java.lang.Math.pow((mdpty - y0) ,2));
                g2.setColor(Color.WHITE);
                ar.setArc(x0-width,y0-width,2*width,2*width,-startAngle,
                        extent,java.awt.geom.Arc2D.OPEN);
    //            ar = new Arc2D.Double(x0-width,y0-width,2*width,2*width,-startAngle,
    //                    extent,java.awt.geom.Arc2D.OPEN);
                g2.draw(ar);
         * One area of difficulty is that java measures angles
         * positive clockwise from zero at 3 o'clock and arcs
         * measure angles positive anti-clockwise from the
         * beginning of the arc segment.
         * Contributed by CRWood from sun's java2d forum**/
        private double getExtent(double start, double end) {
            double extenti = (360-end) - (360-start);
            if(extenti < 0)
                extenti += 360;
            return extenti;
        public double getAngleStart() {
            return startAngle;
        public double getAngleExtent() {
            return endAngle;
        public void setArc(double x, double y, double w, double h, double angSt, double angExt, int closure) {
            this.setArc(x, y, w, h, angSt, angExt, closure);
        public void setAngleStart(double angSt) {
            startAngle = angSt;
        public void setAngleExtent(double angExt) {
            this.extent = angExt;
        @Override
        public double getX() {
            return x0 - width;
        public double getY() {
            return y0 - width;
        public double getWidth() {
            return width;
        public double getHeight() {
            return width;
        public boolean isEmpty() {
            return this.isEmpty();
        protected Rectangle2D makeBounds(double x, double y, double w, double h) {
            this.makeBounds(x, y, w, h);
    }

    Are you sure you need to subclass Arc2D? There are already concrete subclasses Arc2D.Float and Arc2D.Double? How about using composition rather than subclassing? I ask because I've never seen anyone need to subclass these geometry classes before.

  • Cannot find symbol symbol  : constructor

    I'm a java student, I've recently started constructors and inheritence, I've been pouring over my text book
    all day and I've can't work out what I have done wrong in my code.
    class TestComputer
    {  public static void main (String [ ] args)
         Computer IBM = new Computer ("IBM",286);
          System.out.println(IBM);
    public class Computer extends TestComputer{
              protected String processorModel;
                    protected int clockSpeed;
        public Computer() {
             this.processorModel = processorModel;
             this.clockSpeed = clockSpeed;
        public String toString ()
              String result = "Processor Model: " + processorModel + "\n";
                      result += "Clock Speed: " + clockSpeed + "\n";
              return result;
    }The error I am getting is cannot find symbol constructor Computer(java.lang.String,int)
    and I can't for the life of me work out why.
    Edited by: FallingLeaves on Sep 9, 2008 11:07 PM

    Computer IBM = new Computer ("IBM",286);The error message tells you everything you need to know. The above line is calling a constructor with 2 parameters: String and int. Where in your class is the constructor that takes those 2 parameters?

  • Constructor - cannot find symbol

    Hi all,
    Can anyone please help me with this code? I don't know what's wrong with it.
    class Superclass {
        public int j = 0;   
        public Superclass(String text){  //constructor
            j = 1;
    class Subclass extends Superclass {
        public Subclass(String text){  //constructor - error here: cannot find symbol       
            j = 2;       
        public static void main(String[] args){
            Subclass sub = new Subclass("");
            System.out.println(sub.j);
    }What's wrong with the subclass c'tor? What symbol is it missing?
    Thank you for your replies.

    I'm wondering, why do we need the c'tor from the superclass? Is it because it is not inherited? That's why we need to manually write it? NO. It is because you have not written a no argument constructor in your superclass and compiler is calling it when you actually creating a instance of subclass.
    If there are many other superclass c'tors with different types of arguments, do we have to explicitly write each one of them in the subclass c'tor? Is that correct?NO. You just need to call only one with the parameters that you actually need to pass to superclass.
    If you dont put the super(text); in subclass constructor then too it looks for the superclass constructor while creating a instance of subclass. But since if you are not calling a constructor with arguments[which in now done by super(text)] it will look for a default constructor in your superclass which is no argument constructor. & you dont have any no argument constructor in your Superclass.
    Try you code like this. It will work but in this case you are not passing text to your super class. If you want to pass text then you have to use super(text) in your subclass.
    class Superclass {
        public int j = 0; 
        public Superclass()
        public Superclass(String text){      
            j = 1;
        public Superclass(int count){
            count = 10;
    class Subclass extends Superclass {    
        public Subclass(String text){  
            //super(text);  // have to write this line
            j = 2;       
        public Subclass(int count){
            super(count); // have to write this line also
            count = 15;
        public static void main(String arg[]){
             Subclass  s = new Subclass("e");
    }I hope it helps.

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

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

  • Cannot find symbol while referring to an overloaded constructor

    Hi, I've a VERY strange problem. It's an hour I'm trying to work this out without any luck....
    here is my code
         public DueDPanel(int limite, int valore, int incremento) throws NumberOutOfBoundException
              this.limite=limite;
              setValore(valore);
              upBy=incremento;
         public DueDPanel(int limite, int valore) throws NumberOutOfBoundException
              { DueDPanel(limite,valore,1); }
         public DueDPanel(int limite) throws NumberOutOfBoundException
              { DueDPanel(limite,0,1); }
         public DueDPanel() throws NumberOutOfBoundException
              { DueDPanel(99,0,1); }I get a c-time error
    .\DueDPanel.java:25: cannot find symbol
    symbol : method DueDPanel(int,int,int)
    location: class DueDPanel
    { DueDPanel(limite,valore
    ^
    .\DueDPanel.java:28: cannot find symbol
    symbol : method DueDPanel(int,int,int)
    location: class DueDPanel
    { DueDPanel(limite,0,1);
    ^
    .\DueDPanel.java:31: cannot find symbol
    symbol : method DueDPanel(int,int,int)
    location: class DueDPanel
    { DueDPanel(99,0,1); }
    How could it be? why in the world it cannot find my int,int,int method?
    I'm damn sure this is an easy problem, but..... thankyou sooooo much!!

    Ok, a superior-class developer friend of mine found a solution.
    I simply replaced the method indetifier with this(....).
    public DueDPanel() throws NumberOutOfBoundException
              { this(99,0,1); }Could someone please explain why this didn't work as I expeced?

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

  • Error in importing user-created jar file & cannot find symbol

    Hello.
    I try to import the jar file made from common classes in the previous project. by using NB 5.5.1.
    The jar file is named as 'tpslib.jar'
    The previoud package name is 'tps'.
    I added tpslib.jar in the library, and removed the class files from the orginal project, because the class files exist in the tpslib.jar.
    THe jar file has 8 class files inclduing the following class, ReservationData.
    My question is why the follwoing fuction call try to the method in the previous package, tps instead of those of tpslib.jar.
    If you have anyone to answer me, it will be very appreciated.
    Tae
    package tps;
    import java.sql.*;
    import java.util.*;
    import java.io.*;
    import tpslib.*;
    public class tpsPWSImpl implements tpsPWSSEI {
    public ReservationData reserve(ReservationData request) throws java.rmi.RemoteException {
    request.print();
    requestLocal.print();
    if (!request.equalsCoreOf(requestLocal)){
    cFlag = true;
    System.out.println("reserve: WARNING ");
    ===================
    9 Error Messages
    ====================
    cannot find symbol
    symbol : method print()
    location: class tps.ReservationData
    request.print();
    cannot find symbol
    symbol : constructor ReservationData(tps.ReservationData)
    location: class tps.ReservationData
    wr = new ReservationData(rr);
    ===========

    Does your jar include:
    /a/Main.classWith class Main defined in package, er, "a"?

  • Cannot find symbol class

    I am having a "Cannot find symbol" problem. My Java is a bit rusty so I'm not exactly sure what it could be. I have two classes, City and SisterCities. The SisterCities references the City class. The City class compiles fine. Both classes are part of the same package. However, when I compile SisterCities, I get the error. Could you please tell me how to get the second class to recognize the first (import, extends, not really sure. I've tried alot) Here are those two classes so far...
    ****** City ********
    package hw01;
    public class City
         public final String name;
         public final String country;
         public final City [] sisters;
    public City (String name, String country)
              // throw new RuntimeException ("Not implemented yet.");
              this.name = name;
              this.country = country;
              this.sisters = new City [0];
    public City (String name, String country, City [] sisters)
              // throw new RuntimeException ("Not implemented yet.");
              this.name = name;
              this.country = country;
              this.sisters = new City [sisters.length];
              for (int i = 0; i < sisters.length; i++) {
                   this.sisters[i] = sisters;
    public void setSisters (City [] sisters)
              // throw new RuntimeException ("Not implemented yet.");
              for (int i = 0; i < sisters.length; i++) {
                   this.sisters[i] = sisters[i];
    public String getName ()
              // throw new RuntimeException ("Not implemented yet.");
              return this.name;
    public String getCountry ()
              // throw new RuntimeException ("Not implemented yet.");
              return this.country;
    public City [] getSisters ()
              // throw new RuntimeException ("Not implemented yet.");
              return this.sisters;
    ******** SisterCities *********
    package hw01;
    import java.util.LinkedList;
    public class SisterCities
         public final LinkedList cityList;
    public SisterCities ()
              // throw new RuntimeException ("Not implemented yet.");
    public void addCity (City city)
              // throw new RuntimeException ("Not implemented yet.");
              this.cityList.add(city);
    public int getNumCities ()
              // throw new RuntimeException ("Not implemented yet.");
    public City getCity (int i)
              // throw new RuntimeException ("Not implemented yet.");

    final attribute members like "cityList" must be initialised when they're declared or inside the constructors
    if you want to compile, you'll also have to uncomment the "throws" in your methods (or return a value)
    (pay attention to the error messages the compiler gives you and paste them all when posting questions)

  • 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 - password checker class

    I had to make a program to check a password to make sure it had two letters, at least eight characters, and only numbers and letters. I'm pretty sure I have all of the checking correct but I can't make use of the method I made to do it. here is my code:
              if(password.LegalPassword())     
                   System.out.println("You enterend a valid password!");
              else
                   System.out.println("You have entered an invalid password!");
    class LegitPassword
                   //constructor
         public LegitPassword(String userPassword)
         public boolean LegalPassword (String userPassword)
                   int digitCounter = 0;
                   for(int i = 0; i < userPassword.length(); i++)
                             //is character a letter or number?
                        if(!(Character.isDigit(userPassword.charAt(i))) || !(Character.isLetter(userPassword.charAt(i))))
                             return false;
                             //is the password at least 8 characters?
                        if(userPassword.length() <= 8)
                             return false;
                             //count the digits
                        if(Character.isDigit(userPassword.charAt(i)))
                             digitCounter ++;
                   if(digitCounter <= 2)
                             return false;
         return true;
              }oh, and the exact error is:
    PasswordChecker.java:27: cannot find symbol
    symbol  : method LegalPassword()
    location: class java.lang.String
              if(password.LegalPassword())     
                         ^

    Here is the full code so that you can see how I declared password...
         public class PasswordChecker
              static Scanner console = new Scanner(System.in);
              public static void main(String[] args)
              String password;
              System.out.println("Please enter a new password.");
              System.out.println("Remember: Passwords must be at least eight characters"
                   + " consisting of only numbers and letters with at minimal two numbers.");
              System.out.print("Password: ");
                   password = console.nextLine();
              //LegitPassword thePassword = new LegitPassword(password);
              if(password.LegalPassword())     
                   System.out.println("You enterend a valid password!");
              else
                   System.out.println("You have entered an invalid password!");
    class LegitPassword
         public boolean LegalPassword (String userPassword)
                   int digitCounter = 0;
                   for(int i = 0; i < userPassword.length(); i++)
                             //is character a letter or number?
                        if(!(Character.isDigit(userPassword.charAt(i))) || !(Character.isLetter(userPassword.charAt(i))))
                             return false;
                             //is the password at least 8 characters?
                        if(userPassword.length() <= 8)
                             return false;
                             //count the digits
                        if(Character.isDigit(userPassword.charAt(i)))
                             digitCounter ++;
                   if(digitCounter <= 2)
                             return false;
         return true;
    }The error:
    PasswordChecker.java:27: cannot find symbol
    symbol  : method LegalPassword()
    location: class java.lang.String
              if(password.LegalPassword())Are you suggesting I change the method, LegalPassword, to accept no parameters?

Maybe you are looking for

  • Extending AbstractPageBean

    The GUI freaks out when I create an abstract class BasePage extending AbstractPageBean and utilize this page as an ancestor for all of my pages. The GUI complains as follows: main.java:1: Java class must be a direct subclass of one of the following c

  • How to Subscribe to Outlook Calendar in Group WIKI Calendar

    Ok, here's what I've been trying to figure out how to do for about a year.  Our small office uses PC's with Outlook as our Calendar.  We are not on Exchange Server.  We are using Mac Mini Snow Leopard Server ver. 10.6.8. I'm trying to figure out a wa

  • Regarding Business System and Business Service

    Hello, What is the difference between the Business system and Business service. When do we go for what? Which system we will take as business system or business service means either sender system or reciever system. Give me with simple example... ple

  • CS4 - How do I export a video with Alpha from PPro CS4?

    I've done this a million times in CS3 and before and After Effects (all versions through CS4) but I cannot quite get it in CS4 with the new encoder.  I am using XP32. Will someone give me step by step instructions for setting up a 1280x720p .avi file

  • Is this available in "family packs" like earlier OS X versions?

    Or do we have to buy a different copy for each laptop, now?