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

Similar Messages

  • Java code Cannot find symbol problem

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

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

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

    I've got problem with compiling this program:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class SliderDemo extends JFrame {
         private JSlider diameterSlider;
         private ovalPanel myPanel;
         public SliderDemo()
              super( "&#1048;&#1079;&#1084;&#1077;&#1085;&#1077;&#1085;&#1080;&#1077; &#1076;&#1080;&#1072;&#1084;&#1077;&#1090;&#1088;&#1072; &#1082;&#1088;&#1091;&#1075;&#1072;" );
              myPanel = new ovalPanel();
              myPanel.setBackground( Color.YELLOW );
         diameterSlider = new JSlider( SwingConstants.HORIZONTAL, 0, 200, 10 );
         diameterSlider.setMajorTickSpacing( 10 );
         diameterSlider.setPaintTicks( true );
         diameterSlider.addChangeListener(
              new ChangeListener() {
                   public void stateChanged( ChangeEvent e )
                        myPanel.setDiameter( diameterSlider.getValue() );
         Container container = getContentPane();
         container.add( diameterSlider, BorderLayout.SOUTH );
         container.add( myPanel, BorderLayout.CENTER );
         setSize( 220, 270 );
         setVisible( true );
         public static void main( String args[] )
              SliderDemo application = new SliderDemo();
         application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
    }Compiler shows 2 errors, looking similar:
    SliderDemo.java:12: cannot find symbol
    symbol : class ovalPanel
    location: class SliderDemo
    private ovalPanel myPanel;
    SliderDemo.java:18: cannot find symbol
    symbol : class ovalPanel
    location: class SliderDemo
    myPanel = new ovalPanel();
    What can I do with it. I checked everything on Internet and books, but it still not compiling!

    possible problems are:
    1. you haven't created an ovalPanel() class in your sliderDemo class
    2. you have created an ovalPanel() class in separate file but you didn't save it with the same directory with your sliderDemo class

  • Cannot find symbol error - ArrayList problem

    Hey guys,
    I'll post the code, and then the error message below. Essentially I'm getting an error message on the add and it's a bit confusing, since I've imported ArrayList and add is a method in there as well.
    My question: What am I missing? If someone could post what I'm missing, I'd appreciate it. No trolls please.
    import java.text.NumberFormat;
    import java.util.ArrayList;
    import java.util.Iterator;
    public class CDCollection {
        private ArrayList collection = null;
        private double    totalCost;
        //  Constructor: Creates an initially empty collection.
        public CDCollection() {
            collection = new ArrayList(100);
            totalCost = 0.0;
        //  Adds a CD to the collection, increasing the size of the
        //  collection if necessary.
        public void addCD(String title, String artist, double cost, int tracks) {
            collection.add(new CD(title, artist, cost, tracks));
            totalCost += cost;
        //  Returns a report describing the CD collection.
        public String toString() {
            NumberFormat fmt = NumberFormat.getCurrencyInstance();
            String report = "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n";
            report += "My CD Collection\n\n";
            report += "Number of CDs: " + collection.size() + "\n";
            report += "Total cost: " + fmt.format(totalCost) + "\n";
            if (collection.size() != 0) {
                report += "Average cost: " + fmt.format(totalCost / collection.size());
            report += "\n\nCD List:\n\n";
            report += CDCollection.createReport(collection);
            return report;
         * @param al
         * @return
        public static String createReport(ArrayList al) {
            StringBuffer sb = new StringBuffer();
            Iterator iter = al.iterator();
            while (iter.hasNext()) {
                CD aCD = (CD) iter.next();
                sb.append(aCD.toString());
                sb.append(System.getProperty("line.separator"));
            return sb.toString();
    } and the error message:
    CDCollection.java:36: cannot find symbol
    symbol: method add(CD)
    location: class java.util.ArrayList<java.lang.String>
    collection.add(new CD(title, artist, cost, tracks));
    Any help would be very appreciated folks.

    nm, figured it out, sorry guys.
    For those reading to figure out their own answer to a similar problem....
    Private ArrayList <CD> collection = null;and
    public CDCollection(){
       ArrayList <CD> collection = new ArrayList <CD> (100);

  • Studio Creator 2 environment problem - cannot find symbol

    This may be a classic newbie question, but I've been looking for an answer without success for three days now. Hopefully, someone that is familiar with configuring Sudio Creator 2 Update 1 environment can help me fix this.
    Problem: Cannot build a simple program within the SC2 IDE. Always get a "cannot find symbol" error related to System.out.printf(...).
    Details:
    I have a simple program, as follows:
    import java.io.* ;
    public class test {
        /** Creates a new instance of test */
        public test() {
        public static void main(String[] args) {
            // TODO code application logic here
            String result="Success!";
            System.out.print("system.out.print") ;
            System.out.printf( "Product is %s \n", result );
    }I can successfully compile this program from the command line using javac test.java and then execute java test (inside the same directory). The build and execution work flawlessly! Therefore, I assume the code is right.
    However, every time I try to build this program, I get one error
    init:
    deps-clean:
    Deleting directory C:\Projects\test\build
    clean:
    init:
    deps-jar:
    Created dir: C:\Projects\test\build\classes
    Compiling 1 source file to C:\Projects\test\build\classes
    C:\Projects\test\src\test.java:14: cannot find symbol
    symbol  : method printf(java.lang.String,java.lang.String)
    location: class java.io.PrintStream
            System.out.printf( "Product is %s \n", result );
    1 error
    BUILD FAILED (total time: 1 second)Here are two system vars that are probably most relevant (taken from WinXP, not from within the IDE).
    PATH = %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\program files\Sun\Creator2_1\java\bin;C:\Program Files\Java\jre1.6.0_03\bin;C:\Program Files\ATI Technologies\ATI Control Panel;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\MySQL\MySQL Server 5.0\bin
    CLASSPATH = .;C:\Program Files\Java\jre1.6.0_03\lib;
    I haven't figured out where the internal environemt vars are in the SJSC2 IDE.
    I have tried uninstalling and reinstalling several times, and on a couple different computers, but I get exactly the same problem and results.
    Can someone please help me figure this out before I pull what's left of my hair out? ;-)
    Thanks!

    It looks like it's going to be a BUG in JSC2_Update1.
    I traded emails with Sun support today. They were able to duplicate the problem and are opening a bug report. Doesn't always mean that it really is a bug, but at least they're on it. ;-)
    In the meantime, the Sun rep suggested the folliwing:
    "Also, I suggest trying the NetBeans6.0 IDE. It offers the Creator
    features as Visual Web in NetBeans6.0. See the information :
    http://developers.sun.com/jscreator/index.jsp
    It also has links to migration guide."
    It's still open.

  • Java Studio Enterprise 8.1 and jdk1.6 - cannot find symbol

    Hi,
    I am using subj. The problem I have is that I declared 2-3 classes with methods in one package. I made an object of the class and use intellisense to navigate to the method I need but when I try to compile the code I have "cannot find symbol" error on the method I intellisensed to. It seems to me that it is IDE problem.
    Does anyone know how to work around it?
    The code is below, in case you are interested.
    package webservice;
    import java.io.*;
    public class Main {
    /** Creates a new instance of Main */
    public Main() {
    * @param args the command line arguments
    public static void main(String[] args) {
    String filename = null;
    String timestamp = null;
    try {
    Q q = new Q();
    timestamp = "2007-06-01";
    QList ql = q.getList(timestamp);
    System.out.println("--------------Ok-------------");
    catch(Exception e) {
    System.out.println("An Exception thrown in Main(). e = "+e.toString());
    package webservice;
    public class Q {
    public Q() {
    public QList getList(String timestamp) {
    QList result = null;
    return result;
    Thanks,
    Dmitry

    Thanks for that Kris.
    I found the root of my problem. In this example I used a remote webservice to retrieve some data. It happened to be that the generated class file from wsdl and my custom class had the same name.
    So, instead of reporting as ambiguous definition error the ide picked up the wrong class and did not find the method I intended to use.
    Hopefully it will help someone else having the same problem.
    Dmitry

  • Cannot find Symbol :class CLOB

    Hi,
    I am using JDK1.5.0_06 and Oracle8.1.7.
    When i compile java program I am getting the following error
    cannot find symbol
    symbol : class CLOB
    I have added classes12.zip into classpath.
    Can anybody tell me why this errpr comes? Is there any other files instead of classes12.zip to be added (since its JDK1.5 version? )
    Thanks in advance
    neema

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

  • Inheritance - Cannot find Symbol

    Hello!
    After many hours of searching for the answer, i have decided to brave getting a grilling for asking something trivial.
    I'm creatating a system and so far the problem i am having is inheritance.
    The superclass compiles fine, no problems:
    package Boats;
    public abstract class Boat
         protected String name;
         protected int price;
         protected int id;          
         protected String type;          
         protected boolean hire;
         public boat(int boatID, String boatName, int cost, String boatType)
            name = boatName;
              price = cost;
              id = boatID;
              type = boatType;
            hire = false;
    }however, the subclass of pedal boat won't compile:
    package Boats;
    public abstract class PedalBoat extends Boat
         private String colour;
        public PedalBoat(int id, String boatName, int cost, String boatType, String c)
            super(id, boatName, cost, boatType);
              colour = c;
            super.hire = false;
    }both of these class files are in the same folder 'Boats', but when i compile PedalBoat, the following message is displayed:
    "PedalBoat.java:2: cannot find symbol
    symbol: class Boat
    public abstract class PedalBoat extends Boat
    ^
    Any thoughts or help or links to anywhere that has answered this before?
    Thanks!

    You'll want the following directory structure. The C:\projects part is arbitrary. It's what comes after it that matters.
    C:\projects\Boats\Boat.java
    C:\projects\Boats\PedalBoat.javaThen, CD to C:\projects, and execute
    javac -cp . Boats/*.javaAs a side note, to go with the flow convention-wise, I'd suggest renaming your Boats package to boats. Package names are conventionally all lowercase.
    [Javapedia: Classpath|http://wiki.java.net/bin/view/Javapedia/ClassPath]
    [How Classes are Found|http://java.sun.com/j2se/1.5.0/docs/tooldocs/findingclasses.html]
    [Setting the class path (Windows)|http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/classpath.html]
    [Setting the class path (Solaris/Linux)|http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/classpath.html]
    [Understanding the Java ClassLoader|http://www-106.ibm.com/developerworks/edu/j-dw-javaclass-i.html]
    java -cp .;<any other directories or jars> YourClassNameYou get a NoClassDefFoundError message because the JVM (Java Virtual Machine) can't find your class. The way to remedy this is to ensure that your class is included in the classpath. The example assumes that you are in the same directory as the class you're trying to run.
    javac -classpath .;<any additional jar files or directories> YourClassName.javaYou get a "cannot resolve symbol" message because the compiler can't find your class. The way to remedy this is to ensure that your class is included in the classpath. The example assumes that you are in the same directory as the class you're trying to run.

  • Cannot find symbol even though it's there.

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

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

  • Cannot find symbol error when compiling in different packages

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

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

Maybe you are looking for