Error code on cannot find symbol

Hi,
I compiler a file with error: cannot find symbol. but I can't found the problem.
Can anyone help.
public class WriteExcel
  private WritableCellFormat timesBoldUnderline;
  private WritableCellFormat times;
  final DecimalFormat df = new DecimalFormat("#,##0.00");
  private void createLabel(WritableSheet paramWritableSheet)
    throws WriteException
  String[] arrayOfString = { "Roy Year", "Roy Dist No", "Dist Type", "Ip Base No", "Ip Name No"};
    int[] arrayOfInt = { 10, 12, 10, 12, 15};
    WritableFont localWritableFont1 = new WritableFont(WritableFont.TIMES, 10);
    this.times = new WritableCellFormat(localWritableFont1);
    this.times.setWrap(true);
    WritableFont localWritableFont2 = new WritableFont(WritableFont.TIMES, 10, WritableFont.BOLD, false, UnderlineStyle.SINGLE);
    this.timesBoldUnderline = new WritableCellFormat(localWritableFont2);
    this.timesBoldUnderline.setWrap(true);
    CellView localCellView = new CellView();
    localCellView.setFormat(this.times);
    localCellView.setFormat(this.timesBoldUnderline);
    for (int i = 0; i < arrayOfString.length; i++)
      paramWritableSheet.setColumnView(i, arrayOfInt[i]);
      addCaption(paramWritableSheet, i, 0, arrayOfString[i]);
error code : "cannot find symbol"

Hi
Also I note that you have no import statetments, can you send me the whole file. How is the file executed in a web server or as part of a standard JVM ? Together with any other classes outside of the JDK that are required for compilation.

