Unable to compile "SerialDemo.java", many "cannot find symbols" errors

I have all the correct files in their respective directory.
comm.jar in jre\lib\bin,
javax.comm.properties in jre\lib
win32com.dll in jre\bin
I extracted all the whole of SerialDemo into one folder and started compiling from there. But it doesn't work. I keep getting many "cannot find symbol" errors. They are usually referred to by:
SerialParameters
SerialConnection
AlertDialog
SerialConnectionException
SerialDemo.java is not edited and was compiled directly. All of my files are in one folder (AlertDialog.java compiles fine and is in the same folder, etc)
I was wondering what might be the cause of it. I'm currently using a Windows XP Service Pack 2, IBM P3 Laptop. I was reading "http://forum.java.sun.com/thread.jspa?threadID=674514&messageID=3941560"
And I found out it works fine on Win2k OS. Why is this so? I'm getting the exact same error as he stated on his last post and I tried looking for a solution and decided to turn to you guys. I'd really appreciate some help, if any. Thanks in advance.

I followed the PlatformSpecific. I realised that I
added one for JRE when it wasn't required. The
problem was solved.
Thank you so much, the both of you. My stupid mistake
caused quite a bit of havoc. I apologise.No need to apologise; The confusing part is that when you download
a jre, that's just what your get: a jre, but when you download the jdk
you not just get the jdk and the jre but you get a second jre with them,
stored under the jdk directory.
To the programmer that second jre is useless, it is used internally by
the jdk tools.
kind regards,
Jos

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" error while compiling the RMI

    I am trying to implement a simple RMI.
    I have the following :
    1. HelloInterface which has the SayHello method defined.
    2. HelloImpl which has the implementation of Say Hello
    3. Server code
    4. Client code
    the HelloInterface compiles properly.
    but when i say javac HelloImpl
    package rmisample;
    import java.rmi.*;
    import java.rmi.server.UnicastRemoteObject;
    import java.rmi.RemoteException;
    public class HelloImpl extends UnicastRemoteObject implements HelloInterface{ --> this is where i get the error
    /** Creates a new instance of HelloImpl */
    public HelloImpl()throws RemoteException {
    super();
    public String SayHello(String s) throws RemoteException
    return "hello" +s;
    I get the following error:
    C:\Myjava\RMISample\src\rmisample>javac HelloImpl.java
    HelloImpl.java:18: cannot find symbol
    symbol: class HelloInterface
    public class HelloImpl extends UnicastRemoteObject implements HelloInterface{
    All 4 files are in the same directory.
    Am not sure what is going wrong and am new to this.
    Edited by: topcatin on Sep 14, 2007 6:52 AM

    The problem is probably that the compiler can't find the file with that class definition.
    Try changing your javac call so that is starts off
    javac -classpath .
    The dot is important!
    If it works, then go read up on classpaths.

  • Cannot find symbol error when compiling from cmd

    When compile and running program from Eclipse 3.3 everything works fine, but when trying to compile from cmd I get this error:
    C:\TEMP\1>javac A.java
    A.java:38: cannot find symbol
    symbol : class SwingWorker
    location: package javax.swing
    import javax.swing.SwingWorker;
    ^
    A.java:48: cannot find symbol
    symbol : class SwingWorker
    location: class A
    class Task extends SwingWorker {
    ^
    A.java:109: cannot find symbol
    symbol : method addPropertyChangeListener(A)
    location: class A.Task
    task.addPropertyChangeListener(this);
    ^
    A.java:110: cannot find symbol
    symbol : method execute()
    location: class A.Task
    task.execute();
    ^
    java -version get back: java version "1.6.0_14"....
    now, if i copy .class file that Eclipse made and just execute thet .class file from cmd everything works fine.
    here is the code, but i think that problems is somwhere else. i tried to serach on google, but... :(
    import java.awt.BorderLayout;
    import java.awt.Cursor;
    import java.awt.Insets;
    import java.awt.Toolkit;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.beans.PropertyChangeEvent;
    import java.beans.PropertyChangeListener;
    import javax.swing.BorderFactory;
    import javax.swing.JButton;
    import javax.swing.JComponent;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JProgressBar;
    import javax.swing.JScrollPane;
    import javax.swing.JTextArea;
    import javax.swing.SwingWorker;
    public class A extends JPanel implements ActionListener, PropertyChangeListener {
        private JProgressBar progressBar;
        private JButton startButton;
        private JTextArea taskOutput;
        private Task task;
        class Task extends SwingWorker {
             * Main task. Executed in background thread.
    //        @Override
            public Void doInBackground() {
                 System.out.println("test");
                return null;
             * Executed in event dispatching thread
    //        @Override
            public void done() {
                Toolkit.getDefaultToolkit().beep();
                startButton.setEnabled(true);
                setCursor(null); //turn off the wait cursor
                taskOutput.append("Done!\n");
        public A() {
            super(new BorderLayout());
            //Create the demo's UI.
            startButton = new JButton("Start");
            startButton.setActionCommand("start");
            startButton.addActionListener(this);
            progressBar = new JProgressBar(0, 100);
            progressBar.setValue(0);
            progressBar.setStringPainted(true);
            taskOutput = new JTextArea(25, 50);
            taskOutput.setMargin(new Insets(5,5,5,5));
            taskOutput.setEditable(false);
            JPanel panel = new JPanel();
            panel.add(startButton);
            panel.add(progressBar);
            add(panel, BorderLayout.PAGE_START);
            add(new JScrollPane(taskOutput), BorderLayout.CENTER);
            setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
         * Invoked when the user presses the start button.
        public void actionPerformed(ActionEvent evt) {
            startButton.setEnabled(false);
            setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
            //Instances of javax.swing.SwingWorker are not reusuable, so
            //we create new instances as needed.
            task = new Task();
            task.addPropertyChangeListener(this);
            task.execute();
         * Invoked when task's progress property changes.
        public void propertyChange(PropertyChangeEvent evt) {
            if ("progress" == evt.getPropertyName()) {
                int progress = (Integer) evt.getNewValue();
                progressBar.setValue(progress);
    //            taskOutput.append(String.format("Completed %d%% of task.\n", task.getProgress()));
         * Create the GUI and show it. As with all GUI code, this must run
         * on the event-dispatching thread.
        private static void createAndShowGUI() {
            //Create and set up the window.
            JFrame frame = new JFrame("Veritas Backup");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            //Create and set up the content pane.
            JComponent newContentPane = new A();
            newContentPane.setOpaque(true); //content panes must be opaque
            frame.setContentPane(newContentPane);
            //Display the window.
            frame.pack();
            frame.setVisible(true);
        public static void main(String[] args) {
            //Schedule a job for the event-dispatching thread:
            //creating and showing this application's GUI.
             javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
    }thank you very much!!!!

    Perhaps you are running an older version of javac. What do you get with "javac -version" or try compiling with the full path to jdk 1.6.0_14/bin/javac.

  • "cannot find symbol" error in compiling

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

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

  • Java:3: cannot find symbol

    i'm learning java
    but when i do a java projram i got a error
    hare is that
    Test1.java:3: cannot find symbol
    symbol : variable Out
    location: class java.lang.System
    System.Out.Println("john");
    ^
    1 error
    i got this error. i see "." this symbol
    then what should i do ?

    Java is case-sensitive. Don't type "Out" and "Println" when you're supposed to type "out" and "println".
    Try this:
    System.out.println("john");

  • Max3.java:17: cannot find symbol

    Hi guys,
    Need some help here..
    This is my code:
    import java.util.Scanner;
    import static java.lang.Math.*;
    public class Max3{
         public static void main (String[] args)     {
         Scanner kb = new Scanner(System.in);
         System.out.print ("Enter 1st number:");
         int first = kb.nextInt();
         System.out.print ("Enter 2nd number:");
         int second = kb.nextInt();
         System.out.print ("Enter 3rd number:");
         int third = kb.nextInt();
         System.out.println (Math.max(first,second,third));
    ===================================================================
    This is the error im getting :
    Max3.java:17: cannot find symbol
    symbol : method max(int,int,int)
    location: class java.lang.Math
    System.out.println (Math.max(first,second,third));
    ^
    1 error
    ====================================================================
    Do i need to import the math? i read from somewhere that Math class is contained in the Java.lang package, and we therefore don't have to import it ...

    I tried again, same error.
    Edited Maths.max to only max
    ========================================
    import java.util.Scanner;
    import static java.lang.Math.*;
    public class Max3{
         public static void main (String[] args)     {
         Scanner kb = new Scanner(System.in);
         System.out.print ("Enter 1st number:");
         int first = kb.nextInt();
         System.out.print ("Enter 2nd number:");
         int second = kb.nextInt();
         System.out.print ("Enter 3rd number:");
         int third = kb.nextInt();
         System.out.println (max(first,second,third));
    =================================================
    Error:
    C:\kenny>javac Max3.java
    Max3.java:17: cannot find symbol
    symbol : method max(int,int,int)
    location: class Max3
    System.out.println (max(first,second,third));
    ^
    1 error
    Thanks for spending some time on this!

  • "Simon2.java:37: cannot find symbol

    Im coming up with this error. Does anyone know what I'm missing.
    Thankyou for any response
    "Simon2.java:37: cannot find symbol
    symbol : method getPane()
    location: class Simon2
    Container pane = getPane();
    ^
    1 error"
    public Component createComponents(){
    JButton button;
    Container pane = getPane();
    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    pane.setLayout(gridbag);
    button = new JButton("Holy Shit!");
    c.gridx = 0;
    c.gridy = 0;
    gridbag.setConstraints(button, c);
    pane.add(button);
    return pane;
    button.setMnemonic(KeyEvent.VK_I);
    button.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e) {
    }

    Here's all the code so far, where have I gone wrong
    Simon2.java:37: cannot find symbol
    symbol : method getContentPane()
    location: class Simon2
    Container contentPane = getContentPane();
    ^
    1 error
    mport javax.swing.*;
    import javax.swing.UIManager;
    import java.awt.*;
    import java.awt.event.*;
    import com.l2fprod.gui.plaf.skin.*;
    import javax.swing.JButton;
    public class Simon2 {
    public static void main(String[] args) {
    try {
    Skin theSkinToUse = SkinLookAndFeel.loadThemePack("chaNinja-Bluethemepack.zip");
    SkinLookAndFeel.setSkin(theSkinToUse);
    UIManager.setLookAndFeel(new SkinLookAndFeel());
    } catch (Exception e){ }
    JFrame.setDefaultLookAndFeelDecorated(true);
    JFrame fr = new JFrame("Simon2");
    Simon2 app = new Simon2();
    Component contents = app.createComponents();
    fr.getContentPane().add(contents, BorderLayout.CENTER);
    fr.addWindowListener(new WindowAdapter(){
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    fr.setTitle("AnimalDance");
    fr.setSize(500, 200);
    fr.setVisible(true);}
    public Component createComponents(){
    JButton button;
    Container contentPane = getContentPane();
    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    contentPane.setLayout(gridbag);
    button = new JButton("Holy birds!");
    c.gridx = 0;
    c.gridy = 0;
    gridbag.setConstraints(button, c);
    contentPane.add(button);
    return contentPane;
    button.setMnemonic(KeyEvent.VK_I);
    button.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e) {
    }

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

    cannot find symbolhi guys ... i getting this error... dunno what i did worng...
    i have two classes :
    package modaprend.Disciplines;
    public class LearningObjects {
    /** Creates a new instance of LearningObjects */
    public LearningObjects(String newPath){
    this.path = newPath;
    and :
    package modaprend.Disciplines;
    public class Exercises extends LearningObjects{
    /** Creates a new instance of Exercises */
    public Exercises() { ----> i got the error here
    ERROR :
    init:
    deps-jar:
    Compiling 1 source file to /home/pluster/Ual/LPP1/ModAprend/build/classes
    /home/pluster/Ual/LPP1/ModAprend/src/modaprend/Disciplines/Exercises.java:14: cannot find symbol
    symbol : constructor LearningObjects()
    location: class modaprend.Disciplines.LearningObjects
    public Exercises() {
    1 error
    BUILD FAILED (total time: 1 second)
    i running Linux (FC3) + JDK 5.0 + Netbeans 4.0 Beta 2 for editing
    Thanks

    It looks like LearningObjects has a single constructor that takes a String as an argument. That means the the ONLY way to create a LearningObjects object is with a String argument.
    Next, Excercises extends LearningObjects. Extends means "is a." So to create an Excercises object, an Excercises constructor MUST call a LearningObject constructor. If the only LearningObjects constructor requires a Sring, then the Excercises constructor MUST provide a String.
    You need to have a line like super("default"); as the first line in the Excercises constructor(s).

  • Help a Beginner? cannot find symbol error?

    class Box {
         double width;
         double height;
         double depth;
    Box(Box ob) {
              width = ob.width;
              height = ob.height;
              depth = ob.depth;
    Box(double w, double h, double d) {
         width = w;
         height = h;
         depth = d;
    double volume() {
         return width * height * depth;
    class BoxWeight extends Box {
         double weight;
         BoxWeight(double w, double h, double d, double m) {
              width = w;
              height = h;
              depth = d;
              weight = m;
    class DemoBoxWeight {
         public static void main(String[] args) {
              BoxWeight mybox1 = new BoxWeight(10, 20, 35, 34);
              double vol;
              vol = mybox1.volume();
              System.out.println("Weight of mybox1 is " + mybox1.weight);
    okay, this is basically from a book, but when I compile it in TextPad, it reads
    C:\Documents and Settings\Guest 1\Desktop\EPGY C015\Box\Box.java:27: cannot find symbol
    symbol : constructor Box()
    location: class Box
         BoxWeight(double w, double h, double d, double m) {
         ^
    1 error
    Tool completed with exit code 1
    Why is that and how can I fix it? :P

    Whenever you extend a class (here you're extending Box with BoxWeight), and create the subclass's constructor, the parent class's (or super class's) constructor gets called first whether it is explicitly called or not. So here in the BoxWeight constructor, the Box constructor is implicitly called:
    BoxWeight(double w, double h, double d, double m) {
      // even though you don't specify it, the Box() constructor is called here. 
      // it's as if you have here the call:
      super();
      width = w;
      height = h;
      depth = d;
      weight = m;
    }If you don't specify the super(), it get's implicitly called as the first call in the BoxWeight constructor. Notice that the implicit constructor has no parameters. Since Box does not have a constructor without parameters, this will throw an error. To get around this, you should explicitly call the super constructor with its proper parameters as the first method called in your BoxWeight constructor:
    BoxWeight(double w, double h, double d, double m) {
      super(w, h, d);  // *** here ***
      width = w;
      height = h;
      depth = d;
      weight = m;
    }

  • The Traditional "cannot find symbol" error

    As i already come across thru this error but i still getting clear about this. When i try to compile my VendServlet.java file the compiler shows this stupid error and i even check the classpath and all other formal check that we do when this kinda error comes. But it shows the same error. I even delete the class file of RMACPModel.java and re-compile
    the file but it seems no worth of it. What can i do? And here the error msg for u
    C:\apache-tomcat-6.0.16\webapps\rmanew\WEB-INF\classes\com\rajk\javacode\servlet
    s>javac -classpath c:\apache-tomcat-6.0.16\lib\servlet-api.jar VendServlet.java
    VendServlet.java:14: cannot find symbol
    symbol  : class RMACPModel
    location: class com.rajk.javacode.servlets.VendServlet
            RMACPModel n = new RMACPModel();
            ^
    VendServlet.java:14: cannot find symbol
    symbol  : class RMACPModel
    location: class com.rajk.javacode.servlets.VendServlet
            RMACPModel n = new RMACPModel();
                               ^
    2 errorsThe source package of all the files was com.rajk.javacode.servlets. And all the class files were there and i even checj that too. But still it shows error.Whats wrong with my Servlet File?

    Are all files placed in the same package/folder? Are all classes declared to belong to that package? Are you sure that you have typed the class name correct? (Java is case sensitive)
    Kaj

  • "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 with ArrayList

    Hi friends,
    i am using ArrayList in the servlet file inorder to store the resultset retrieved from DB. When i compile my program i got a error like this one.
    C:\apache-tomcat-6.0.16\webapps\rmanew\WEB-INF\classes\com\rajk\javacode\servlet
    s>javac -classpath c:\apache-tomcat-6.0.16\lib\servlet-api.jar *.java
    RMAEntryModel.java:385: cannot find symbol
    symbol  : method addElement(java.lang.Object)
    location: class java.util.ArrayList
                    pat.addElement(rs.getObject("date"));
                       ^
    RMAEntryModel.java:386: cannot find symbol
    symbol  : method addElement(java.lang.Object)
    location: class java.util.ArrayList
                    pat.addElement(rs.getObject("serial_no"));
                       ^
    RMAEntryModel.java:387: cannot find symbol
    symbol  : method addElement(java.lang.Object)
    location: class java.util.ArrayList
                    pat.addElement(rs.getObject("replaced_serial_no"));
                       ^
    RMAEntryModel.java:388: cannot find symbol
    symbol  : method addElement(java.lang.Object)
    location: class java.util.ArrayList
                    pat.addElement(rs.getObject("customer_inv_no"));
                       ^
    RMAEntryModel.java:389: cannot find symbol
    symbol  : method addElement(java.lang.Object)
    location: class java.util.ArrayList
                    pat.addElement(rs.getObject("fault_desc"));
                       ^
    RMAEntryModel.java:390: cannot find symbol
    symbol  : method addElement(java.lang.Object)
    location: class java.util.ArrayList
                    pat.addElement(rs.getObject("vendor_name"));
                       ^
    RMAEntryModel.java:403: cannot find symbol
    symbol  : method elementAt(int)
    location: class java.util.ArrayList
                       everyPat.addElement(pat.elementAt(k));
                                              ^
    RMAEntryModel.java:406: cannot find symbol
    symbol  : method addElement(java.util.ArrayList)
    location: class java.util.ArrayList
                   all.addElement(everyPat);
                      ^
    8 errorsWhat is the problem?... Any help will be appreciated

    Read the message. It cannot find the addElement() method on class java.util.ArrayList.
    Just consult the javadoc of the class used for details about the class: [http://java.sun.com/javase/6/docs/api/java/util/ArrayList.html].
    In the future, those kind of basic compilation errors (and runtime exceptions) rather belongs in the 'New to Java' forum. Those are really trival.

  • Cannot Find Symbol Error, please help.

    I am brand new to Java, so sorry if this question is obvious, but I keep receiving the following error when i try and compile the following code Circle.java
    Circle.java:17: cannot find symbol
    symbol : constructor Point()
    location: class pointClass.Point
    ^
    Circle.java:18: cannot find symbol
    symbol : method Point(double,double)
    location: class pointClass.Point
    super.Point(x,y); //set center to (x,y)
    ^
    2 errors
    I cant seem to figure out why I am getting this error, any help that anyone could provide would be greatly appreciated.
    This is the code for Circle.java:
    package circleClass;
    import pointClass.*;
    public class Circle extends Point
    private double radius; //Add a double radius field.
    public Circle()
    super(0,0); //call Point?s constructor initializing center to (0,0)
    radius = 0.0; //set radius to 0.0
    public Circle(double x, double y, double r)
    super.Point(x,y); //set center to (x,y)
    radius = r; //set radius to r
    public double r()
    return radius; //returns radius.
    public double getArea()
    return Math.PI*(radius*radius); //returns area of Circle object
    public double getCircumference()
    return 2*Math.PI*radius; //returns circumference of Circle object
    public String toString()
    return "center: ("+x+","+y+")"+"\nradius: "+r; //returns String that will give
    //output of the format...
    //center: (x,y)
    //radius: r
    If it helps, this is the code for pointClass:
    package pointClass;
    public class Point
    private double xcoor,ycoor;
    public static final Point ORIGIN = new Point();
    private Point()
    xcoor = 0;
    ycoor = 0;
    public Point(double x, double y)
    xcoor = x;
    ycoor = y;
    public double x()
    return xcoor;
    public double y()
    return ycoor;
    public String toString()
    return "(" + xcoor + "," + ycoor + ")";
    public static double distance(Point p, Point q)
    double dx = q.xcoor - p.xcoor;
    double dy = q.ycoor - p.ycoor;
    return Math.sqrt(dx*dx + dy*dy);
    Thanks for your help.

    {color:#000080}Both of your classes need to be in the same package, not each one in a package of its own. You have imported pointClass.Pont in Circle.java, but I don't think that's what you want to do. For a better understanding of packages, read{color}
    http://java.sun.com/docs/books/tutorial/java/package/index.html
    And post code like this:
    [code]CODE[/code] is displayed as CODE{color:#000080}db{color}

Maybe you are looking for

  • Acrobat 9.3.2 printing hidden fields automatically

    We have a few clients internally running Acrobat Standard 9.0.0 and their documents are printing fine. One user upgraded to 9.3.2, and now when they try and print some of our documents, a hidden field area is automatically printing. I can't seem to f

  • Just transferred all photos to MacBook pro

    Just transferred all photos in iPhoto library from imac to MacBook pro and when I click on some of the thumbnails it comes up with the triangle warning icon.  Can I fix this?

  • PEI to save username and password on login

    Hi, I need to replace the functionality that was in 4.5 to pass the username and password for authenticating to other systems, while using "Remember My Password". This functionality was removed from 5.x without a workaround. Support has recommened po

  • Enabling web sharing

    I'm trying to use web sharing but get a "Forbidden 403" message. I tried to implement the fix at http://support.apple.com/kb/TA25038?viewlocale=en_US but had the following problems: 1 - No prompt appeared as mentioned in step 6, 2- Terminal would not

  • Can't Run OC4J

    Yes, I need some help and there's no documentation regarding what exactly one must do. I installed OC4J on my win 2000 machine at work. I went ahead and execute the following command: java -jar oc4j.jar -install That went well. Now, I must run oc4j b