Similar Messages

  • Error code: 2147778144 Cannot find the QE property.

    I have been working to get Coldfusion 8 and Crystal Enterprise 10 to work together.  The following were two approaches I knew of to try:
    1) using Crystal "unmanaged URL reporting":
    a href="AOC_Summary.rpt?prompt0=#variables.Record_Month#&prompt1=#variables.Fiscal_Year#&user0=userid&password0=pswdn">AOC SUMMARY</a>
    2) using  the Coldfusion <cfreport> tag:
    <cfreport report = "AOC_Summary.rpt"  
    dataSource = "#variables.dsn#"  
    username = "userid" 
    password = "pswd">
    {AB145_AMTS.REC_MONTH} = 5 and
    {AB145_AMTS.FISCAL_YEAR} = 8
    </cfreport>
    I got the CFREPORT tag to work but was disappointed to find that it only rendered the report in HTML.  The reports we have been producing with our current configuration of CF4.5 & CR 8.5 can be saved as PDF's.  So I abandoned the Coldfusion <cfreport> tag to see if I could get the Crystal "unmanaged URL reporting" to work.  This included me trying to find any documentation anywhere to guide me along with going into Crystal Admin and 'experimenting' to see if there was anything I needed to do there to make the unmanaged URL reporting work.
    Management is now telling me that producing the report in HTML is acceptable.  I am now trying to set up a demo for management.  When I went back into my CF code and uncommented the work I had done with the CFREPORT tag (which had been working at the time I commented it out), I receive the following error code.
    CrystalReport Integration Exception.
    Error code: 2147778144 Cannot find the QE property.
    Error source: Crystal Reports ActiveX Designer 
    I have tried searching the SAP site to find more information on this error message to no avail.   Any guidance would be greatly appreciated.
    Regards,
    :)mary
    Edited by: Mary Fowler on Aug 21, 2008 7:21 PM

    I found my mistake.  Used wrong .rpt file.  (head drooped, tail between the legs)
    Thank you for being here!
    :)mary

  • I am trying to update PR and PS and get error code A12E3. cannot find solution.

    I am trying to update PR and PS and get error code A12E3. cannot find solution.

    " The feature you are trying to use is on a network resource that is unavailable. I tried to uninstall iTunes, and it would not uninstall. It gave me the following message " The path C:\documents and settings\network service\local settings\application data\apple\apple software update\iTunes.msi cannot be found.
    Download the Windows Installer CleanUp utility from the following page (use one of the links under the "DOWNLOAD LOCATIONS" thingy on the Major Geeks page):
    http://majorgeeks.com/download.php?det=4459
    To install the utility, doubleclick the msicuu2.exe file you downloaded.
    Now run the utility ("Start > All Programs > Windows Install Clean Up"). In the list of programs that appears in CleanUp, select any iTunes entries and click "Remove", as per the following screenshot:
    Quit out of CleanUp, restart the PC and try another iTunes install. Does it go through properly this time?

  • Error code 3150 - Cannot find output destination. Need help to resolve

    I just installed a new router running DHCP and now I'm unable to reach my printer from all computers. The error code says "Cannot find output destination. Check the printer power connection, make sure the printer is switched on, and then try again.: -3150
    The printer is obviously powered on and connected to the LAN. There is an apparent IP address problem, however, I can ping the IP that seems to be loaded in the printer.
    I'm using Mac computers and I seem to have recurring IP issues with this printer.
    Thanks for any help.

    i am having the same issue as well.

  • Windows Update Error Code 8007273D: Cannot Find Solution

    When trying to update Windows, I'm running into error code 8007273D.  When I click the link "Get help with this error", it takes me to a generic page.  After doing a help search for this code, nothing turns up.  After surfing the Microsoft website with this code, I just get a bunch of rabbit trails that lead to nothing.  It seems that the the person(s) having this problem just kept being sent to different locations for the answer, but never got one.  Can anyone help?

    Hi,
    Generally, the Windows Update issue can be caused by one of the following factors:
    1. The Windows Update service has been stopped.
    2. Corrupted Windows Update Temporary folder.
    In order to narrow down the cause of this issue and resolve it, you can refer to the following steps. After finishing each step, please check the result again on the Windows Update website.
    NOTE: Some third party programs can affect the Windows Update service. If you are running any third party applications such as Spyblocker, Internet or web accelerators (programs designed to boost the speed of the Internet connection), security or anti-virus programs (Norton, McAfee, etc.), I recommend we temporarily disable or shut them down and then try accessing Windows Update later. Please understand that we are disabling these programs only for the purpose of troubleshooting and we can re-enable these programs after we finish troubleshooting.
    Step 1: Verify the relevant Windows Update services
    ================================
    1. Click the "Start" Button, in “Search” bar, type: "services.msc" (without quotes) and press Enter. If you are prompted for an administrator password or confirmation, type the password or provide confirmation.
    2. Double click the service "Windows Update".
    3. Click on the "General" tab; make sure the "Startup Type" is "Automatic" or "Manual". Then please click the "Start" button under "Service Status" to start the service.
    4. Please repeat the above steps with the "Background Intelligent Transfer Service" service.
    You can also temporarily stop these services, restart the computer, and then start these services again. If any service is missing or cannot be stopped or restarted, please let me know.
    Step 2: Rename the Windows Update Softwaredistribution folder
    ================================
    This problem may occur if the Windows Update Software distribution folder has been corrupted. We can refer to the following steps to rename this folder. Please note that the folder will be re-created the next time we visit the Windows Update site.
    1. Close all the open windows.
    2. Click the "Start" Button, click "All programs", and click "Accessories".
    3. Right-click "Command Prompt", and click "Run as administrator".
    4. In "Administrator: Command Prompt" window, type in "net stop WuAuServ" (without the quotes) and press Enter.
    Note: Please look at the cmd window and make sure it says that it was successfully stopped before we try to rename the folder. However, if it fails, please let me know before performing any further steps and include any error messages you may have received when it failed.
    5. Click the Start Button, in the "Start Search" box, type in "%windir%" (without the quotes) and press Enter.
    6. In the opened folder, look for the folder named "SoftwareDistribution".
    7. Right-click on the folder, select Rename and type "SDold" (without the quotes) to rename this folder.
    8. While still in the "Administrator: Command Prompt" window, type the command "net start WuAuServ" (without the quotes) in the opened window to restart the Windows Updates service.
    Note: Please look at the cmd window and make sure it says that it was successfully started. However, if it failed, please let me know before performing any further steps and include any error messages you may have received when it failed.
    If the issue persists, to clarify the issue and provide more accurate troubleshooting steps, would you please upload the following information to SkyDrive and provide us the link for analyzing?
    How to capture a screenshot
    ================================
    1. Press the Print Screen key (PrtScn) on your keyboard.
    2. Click the "Start" Button, type "mspaint" in the Search Bar and Press Enter.
    3. In the Paint program, click the "Edit" menu, click "Paste". Then click the "File" menu, and click "Save".
    4. The "Save As" dialogue box will appear. Type a file name in the "File name:" box, for example: "screenshot".
    5. Make sure "JPEG (*.JPG;*.JPEG;*.JPE;*.JFIF)" is selected in the "Save as type" box, click "Desktop" on the left pane and then click "Save".
    How to collect the System Information
    ================================
    1. Click the "Start" Button, type "MSINFO32" in the Search Bar and press Enter to start System Information.
    2. On the popup window, on the menu bar, click "File", and click "Save", type a file name and then choose NFO as "Save as type", click "Desktop" on the left pane, and click Save.
    How to collect the WindowsUpdate.log file
    ================================
    1. Click the "Start" Button, type "WindowsUpdate.log" (without the quotes) in the Search Bar and Press Enter. We will see a file named "WindowsUpdate.log"
    2. Now click on the "File" menu and then click on the "Save As".
    3. From the left panel, click "Desktop" and click the Save button.
    Arthur Li - MSFT

  • Another cannot find symbol error (DiveLog)

    Hi I am fairly new to java and I decided to try the tutorial DiveLog. I followed the instructions, however when I try to compile it, not with the DOS command, I keep getting an error stating that, Cannot find symbol class ..... The errors keep recurring at the tabbedPane.addTab(".....",
    package DiveLog;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class DiveLog
    { // Opens class
    public JTabbedPane tabbedPane;
    public JFrame dlframe;
    public DiveLog()
    { // Opens contructor
    //Create a frame object to add the application
    //GUI components to.
    dlframe = new JFrame("A Java(TM) Technology Dive Log");
    // Closes from title bar
    //and from menu
    dlframe.addWindowListener(new WindowAdapter()
    { // Opens addWindowListener method
    public void windowClosing(WindowEvent e)
    { // Opens windowClosing method
    System.exit(0);
    } // Closes windowClosing method
    }); // Closes addWindowListener method
    // Tabbed pane with panels for Jcomponents
    tabbedPane = new JTabbedPane(SwingConstants.LEFT);
    tabbedPane.setBackground(Color.blue);
    tabbedPane.setForeground(Color.white);
    //A method that adds individual tabs to the
    //tabbedpane object.
    populateTabbedPane();
    //Calls the method that builds the menu
    buildMenu();
    dlframe.getContentPane().add(tabbedPane);
    dlframe.pack();
    dlframe.setSize(765, 690);
    dlframe.setBackground(Color.white);
    dlframe.setVisible(true);
    } //Ends the constructor
    private void populateTabbedPane()
    { // Opens populateTabbedPane method
    // Create tabs with titles
    tabbedPane.addTab("Welcome",
    *               null,*
    *               new Welcome(),*
    *               "Welcome to the Dive Log");*
    *     tabbedPane.addTab("Diver Data",*
    *               null,*
    *               new Diver(),*
    *               "Click here to enter diver data");*
    *     tabbedPane.addTab("Log Dives",*
    *               null,*
    *               new Dives(),*
    *               "Click here to enter dives");*
    *     tabbedPane.addTab("Statistics",*
    *               null,*
    *               new Statistics(),*
    *               "Click here to calculate dive statistics");*
    *     tabbedPane.addTab("Favorite Web Site",*
    *               null,*
    *               new WebSite(),*
    *               "Click here to see a web site");*
    *     tabbedPane.addTab("Resources",*
    *               null,*
    *               new Resources(),*
    *               "Click here to see a list of resources");*
    *          } //Ends populateTabbedPane method*
    private void buildMenu()
    { // Opens buildMenu method
    JMenuBar mb = new JMenuBar();
    JMenu menu = new JMenu("File");
    JMenuItem item = new JMenuItem("Exit");
    //Closes the application from the Exit
    //menu item.
    item.addActionListener(new ActionListener()
    { // Opens addActionListener method
    public void actionPerformed(ActionEvent e)
    { // Opens actionPerformed method
    System.exit(0);
    } // Closes actionPerformed method
    }); // Closes addActionListener method
    menu.add(item);
    mb.add(menu);
    dlframe.setJMenuBar(mb);
    } //Ends the buildMenu method
    } //Ends class
    If you could help me, please explain it into terms that I would understand as I am still new to the entire language. Thanks

    cannot find symbol: whatever class or method signature or variable you use was never declared. It's as simple as that. Make sure that the names are correct; if a class is missing (thanks a bunch for omitting the relevant part of the error message :p), ensure the compiled .class file is in the classpath, if a method isn't found make sure that the arguments are provided exactly in the same order, number and type as the method declaration declares, and if a variable is missing make sure that you actually declared it.
    Learn about code tags when posting code next time, by the way.

  • Static method throwing "cannot find symbol - method"

    This is an assignment for school. I'm in my second semester of object oriented programming. Here is the method causing the error when compiled in the test case:
        public void testRead()
            Company aCompany = buildCompany();
            aCompany.writeToFile("CompanyDatabase.txt");
            Company bCompany = new BooksAndMore();
            bCompany = readFromFile("CompanyDatabase.txt");
            assertTrue(aCompany.equals(bCompany));
        }Error thrown is "cannot find symbol - method readFromFile(java.lang.String). Here is the method being called:
    {code} public static Company readFromFile(String fileName)
    Company company = new BooksAndMore();
    FileInputStream fis = null;
    ObjectInputStream in = null;
    try
    fis = new FileInputStream(fileName);
    in = new ObjectInputStream(fis);
    company = (Company)in.readObject();
    in.close();
    catch (IOException ex)
    ex.printStackTrace();
    catch (ClassNotFoundException ex)
    ex.printStackTrace();
    return company;
    }{code}
    What am I doing wrong?

    are testRead() and readFromFile() in the same class?
    also, the first line is pointless:
    Company bCompany = new BooksAndMore();
    bCompany = readFromFile("CompanyDatabase.txt");Since the second line calls a method that creates a new BooksAndMore object, there's no point creating one in the first line...it will just be replaced by the new one.
    Company bCompany = readFromFile("CompanyDatabase.txt");...assuming that your readFromFile() method is in the same class. If not, you need to call the method on the class.

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

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

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

  • "cannot find symbol" 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?

  • "cannot find symbol class studentList" error

    Hi I get this error
    "cannot find symbol class studentList", but this class is at the same file and also it is in the same folder. so what's wrong .. and I checked the spelling it's the same.
    I should create an object named myList of type studentList
    and second, I call method menu() and pass it myList as actual parameter.
    so I called the function menu which is should be in the main too
    like this
    myList.menu();
    and menu method accepts as parameter an object of type studentList. and display the menu for the user to choose..
    here is part my program:
    public class ListTest
    {  public void menu(Student L) // accepts parameter
                   System.out.println("");
                System.out.println("Choose a number between 1 to 4");
                      System.out.println("1-Print Info of A Student ");          
                System.out.println("2-Print Info of All Students ");                          
               System.out.println("3-Display grade of A Specific student");                           
                System.out.println("4-Exit");
                System.out.println("");        
              int choice = Stdin.readInteger();
              while (choice != 5)
             switch (choice) {
                 case 1:
             L.PrintAStudent(int L);
             break;
              case 2:
            L.PrintAll();
            break;     
              case 3:
              L.DisplayGPA();
              break;
                 case 3:
                System.exit(0);
               break;
               default:
               System.out.println("wrong Number");
              System.out.println("Enter a number between 1 to 4 ");
               System.out.println("Enter 4 to Exit");
                break;
                System.out.println("");
                System.out.println("Choose a number between 1 to 4");
                System.out.println("1-Print Info of A Student ");          
                System.out.println("2-Print Info of All Students ");                          
               System.out.println("3-Display grade of A Specific student");                           
                System.out.println("4-Exit");
                System.out.println(""); 
                choice = Stdin.readInteger();
         }// end method menu
         public static void main(String args[ ])
         { studentList myList = new studentList();//myList object is created
    myList.menu();
                             }//end main
    }// end of class ListTest
              

    you have mentioned about the class "studentList" but that class is not to be found in the code you have pasted. its instead "ListTest". And the "menu" function seems to b a part of "ListTest" class. Can you provide the structure of the classes "studentList" and "Student" so that the problem can be more clearly understood?
    also you are using the variable "Stdin" in the line int choice = Stdin.readInteger(); where as you have not declared this variable.
    in the "switch" statement you are calling two different functions for the same case "3" where as it should be "case 3" and "case 4" respectively.
    in the "main" you are calling the "menu" function without any parameter while you actually want to pass argument of type "studentList".

  • Cannot find symbol class error

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

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

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

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

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

  • Cannot find symbol error when compiling in different packages

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

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

  • 5 Errors Left: "Cannot find symbol variable "

    I think I have almost completed my error fixing but I cannot seem to figure out how to fix these last few errors I have.
    Here are my errors:
    --------------------Configuration: MadrigalRPA6 - JDK version 1.6.0_02 <Default> - <Default>--------------------
    E:\MadrigalR\MadrigalRPA6\src\MadrigalRPA6.java:113: cannot find symbol
    symbol : variable size
    location: class ServicesArray
    servicesArray = new PetService[size];
    ^
    E:\MadrigalR\MadrigalRPA6\src\MadrigalRPA6.java:115: cannot find symbol
    symbol : variable io
    location: class ServicesArray
    int size = io.readInt("How many services do you have to enter?");
    ^
    E:\MadrigalR\MadrigalRPA6\src\MadrigalRPA6.java:123: cannot find symbol
    symbol : variable number
    location: class ServicesArray
    for(int i = 0; i < number; ++i)
    ^
    E:\MadrigalR\MadrigalRPA6\src\MadrigalRPA6.java:135: cannot find symbol
    symbol : variable number
    location: class ServicesArray
    for(int i = 0; i < number; ++i)
    ^
    E:\MadrigalR\MadrigalRPA6\src\MadrigalRPA6.java:144: cannot find symbol
    symbol : variable io
    location: class ServicesArray
    io.writeInfo(info);
    ^
    5 errors
    Process completed.
    * @(#)MadrigalRPA6.java
    * MadrigalRPA6 application
    * @author
    * @version 1.00 2007/11/5
    *     Program Purpose: This program is designed to store available services for
    *  Dr. Doolittle's Mobile Pet Clinic.
    import staugIO.StaugIO;
    //DECLARE PET SERVICES CLASS
    class PetService
    private String ServiceCode = " ";
    private String ServiceName = " ";
    private String ServiceDescription = " ";
    private String ServiceType = " ";
    private double price = 0.00;
    private StaugIO io = new StaugIO();
    //CONSTRUCTOR
    public PetService()
    //END CONSTRUCTOR
    //SET PET SERVICES NAME
    public void setServiceCode()
         ServiceCode = io.readString("Enter the service code");
    }//END setServiceCode()
    //SET SERVICE NAME
    public void setServiceName()
         ServiceName = io.readString("Enter the service name");
    }//END setServiceName()
    //SET SERVICE DESCRIPTION
    public void setServiceDescription()
         ServiceDescription = io.readString("Enter the service description");
    }//END setServiceDescription
    //SET SERVICE TYPE
    public void setServiceType()
         ServiceType = io.readString("Enter the service type");
    }//END setServiceType()
    //SET SERVICE PRICE
    public void setPrice()
         price = io.readDouble("Enter the service price");
    }//END setPrice()
    //GET PET SERVICE NAME
    public String getServiceCode()
         return ServiceCode;
    }//END getServiceCode()
    //GET SERVICE NAME
    public String getServiceName()
         return ServiceName;
    }//END getServiceName()
    //GET SERVICE DESCRIPTION
    public String getServiceDescription()
         return ServiceDescription;
    }//END getServiceDescription
    //GET SERVICE TYPE
    public String getServiceType()
         return ServiceType;
    }//END getServiceType
    //GET SERVICE PRICE
    public double getPrice()
         return price;
    }//END getPrice
    }//END PetService CLASS
    class ServicesArray
         PetService[] servicesArray;  // Code the reference to the null array.
    //CONSTRUCTOR
    public ServicesArray()
    //END CONSTRUCTOR     
    public void getSize()
         servicesArray = new PetService[size];     *////////ERROR HERE*
    //READ NUMBER OF SERVICES TO STORE
    int size = io.readInt("How many services do you have to enter?"); *///////ERROR HERE TOO*
    //DYNAMICALLY DEFINE ARRAY OF PET SERVICE OBJECTS
    PetService services[] = new PetService[size];
    //DEFINE PET SERVICE OBJECTS AND FILL ARRAY OF OBJECTS WITH PET SERVICE DATA
    for(int i = 0; i < number; ++i) */////////////ERROR HERE ASWELL*
    services[i] = new PetService();
    services.setServiceCode();
    services[i].setServiceName();
    services[i].setServiceDescription();
    services[i].setServiceType();
    services[i].setPrice();
    }//END FOR
    //BUILD OUTPUT STRING FROM ARRAY OF PET SERVICE OBJECTS
    //AND DISPLAY PET SERVICES ONE AT A TIME
    for(int i = 0; i < number; ++i) *////////HMM WOW THIS DOESN'T SURPRISE ME THAT I HAVE ANOTHER ERROR*
         String info = "PET SERVICE " + (i+1) + " DATA\n";
              info += "\nSERVICE CODE: " + services[i].getServiceCode() + "\n"
                   + "SERVICE: " + services[i].getServiceName() + "\n"
                   + "DESC: " + services[i].getServiceDescription() + "\n"
                   + "TYPE: " + services[i].getServiceType() + "\n"
                   + "PRICE: " + services[i].getPrice() + "\n";
    //DISPLAY PET SERVICE DATA
         io.writeInfo(info); *////////////ERROR HERE AS WELL*
    }//END FOR
    }//END getSize()
    }//END ServicesArray CLASS
    public class MadrigalRPA6
    public static void main(String[]args)
    PetService service = new PetService();
    }//END main()
    }//END MADRIGALRPA6 CLASS

    wow i simply added the
    private StaugIO io = new StaugIO();
    into my ServicesArray class and i got the process completed with no errors, thats awesome but what doesnt make sense is this summary of this assignment that i have:
    Code a program that will store available services for Dr. Doolittle's Mobile Pet Clinic. Let the user determine the size of the array. Once the array has been populated with service information, display the contents of the array one at a time in separate GUI windows. Screen capture your output to a Word file and submit it with everything else. Use the code on pp 365-367 in the textbook to help you. Assume that the spacing is always double after a period and colon. You may limit your array size to no more than 3 as indicated by the sample output below. Use the sample output to test your array.
    PET SERVICE NO. 1
    SERVICE CODE: DG-2478
    SERVICE: Dog Group I
    DESC: DHLPP, Corona, Bordetella, Rabies
    TYPE: Vaccine
    PRICE: $47.50
    PET SERVICE NO. 2
    SERVICE CODE: FL-3182
    SERVICE: Feline Group I
    DESC: FVRCP, FeLV, Rabies
    TYPE: Vaccine
    PRICE: $46.50
    PET SERVICE NO. 3
    SERVICE CODE: DG-4682
    SERVICE: Dog Spay
    DESC: Abdominal surgery to remove the ovaries and/or uterus
    (ovariohysterectomy).
    TYPE: Surgery
    PRICE: $57.50
    No where in my code do i even have any of this so how would the user be able to see this? Is this program designed to just display the SERVICE CODE: and then the user types in the DG-4682? etc etc..
    I ask this because I cannot view my dialog boxes because when I run the program i get nothing, just process completed, nothing else.

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

Maybe you are looking for

  • How do i use math type equations in pages?

    I can't get my math equations to work when im in pages

  • Convert Avi to dvd

    hi guys can any off you recommend a good program like vso convertxtodvd on the mac ? i.e one that converts avi to be able to watch on dvd players on tv its frustrating to convert then separately burn - especially now that idvd is not shipped with new

  • Text Listener

    I'm having trouble finding a tutorial on adding a text listener. What I what to do is have the user input a file name and then the program can get data from that file. Is there a standard way of knowing when the user is done inputting, besides adding

  • Time machine nas

    Ik gebruik al jaren een Synology 212j NAS voor opslag van backups van Time Machine. Sinds kort (installatie van Mavericks??) werkt dit niet meer, TM herkent de schijf maar kan hem niet gebruiken. Schakel ik de firewall uit dan gaat het wel. Wie weet

  • DBMS_STATS.SET_TABLE_PREFS does not work as expected

    Hi there! I am experiencing rather strange behaviour of the DBMS_STATS.SET__PREFS proceduree. I want to achieve that the statistics on the table is gathered with degrre = 4 in parallel and I want to achieve that by setting table preferences and not e