Output/Input Streams Cannot Resolve Symbol..

It is missing something, how do I declare the below 2 variables?
     //Get streams to send and receive data
     private void getSockStreams() throws IOException {
          //Set up output streams for objects
          output = new ObjectOutputStream(connection.getOutputStream());
          output.flush(); //Flush output buffer to send header information.
          //Set up input stream for objects.
          input = new ObjectInputStream(connection.getInputStream());
          displayMessage("Got I/O Streams");
     }Error:
C:\Documents and Settings\Moon\My Documents\Navi Projects\School\OOPJ Project\Prototype\GPS-Lite v2 Alpha Debugger\appinterface.java:74: cannot resolve symbol
symbol  : variable output
location: class appinterface
                output = new ObjectOutputStream(connection.getOutputStream());
                ^
C:\Documents and Settings\Moon\My Documents\Navi Projects\School\OOPJ Project\Prototype\GPS-Lite v2 Alpha Debugger\appinterface.java:75: cannot resolve symbol
symbol  : variable output
location: class appinterface
                output.flush(); //Flush output buffer to send header information.
                ^
C:\Documents and Settings\Moon\My Documents\Navi Projects\School\OOPJ Project\Prototype\GPS-Lite v2 Alpha Debugger\appinterface.java:78: cannot resolve symbol
symbol  : variable input
location: class appinterface
                input = new ObjectInputStream(connection.getInputStream());
                ^
3 errors
Process completed.

Same way you declare any variables in Java:ObjectOutputSream output;
output = ....
OR
ObjectOutputStream output = ...

Similar Messages

  • BufferedReader cannot resolve symbol

    Hi,
    I need some help with a java program which reads xml files to a specified location, running it on a UNIX machine using Java 1.4.1. I modified the code to include the BufferedReader class, but it keeps complaining about not being able to resolve symbol at line 50 & 53. Any help here would be appreciated, since I'm a newbie.
    bash-2.05$ javac outputScript.java
    outputScript.java:50: cannot resolve symbol
    symbol : constructor InputStreamReader (java.lang.String)
    location: class java.io.InputStreamReader
    BufferedReader in = new BufferedReader(new InputStreamReader("in"));
    ^
    outputScript.java:53: cannot resolve symbol
    symbol : method available ()
    location: class java.io.BufferedReader
    while (in.available() !=0)
    Here's the code:
    //package cognos8_3;
    import java.io.*;
    import java.io.InputStreamReader;
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.File;
    * outputScript.java
    * Copyright Cognos Incorporated. All Rights Reserved.
    * Cognos and the Cognos logo are trademarks of Cognos Incorporated.
    * Description: (KB 1013700) - Sample script that will rename output files generated by CM.OUTPUTLOCATION - Cognos 8.3
    class outputScript
    public static void main(String args[])
         String reportName = "";
         String reportViewName = "";
         String outputLocation = "/data/cognos/rn_filecp/";
         String defName = "";
         String ofTime = "";
         String burstKey = "";
         int countRenamed = 0;
         // get the list of desc files in the outputlocation
         File descFiles = new File(outputLocation);
         String[] children = descFiles.list();
         if (children == null || children.length == 0)
              System.out.println("Invalid file location or no reports found to rename.");
         else
                   System.out.println("Found " + children.length + " files in this location, search for file names containing '_desc.'.");
              for (int i=0; i<children.length; i++)
                   try
                        // Get filename of file or directory
                        String filename = children;
                        if (filename.indexOf("_desc.")>=0)
                             // Open the file that is the first
                             // command line parameter
                             FileInputStream fstream = new FileInputStream(outputLocation+filename);
                             FileInputStream bis = new FileInputStream(fstream);
                                  BufferedReader in = new BufferedReader(new InputStreamReader("bis.in"));
                             //      Continue to read lines while there are still some left to read
                             while (in.available() !=0)
                                  String temp = in.readLine();
                                  System.out.println(temp);
                                  // check for report name
                                  if (temp.indexOf("report[@name=")>0)
                                       // get beginning of name
                                       int startIndex = temp.indexOf("report[@name=&apos;");
                                       String startString;
                                       int endIndex = 0;
                                       if (startIndex > 0)
                                            startString = temp.substring(startIndex);
                                            startIndex = startString.indexOf("&apos;") + 5; //&apos; 6 characters
                                            endIndex = startString.lastIndexOf("&apos;");
                                       else
                                            startIndex = temp.indexOf("report[@name=");
                                            startString = temp.substring(startIndex);
                                            startIndex = startString.indexOf("@name=") + 6; //&apos; 6 characters
                                            endIndex = startString.lastIndexOf("]");
                                       // get report name
                                       reportName = startString.substring(startIndex+1, endIndex);
                                       //System.out.println("Found report name - " + reportName);
                                  else if (temp.indexOf("reportView[@name=")>0)
                                       // get beginning of name
                                       int startIndex = temp.indexOf("reportView[@name=&apos;");
                                       String startString;
                                       int endIndex = 0;
                                       if (startIndex > 0)
                                            startString = temp.substring(startIndex);
                                            startIndex = startString.indexOf("&apos;") + 5; //&apos; 6 characters
                                            endIndex = startString.lastIndexOf("&apos;");
                                       else
                                            startIndex = temp.indexOf("reportView[@name=");
                                            startString = temp.substring(startIndex);
                                            startIndex = startString.indexOf("@name=") + 6; //&apos; 6 characters
                                            endIndex = startString.lastIndexOf("]");
                                       // get report name
                                       reportViewName = startString.substring(startIndex+1, endIndex);
                                       //System.out.println("Found reportView name - " + reportViewName);
                                  else if (temp.indexOf("</fileName>")>0) //check for default name
                                       defName = temp.substring(temp.indexOf(">")+1, temp.lastIndexOf("<"));
                                  else if (temp.indexOf("asOfTime")>=0) // get the time to assure uniqueness when saving
                                       ofTime = temp.substring(temp.indexOf(">")+1, temp.lastIndexOf("<"));
                                       // clean colons from time
                                       ofTime = ofTime.replaceAll(":","_");
                                  else if (temp.indexOf("</burstKey>")>=0)
                                       burstKey = temp.substring(temp.indexOf(">")+1, temp.lastIndexOf("<"));
                             in.close();
                             if (reportName.length() == 0)
                                  reportName = reportViewName;
                                  //System.out.println("Renaming using view name - no report name found");
                                       String format = defName.substring(defName.length()-3, defName.length());
                             // new description xml file
                                       File file = new File(outputLocation+filename);
                             File newDescFile = new File(outputLocation + reportName+"_"+burstKey+"_"+ofTime+"DESC_" + format+ ".xml");
                                       // new renamed specific format file.
                             File file3 = new File(outputLocation+defName);
                             File newDefFile = new File(outputLocation + reportName+"_"+burstKey+"_"+ofTime+"."+format);
                             boolean success = file3.renameTo(newDefFile);
                             if (!success)
                                  // File was not successfully renamed
                                  System.out.println("ERROR attempting to rename - " + file3.getAbsolutePath() + " to \n\t\t" +
                                            newDefFile.getAbsolutePath());
                             else
                                  countRenamed++;
                                  // File was successfully renamed
                                  System.out.println(countRenamed +") Renamed - " + file3.getAbsolutePath() + " to \n\t\t" +
                                            newDefFile.getAbsolutePath());
                             // Rename file (or directory)
                             success = file.renameTo(newDescFile);
                             if (!success)
                                  // File was not successfully renamed
                                  System.out.println("ERROR attempting to rename - " + file.getAbsolutePath() + " to \n\t\t" +
                                            newDescFile.getAbsolutePath());
                             else
                                  // File was successfully renamed
                                  System.out.println(" - " + file.getAbsolutePath() + " to \n\t\t" +
                                            newDescFile.getAbsolutePath());
                   catch (Exception e)
                        System.err.println("File input error " + e.getMessage()) ;
         System.out.println("Complete.");
    Thanks,
    Nick
    Edited by: nickmills on Aug 31, 2008 5:05 PM

    First, you only need to create the FileInputStream once. Then that's what you pass to the InputStreamReader constructor. Your code for reading from the BufferedReader is also wrong.FileInputStream fstream = new FileInputStream(outputLocation+filename);
    // FileInputStream bis = new FileInputStream(fstream);  <-- remove this line
    BufferedReader in = new BufferedReader(new InputStreamReader(fstream));
    // available() doesn't do what you think it does; forget about it.
    // Here's the standard way to use a BufferedReader
    String line = null;
    while ((line = in.readLine()) != null)
      // process 'line'
    } There are probably other errors in the code, but reading all that unformatted code is too much of a hassle. In future, please use &#x7B;code} tags when posting source code.

  • Cannot resolve symbol - cannot resolve symbol

    I am importing import java.awt.Desktop in my java file, but while compiling i am getting the error as follows
    SslClient.java:10: cannot resolve symbol
    symbol : class Desktop
    location: package awt
    import java.awt.Desktop;
    ^
    SslClient.java:156: cannot resolve symbol
    symbol : class Desktop
    location: class SslClient
    Desktop desktop = null;
    ^
    I am having jdk 1.6.
    Edited by: johngrg on Jan 29, 2008 9:55 AM

    java -version
    java version "1.6.0_04"
    Java(TM) SE Runtime Environment (build 1.6.0_04-b12)
    Java HotSpot(TM) Client VM (build 10.0-b19, mixed mode, sharing)
    javac -version
    javac: invalid flag: -version
    Usage: javac <options> <source files>
    where possible options include:
    -g Generate all debugging info
    -g:none Generate no debugging info
    -g:{lines,vars,source} Generate only some debugging info
    -nowarn Generate no warnings
    -verbose Output messages about what the compiler is doing
    -deprecation Output source locations where deprecated APIs are used
    -classpath <path> Specify where to find user class files
    -sourcepath <path> Specify where to find input source files
    -bootclasspath <path> Override location of bootstrap class files
    -extdirs <dirs> Override location of installed extensions
    -d <directory> Specify where to place generated class files
    -encoding <encoding> Specify character encoding used by source files
    -source <release> Provide source compatibility with specified release
    -target <release> Generate class files for specific VM version
    -help Print a synopsis of standard options

  • Cannot resolve symbol error while trying to define methods in a class

    Well, I'm fairly new to java and I'm trying to write a simple program that will take user input for up to 100 die and how many sides they have and will then roll them and output the frequencies of numbers occuring. I have overloaded the constructor for the Die class to reflect different choices the user may have when initializing the Die.
    Here is my code:import java.util.*;
    import java.io.*;
    public class Die
         private final int MIN_FACES = 4;
         private int numFaces;
         private int i = 0;
         private int faceValue;
         private Die currentDie;
         private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
         private String line = null;
         public Die()
              numFaces = 6;
              faceValue = 1;
         public Die (int faces)
              if (faces < MIN_FACES) {
                   numFaces = 6;
                   System.out.println ("Minimum number of faces allowed is 6.");
                   System.out.println ("Setting faces to 6... . . .  .  .  .   .   .   .");
              else
                   numFaces = faces;
              faceValue = 1;
    //Returns an array of Die Objects
         public Die (int num_die, int faces)
              numFaces = faces;
              Die[] protoDie = new Die[num_die];
              for (i = 0; i <= num_die-1; i++)
                   Die currentDie = new Die(numFaces);
                   protoDie = protoDie.initMultiDie(currentDie, i);
         public Die (double num_die)
              int numberOfDie = (int) num_die;
              Die[] protoDie = new Die[numberOfDie];
              System.out.print ("Enter the number of sides for die #" + i);
              for (i=0; i <= protoDie.length; i++) {
              do {
                   try {
                        line = br.readLine();
                        numFaces = Integer.parseInt(line);
                   catch (NumberFormatException nfe) {
                        System.out.println ("You must enter an integer.");
                        System.out.print ("Setting number of dice to 0, please reenter: ");
                   if (numFaces < 0) {
                        System.out.println ("The number of sides must be positive.");
                        numFaces *= -1;
                        System.out.println ("Number of sides is: " + numFaces);
                   else
                      if (numFaces = 0) {
                        System.out.println ("Zero dice is no fun. =[");
                        System.out.print ("Please reenter the number of sides: ");
                   numFaces = 0;
              while (numFaces == 0);
              Die currentDie = new Die(numFaces);
              protoDie[i] = protoDie.initMultiDie(currentDie, i);
              i = 0;
         public Die[] initMultiDie (Die[] protoDie, Die currentDie, int i)
              protoDie[i] = currentDie;
              return protoDie;
         public Die reInit (int sides)
              currentDie.roll();
              return currentDie;
         public int roll()
              faceValue = (int) (Math.random() * numFaces) + 1;
              return faceValue;
    }When I compile I get 2 errors at lines 42 and 73 saying:
    Cannot resolve symbol | symbol: method initMultiDie(Die, int) | location: class Die[] | protoDie[i] = protoDie.initMultiDie(currentDie, i)
    I've tried mixing things up with invoking the method, such as including protoDie in the parameter liist, instead of invoking the initMultiDie method thru the protoDie Die[] object. I'm a little confused as to what I can and cannot do with defining arrays of Objects like Die. Thank you for any input you may be able to provide.
    ~Lije

    I may as well just replace Die with Dice and allow
    Dice to represent a collection of 1 die.. I just like
    to cut on bloat and make my programs be as efficient
    as possible.Efficiency and avoiding code bloat are good goals, but you don't necessarily achieve it by creating the smallest number of classes. If you have N algorithms in M lines, then you have that many, regardless of whether they're in one class or two. A really long source file can be a worse example of bloat than two source files of half the size -- it can be harder to read, less clear in the design, and thus with more bugs...
    The important thing is clarity and a strong design.
    The weird thing is, that initMultiDie is
    what seems to be throwing up the error, but I don't
    see why. Meh, I'm sure I'll figure it out.Refactoring a class to make the design more transparent often helps you figure out bugs.

  • Please?!? Cannot Resolve Symbol Error Message

    //Elizabeth Skelton Section 001 Homework Set 3
    import javax.swing.JOptionPane;
    public class skeltonMaxofThree
         public static void main (String[] args)
              //ask user for numbers
              String stringnum1= JOptionPane.showInputDialog(null, "Please enter first number", "Input", JOptionPane.QUESTION_MESSAGE);
              String stringnum2=JOptionPane.showInputDialog(null, "Please enter second number", "Input", JOptionPane.QUESTION_MESSAGE);
              String stringnum3=JOptionPane.showInputDialog(null, "Please enter third number", "Input", JOptionPane.QUESTION_MESSAGE);
              //convert to numerical
              double num1=Double.parseDouble(stringnum1);
              double num2=Double.parseDouble(stringnum2);
              double num3=Double.parseDouble(stringnum3);
              //call max method
              double biggest=maximum(num1,num2,num3);
              //display answer
              String output = "The biggest is " + biggest;
              JOptionPane.showMessageDialog(null, output, "Result", JOptionPane.INFORMATION_MESSAGE);
              System.exit(0);
         public static double maximum(double num1, double num2, double num3)
              //determine biggest
              double biggest=Math.max(num1,num2,num3);
              return biggest;
    Returns error:
    :\My Documents\BD120\skeltonMaxofThree.java:36: cannot resolve symbol
    symbol : method max (double,double,double)
    location: class java.lang.Math
              double biggest=Math.max(num1,num2,num3);
    ^
    1 error
    Tool completed with exit code 1

    the max method of the Math class requires 2 parameters not 3...to find the maximum of 3 numbers u can do something like this...
    double biggest = Math.max(num1, Math.max(num2, num3));

  • Visual Studio 2012 cannot resolve symbol or Errors control is not a member of class

    Visual Studio 2012 Web Site Project (Note not a Web application, so there are not Designer.vb files) > Site works perfectly fine and using IIS and attaching to IIS to debug code.
    However, if I try to build the site inside of Visual Studio I am getting lots of Errors ‘pnlName’ is not a member of ‘Page_Name’ In the code behind I am getting errors ‘Cannot resolve symbol ‘pnlName’
    .ascx Page
    <li style="margin-right:0;" id="pnlName" runat="server"><a href="/cart" title="Checkout" class="global-checkout">Checkout</a></li>
    .ascx.vb page
    Me.pnlName.Attributes.Remove("style")
    I have cleaned, rebuild and nothing gets rid of these errors, but again the site works as designed, but I would like to launch and debug inside of Visual Studio.
    Moojjoo MCP, MCTS
    MCP Virtual Business Card
    http://moojjoo.blogspot.com

    Cor,
    What I am stating is this is a solution using the Web Site Project instead of a
    Web Application Project.
    Web Site projects do not require Designer.vb files, Web Application Projects add Designer.vb files in the solution.   
    Background: I have been hired to support a very successful e-commerce site that was built by a 3rd party vendor (I had no input on the contract or specification, because I would have went with
    MVC).  The site works 100% correctly, however from my 2003 - 2015 experience with Visual Studio and Web Development being in Web Forms and MVC I have always built ASP.NET Solutions using the Web Application Project Templates, which compiles the code down
    to .dlls.  
    A Web Site project does not compile the code, but simply uses the .vb files and they have to be migrated to the server with the .aspx files. http://msdn.microsoft.com/en-us/library/dd547590%28v=vs.110%29.aspx
    Currently the only way I can debug this Solution is to attach to the w3wp.exe process running locally on my work station. 
    The Solution is comprised of two Web Sites, which I cannot get it to compile because of the following errors -
     'webServerControlName' is not a member of '(Protected Code Behind Class Name)'  I am reaching out to the MSDN community to see if anyone has experienced this issue with
    Web Site Projects.
    I hope that clears up the Project Type question.
    Moojjoo MCP, MCTS
    MCP Virtual Business Card
    http://moojjoo.blogspot.com

  • Solaris Deployment Failure for cannot resolve symbol on PersistentContainer

    Hello, I'm having trouble diagnosing the following deployment failure.
    What are some common causes of this? My server was created using an
    Express Integration domain with some custom JMS destinations added
    afterwards via the console. I am deploying an application built with
    Workshop (straight from workshop). I copied over an application from
    Windows to Solaris, deleted the .workshop directory and .beabuild.txt
    and rebuilt the application to deploy.
    I get this error a few times.
    ####<Aug 21, 2003 10:48:19 AM EDT> <Info> <EJB> <rhino> <cgServer>
    <ExecuteThread: '1' for queue: 'weblogic.kernel.System'> <<WLS Kernel>>
    <> <BEA-012033> <Compiling generated EJB classes produced the following
    Java compiler output:
    /export/data/ident/bea/user_projects/domains/ident1Server.conf/./cgServer/.wlnotdelete/EJBCompilerCache/-7dxi2hv35mro/com/bea/wlwgen/PersistentContainer_3fq3ar_Impl.java:143:
    cannot resolve symbol
    symbol : class BMPContainerBean$DuplicateKeyRemoteException
    location: package bean
    perchance you meant 'BMPContainerBean.DuplicateKeyRemoteException'
    throws
    com.bea.wlw.runtime.core.bean.BMPContainerBean$DuplicateKeyRemoteException
    ^
    1 error
    This then causes other errors repeating that the deployment failed (let
    me know if you need more to diagnose this):
    Exception:weblogic.management.ApplicationException: prepare failed for
    .workshop/myApp/EJB/myProc_1trtqtoxcz4uv
    Module: .workshop/myApp/EJB/myProc_1trtqtoxcz4uv Error:
    Exception preparing module:
    EJBModule(.workshop/myApp/EJB/myProc_1trtqtoxcz4uv,status=NEW)
    Unable to deploy EJB: .workshop/myApp/EJB/myProc_1trtqtoxcz4uv from
    .workshop/myApp/EJB/myProc_1trtqtoxcz4uv:
    Compiler failed executable.exec

    But by default WLS8.1 comes with jdk141_02 ...correct ?
    AND what i understand is that...the bug you posted is related to a bug in jdk1.4.2
    ....correct ??
    correct me if i wrong.
    -sangita
    Steven Ostrowski <[email protected]> wrote:
    It looks like this is a bug in the BEA-generated code that is then
    compiled by WLS. The generated code was using the Class1$Class2 notation
    to reference the class, but since $ is a valid character in the class
    name, this does not behave as intended. This used to be a bug in
    pre-1.4.2 but is now fixed in 1.4.2 (look at bug 4635044, and this is
    also mentioned in the 1.4.2 release notes and the Java Developer forums).
    The generated code should be:
    com.bea.wlw.runtime.core.bean.BMPContainerBean.DuplicateKeyRemoteException
    not
    com.bea.wlw.runtime.core.bean.BMPContainerBean$DuplicateKeyRemoteException
    Thanks again for the good response. I'll send this in to BEA support.
    Steven Ostrowski wrote:
    One other thing to add, this was fixed by changing the JAVA_HOME
    variable inside of the startWeblogic.sh script. Setting it in workshop
    did not change anything.
    Steven Ostrowski wrote:
    Wow, you hit it right on target! I was using 1.4.2 then tried it on
    1.4.1_03 and it deployed fine.
    Is this a bug in BEA or in the JDK? In either case, where should I
    report this bug?
    Thanks again
    Rob Woollen wrote:
    What version of the JDK are you using? I believe they changed the
    inner class naming conventions in 1.4.2, and it's breaking lots of
    people.
    -- Rob
    Steven Ostrowski wrote:
    Hello, I'm having trouble diagnosing the following deployment
    failure. What are some common causes of this? My server was created
    using an Express Integration domain with some custom JMS
    destinations added afterwards via the console. I am deploying an
    application built with Workshop (straight from workshop). I copied
    over an application from Windows to Solaris, deleted the .workshop
    directory and .beabuild.txt and rebuilt the application to deploy.
    I get this error a few times.
    ####<Aug 21, 2003 10:48:19 AM EDT> <Info> <EJB> <rhino> <cgServer>
    <ExecuteThread: '1' for queue: 'weblogic.kernel.System'> <<WLS
    Kernel>> <> <BEA-012033> <Compiling generated EJB classes produced
    the following Java compiler output:
    /export/data/ident/bea/user_projects/domains/ident1Server.conf/./cgServer/.wlnotdelete/EJBCompilerCache/-7dxi2hv35mro/com/bea/wlwgen/PersistentContainer_3fq3ar_Impl.java:143:
    cannot resolve symbol
    symbol : class BMPContainerBean$DuplicateKeyRemoteException
    location: package bean
    perchance you meant 'BMPContainerBean.DuplicateKeyRemoteException'
    throws
    com.bea.wlw.runtime.core.bean.BMPContainerBean$DuplicateKeyRemoteException
    ^
    1 error
    This then causes other errors repeating that the deployment failed
    (let me know if you need more to diagnose this):
    Exception:weblogic.management.ApplicationException: prepare failed
    for .workshop/myApp/EJB/myProc_1trtqtoxcz4uv
    Module: .workshop/myApp/EJB/myProc_1trtqtoxcz4uv Error:
    Exception preparing module:
    EJBModule(.workshop/myApp/EJB/myProc_1trtqtoxcz4uv,status=NEW)
    Unable to deploy EJB: .workshop/myApp/EJB/myProc_1trtqtoxcz4uv from
    .workshop/myApp/EJB/myProc_1trtqtoxcz4uv:
    Compiler failed executable.exec

  • HELP PLEASE Cannot resolve symbol error

    Only just started to atempt simple java programs and this same error keeps appearing. code i am using is:
    import java.io.*;
    class Q1
         public static void main(String[] args) throws IOException
              int num1,num2,sum;
              /*program statements start here*/
         System.out.printIn ("Input a number");
                   num1= Course_io.readInt();
              System.out.printIn ("Input another number");
                   num2= Course_io.readInt();
                   sum= num2 - num1;
              System.out.printIn ("Total is" +sum );
    and this is the error message i keep getting:
    javac -d . -g "C:\Java Programs\Q1.java"
    C:\Java Programs\Q1.java:12: cannot resolve symbol
    symbol : method printIn (java.lang.String)
    location: class java.io.PrintStream
    System.out.printIn ("Input a number");
    ^
    C:\Java Programs\Q1.java:16: cannot resolve symbol
    symbol : method printIn (java.lang.String)
    location: class java.io.PrintStream
    System.out.printIn ("Input another number");
    ^
    C:\Java Programs\Q1.java:22: cannot resolve symbol
    symbol : method printIn (java.lang.String)
    location: class java.io.PrintStream
    System.out.printIn ("Total is" +sum );
    ^
    3 errors
    Please help me, Thankyou.

    sum= num2 - num1;
    System.out.printIn ("Total is" +sum );While you're at it, do something about this, it's misleading.
    kind regards,
    Jos

  • Error: Cannot Resolve symbol

    Hi i have written this program but it is not compling properly. i do not know what to do to sort it. here is the code:
    import java.sql.*;
    import java.io.DataInputStream;
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    public class Phase1 extends JFrame implements ActionListener, MouseListener
         //Create Buttons and Text areas etc for the GUI itself
         JButton add, current, delete, order, all, exit;
         JTextField textStockCode, textStockDesc, textCurrentLevel, textReorderLevel, textPrice;
         JTextArea textarea;
         JScrollPane pane1;
         JLabel labelStockCode, labelStockDesc, labelCurrentLevel, labelReorderLevel, labelPrice, labelTextArea;
         String stockCode, stockDesc, currentLevel, reorderLevel, price;
         JLabel welcome;
         //Setup database connections and statements for later use
         Connection db_connection;
         Statement db_statement;
         public Phase1()
              //Display a welcome message before loading system onto the screen
              JOptionPane.showMessageDialog(null, "Welcome to the Stock Control System");
              //set up the GUI environment to use a grid layout
              Container content=this.getContentPane();
              content.setLayout(new GridLayout(3,6));
              //Inititlise buttons
              add=new JButton("Add");
              add.addActionListener(this);
              current=new JButton("Show Current Level");
              current.addActionListener(this);
              delete=new JButton("Delete");
              delete.addActionListener(this);
              order=new JButton("Place Order");
              order.addActionListener(this);
              all = new JButton("Show All Entries");
              all.addActionListener(this);
              exit = new JButton("Exit");
              exit.addActionListener(this);
              //Add Buttons to the layout
              content.add(add);
              content.add(current);
              content.add(delete);
              content.add(order);
              content.add(all);
              content.add(exit);
              //Initialise text fields for inputting data to the database and
              //Add mouse listeners to clear the boxs on a click event
              textStockCode = new JTextField("");
              textStockCode.addMouseListener(this);
              textStockDesc = new JTextField("");
              textStockDesc.addMouseListener(this);
              textCurrentLevel = new JTextField("");
              textCurrentLevel.addMouseListener(this);
              textReorderLevel = new JTextField("");
              textReorderLevel.addMouseListener(this);
              textPrice = new JTextField("");
              textPrice.addMouseListener(this);
              //Initialise the labels to label the Text Fields
              labelStockCode = new JLabel("Stock Code");
              labelStockDesc = new JLabel("Stock Description");
              labelCurrentLevel = new JLabel("Current Level");
              labelReorderLevel = new JLabel("Re-Order Level");
              labelPrice = new JLabel("Price");
              labelTextArea = new JLabel("All Objects");
              //Add Text fields and labels to the GUI
              content.add(labelStockCode);
              content.add(textStockCode);
              content.add(labelStockDesc);
              content.add(textStockDesc);
              content.add(labelCurrentLevel);
              content.add(textCurrentLevel);
              content.add(labelReorderLevel);
              content.add(textReorderLevel);
              content.add(labelPrice);
              content.add(textPrice);
              content.add(labelTextArea);
              //Create a text area with scroll bar for showing Entries in the text area
              textarea=new JTextArea();
              textarea.setRows(6);
              pane1=new JScrollPane(textarea);
              content.add(pane1);
              //Try to connect to the database through ODBC
              try
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
                   //Create a URL that identifies database
                   String url = "jdbc:odbc:" + "stock";
                   //Now attempt to create a database connection
                   //First parameter data source, second parameter user name, third paramater
                   //password, the last two paramaters may be entered as "" if no username or
                   //pasword is used
                   db_connection = DriverManager.getConnection(url, "demo","");
                   //Create a statement to send SQL
                   db_statement = db_connection.createStatement();
              catch (Exception ce){} //driver not found
         //action performed method for button click events
         public void actionPerformed(ActionEvent ev)
              if(ev.getSource()==add)               //If add button clicked
                   try
                        add();                         //Run add() method
                   catch(Exception e){}
              if(ev.getSource()==current)
              {     //If Show Current Level Button Clicked
                   try
                        current();                    //Run current() method
                   catch(Exception e){}
              if(ev.getSource()==delete)
              {          //If Show Delete Button Clicked
                   try
                        delete();                    //Run delete() method
                   catch(Exception e){}
              if(ev.getSource()==order)          //If Show Order Button Clicked
                   try
                        order();                    //Run order() method
                   catch(Exception e){}
              if(ev.getSource()==all)          //If Show Show All Button Clicked
                   try
                        all();                         //Run all() method
                   catch(Exception e){}
              if(ev.getSource()==exit)          //If Show Exit Button Clicked
                   try{
                        exit();                         //Run exit() method
                   catch(Exception e){}
         public void add() throws Exception           //add a new stock item
              stockCode = textStockCode.getText();
              stockDesc = textStockDesc.getText();
              currentLevel = textCurrentLevel.getText();
              reorderLevel = textReorderLevel.getText();
              price = textPrice.getText();
              if(stockCode.equals(""))
                   JOptionPane.showMessageDialog(null,"Ensure Stock Code is filled out");
              if(stockDesc.equals(""))
                             JOptionPane.showMessageDialog(null,"Ensure Description is filled out");
              if(price.equals(""))
                   JOptionPane.showMessageDialog(null,"Ensure price is filled out");
              if(currentLevel.equals(""))
                   JOptionPane.showMessageDialog(null,"Ensure Current Level is filled out");
              if(reorderLevel.equals(""))
                   JOptionPane.showMessageDialog(null,"Ensure Re-Order Level is filled out");
              else
                   //Add item to database with variables set from text fields
                   db_statement.executeUpdate("INSERT INTO stock VALUES
    ('"+stockCode+"','"+stockDesc+"','"+currentLevel+"','"+reorderLevel+"','"+price+"')");
         public void current() throws Exception      //check a current stock level
              if(textStockCode.getText().equals(""))//if no stockcode has been entered
                   JOptionPane.showMessageDialog(null,"Enter a Stock Code.");
              else
                   ResultSet resultcurrent = db_statement.executeQuery("SELECT * FROM stock WHERE StockCode = '"+textStockCode.getText()+"'");
                   textarea.setText("");
                   if(resultcurrent.next())
                        do
                             textarea.setText("Stock Code: "+resultcurrent.getString("StockCode")+"\nDescription:
    "+resultcurrent.getString("StockDescription")+"\nCurrent Level: "+resultcurrent.getInt("CurrentLevel")+"\nRe-Order Level:
    "+resultcurrent.getInt("ReorderLevel")+"\nPrice: "+resultcurrent.getFloat("Price"));
                        while(resultcurrent.next());
                   else
                        //Display Current Stock Item (selected from StockCode Text field in the scrollable text area
                        JOptionPane.showMessageDialog(null,"Not a valid Stock Code");
         public void delete() throws Exception          //delete a current stock item
              if(textStockCode.getText().equals(""))          //Check there is a stock code entered
                   JOptionPane.showMessageDialog(null,"Enter a Stock Code.");
              else
                   //Delete Item from database where Stock Code is what is in Stock Code Text Field
                   db_statement.executeUpdate("DELETE * FROM stock WHERE StockCode='"+textStockCode.getText()+"'");
         public void order() throws Exception           //check price for an order
              if(textStockCode.getText().equals(""))          //Check there is a stock code entered
                   JOptionPane.showMessageDialog(null,"Enter a Stock Code.");
              else
                   //Set some variables to aid ordering
                   float price = 0;
                   int currentlevel = 0;
                   int newlevel = 0;
                   int reorder = 0;
                   String StockCode = textStockCode.getText();
                   //Post a message asking how many to order
                   String str_quantity = JOptionPane.showInputDialog(null,"Enter Quantity: ","Adder",JOptionPane.PLAIN_MESSAGE);
                   int quantity = Integer.parseInt(str_quantity);
                   //Get details from database for current item
                   ResultSet resultorder = db_statement.executeQuery("SELECT * FROM stock WHERE StockCode='"+StockCode+"'");
                   //Set variables from database to aid ordering
                   while (resultorder.next())
                        price = resultorder.getFloat("Price");
                        currentlevel = (resultorder.getInt("CurrentLevel"));
                        reorder = (resultorder.getInt("ReorderLevel"));
                   //Set the new level to update the database
                   newlevel = currentlevel - quantity;
                   //calculate the total price of the order
                   float total = price * quantity;
                   //If the stock quantity is 0
                   if(quantity == 0)
                        //Display a message saying there are none left in stock
                        JOptionPane.showMessageDialog(null,"No Stock left for this item");
                   //Otherwise check that the quantity ordered is more than what is lewft in stock
                   else if(quantity > currentlevel)
                        //If ordered too many display a message saying so
                        JOptionPane.showMessageDialog(null,"Not enough in stock, order less");
                   else
                        //Otherwise Display the total in a message box
                        JOptionPane.showMessageDialog(null,"Total is: "+total);
                        //then update the database with new values
                        db_statement.executeUpdate("UPDATE Stock SET CurrentLevel="+newlevel+" WHERE StockCode='"+StockCode+"'");
                        //Check if the new level is 0
                        if(newlevel == 0)
                             //If new level IS 0, send a message to screen saying so
                             JOptionPane.showMessageDialog(null,"There is now no Stock left.");
                        else
                             //otherwise if the newlevel of stock is the same as the reorder level
                             if(newlevel == reorder)
                                  // display a message to say so
                                  JOptionPane.showMessageDialog(null,"You are now at the re-order level, Get some more of this item in
    stock.");
                             //Otherwise if the new level is lower than the reorder level,
                             if(newlevel < reorder)
                                  //Display a message saying new level is below reorder level so get some more stock
                                  JOptionPane.showMessageDialog(null,"You are now below the reorder level. Get some more of this item in
    stock.");
         public void all() throws Exception                //show all stock items and details
              //Get everthing from the database
              ResultSet resultall = db_statement.executeQuery("SELECT * FROM Stock");
              textarea.setText("");
              while (resultall.next())
                   //Display all items of stock in the Text Area one after the other
                   textarea.setText(textarea.getText()+"Stock Code: "+resultall.getString("StockCode")+"\nDescription:
    "+resultall.getString("StockDescription")+"\nCurrent Level: "+resultall.getInt("CurrentLevel")+"\nRe-Order Level:
    "+resultall.getInt("ReorderLevel")+"\nPrice: "+resultall.getFloat("Price")+"\n\n");
         public void exit() throws Exception           //exit
              //Cause the system to close the window, exiting.
              db_connection.commit();
              db_connection.close();
              System.exit(0);
         public static void main(String args[])
              //Initialise a frame
              JDBCFrame win=new JDBCFrame();
              //Set the size to 800 pixels wide and 350 pixels high
              win.setSize(900,350);
              //Set the window as visible
              win.setVisible(true);
              win.addWindowListener(new WindowAdapter()
                   public void windowClosing(WindowEvent e)
                        System.exit(0);
         //Mouse Listener Commands
         public void mousePressed(MouseEvent evt)
              if (evt.getSource()==textStockCode)
                   //Clear the Stock Code text field on clickin on it
                   textStockCode.setText("");
              else if (evt.getSource()==textStockDesc)
                   //Clear the Stock Description text field on clickin on it
                   textStockDesc.setText("");
              else if (evt.getSource()==textCurrentLevel)
                   textCurrentLevel.setText("");
                   //Clear the Current Level text field on clickin on it
              else if (evt.getSource()==textReorderLevel)
                   textReorderLevel.setText("");
                   //Clear the Re-Order Level text field on clickin on it
              else if (evt.getSource()==textPrice)
                   textPrice.setText("");
                   //Clear the Price text field on clickin on it
         public void mouseReleased(MouseEvent evt){}
         public void mouseClicked(MouseEvent evt){}
         public void mouseEntered(MouseEvent evt){}
         public void mouseExited(MouseEvent evt){}
    }And this is the error that i get when compiling:
    Phase1.java:355: cannot resolve symbol
    symbol  : class JDBCFrame
    location: class Phase1
                    JDBCFrame win=new JDBCFrame();
                    ^
    Phase1.java:355: cannot resolve symbol
    symbol  : class JDBCFrame
    location: class Phase1
                    JDBCFrame win=new JDBCFrame();Thanks for any help you can give me

    The error is very clear here
    Phase1.java:355: cannot resolve symbolsymbol : class JDBCFramelocation: class Phase1 JDBCFrame win=new JDBCFrame();
    Where is this class JDBCFrame()?
    Import that package or class

  • Sequential.java [28:1] cannot resolve symbol

    The program asks users to enter random numbers.They are stored in a vector. The numbers are then added and the results of the addition stored in an vector.ie
    sum1=item1
    sum2=item1+item2
    sum3=item1+item2+item3
    sumn=item1+item2+,,,,,+itemn
    here is the program
    import java.util.Vector;
    import java.io.*;
    public class Sequential {
    /** Creates a new instance of Sequential */
    public Sequential() {
    public static int inputInt(String str){
    BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
    System.out.println(str);
    int val;
    try{
    val = Integer.parseInt(input.readLine());
    }catch(Exception e){}
    return val;
    public static void main (String args[]){
    //initialising
    Vector myarray = new Vector();
    Vector sum = new Vector();
    int ans = 0;
    int dim;
    dim = inputInt("Enter the array dimension");
    //populate the
    for(int i=0; i < dim; i++){
    myarray.add(i,inputInt("Enter the array dimension"));
    for(int i=0; i < dim; i++ ){
    ans = Integer.parseInt(myarray.get(i)) + ans;
    sum.add(i,ans);
    for(int i=0; i < dim; i++){
    System.out.println("Item [" + i + "] is " + sum.get(i));
    it dispalys on ".add" part
    Sequential.java [28:1] cannot resolve symbol in
    myarray.add(i,inputInt("Enter the array dimension"));

    Vectors store objects, not primitives.
    Try the Integer wrapper class, e.g. myarray.add(i, new Integer(inputInt("Enter the array dimension")));
    There are some other code problems I think you'll notice, but you should be able to work those out.

  • Cannot find package error and cannot resolve symbol error

    Hi
    I have a file Assignment.java in C:\TIJCode\c03 folder. But this file belongs to the default package. This file imports a package com.bruceeckel.simpletest which is in C:\TIJCode\ folder. Now this package has a file named Test.java which accesses a few more files fromt he same package.
    I set the classpath to C:\TIJCode. When i try to run the Assignment file I get an error saying package com.bruceeckel.simpletest cannot be found and cannot resolve symbol error. symbol: Test Class: Assignment.
    The files in com.bruceeckel.simpletest package were not compiled. So I first tried to do that. But I get a cannot resolve symbol error while trying to compile a file NumOfLinesException which inherits SImpleTestException file. The exact error message is
    NumOfLinesException.java : 7 : cannot resolve symbol
    symbol : class SimpleTestException
    location : class com.bruceeckel.simpletest.NumOfLinesException extends SimpleTestException
    The exact code in each of above mentioned files is
    //: c03:Assignment.java
    // Assignment with objects is a bit tricky.
    // From 'Thinking in Java, 3rd ed.' (c) Bruce Eckel 2002
    // www.BruceEckel.com. See copyright notice in CopyRight.txt.
    import com.bruceeckel.simpletest.*;
    class Number {
    int i;
    public class Assignment {
    static Test monitor = new Test();
    public static void main(String[] args) {
    Number n1 = new Number();
    Number n2 = new Number();
    n1.i = 9;
    n2.i = 47;
    System.out.println("1: n1.i: " + n1.i +
    ", n2.i: " + n2.i);
    n1 = n2;
    System.out.println("2: n1.i: " + n1.i +
    ", n2.i: " + n2.i);
    n1.i = 27;
    System.out.println("3: n1.i: " + n1.i +
    ", n2.i: " + n2.i);
    monitor.expect(new String[] {
    "1: n1.i: 9, n2.i: 47",
    "2: n1.i: 47, n2.i: 47",
    "3: n1.i: 27, n2.i: 27"
    } ///:~
    //: com:bruceeckel:simpletest:SimpleTestException.java
    // From 'Thinking in Java, 3rd ed.' (c) Bruce Eckel 2002
    // www.BruceEckel.com. See copyright notice in CopyRight.txt.
    package com.bruceeckel.simpletest;
    public class SimpleTestException extends RuntimeException {
    public SimpleTestException(String msg) {
    super(msg);
    } ///:~
    //: com:bruceeckel:simpletest:NumOfLinesException.java
    // From 'Thinking in Java, 3rd ed.' (c) Bruce Eckel 2002
    // www.BruceEckel.com. See copyright notice in CopyRight.txt.
    package com.bruceeckel.simpletest;
    public class NumOfLinesException extends SimpleTestException {
    public NumOfLinesException(int exp, int out) {
    super("Number of lines of output and "
    + "expected output did not match.\n" +
    "expected: <" + exp + ">\n" +
    "output: <" + out + "> lines)");
    } ///:~
    //: com:bruceeckel:simpletest:Test.java
    // Simple utility for testing program output. Intercepts
    // System.out to print both to the console and a buffer.
    // From 'Thinking in Java, 3rd ed.' (c) Bruce Eckel 2002
    // www.BruceEckel.com. See copyright notice in CopyRight.txt.
    package com.bruceeckel.simpletest;
    import java.io.*;
    import java.util.*;
    import java.util.regex.*;
    public class Test {
    // Bit-shifted so they can be added together:
    public static final int
    EXACT = 1 << 0, // Lines must match exactly
    AT_LEAST = 1 << 1, // Must be at least these lines
    IGNORE_ORDER = 1 << 2, // Ignore line order
    WAIT = 1 << 3; // Delay until all lines are output
    private String className;
    private TestStream testStream;
    public Test() {
    // Discover the name of the class this
    // object was created within:
    className =
    new Throwable().getStackTrace()[1].getClassName();
    testStream = new TestStream(className);
    public static List fileToList(String fname) {
    ArrayList list = new ArrayList();
    try {
    BufferedReader in =
    new BufferedReader(new FileReader(fname));
    try {
    String line;
    while((line = in.readLine()) != null) {
    if(fname.endsWith(".txt"))
    list.add(line);
    else
    list.add(new TestExpression(line));
    } finally {
    in.close();
    } catch (IOException e) {
    throw new RuntimeException(e);
    return list;
    public static List arrayToList(Object[] array) {
    List l = new ArrayList();
    for(int i = 0; i < array.length; i++) {
    if(array[i] instanceof TestExpression) {
    TestExpression re = (TestExpression)array;
    for(int j = 0; j < re.getNumber(); j++)
    l.add(re);
    } else {
    l.add(new TestExpression(array[i].toString()));
    return l;
    public void expect(Object[] exp, int flags) {
    if((flags & WAIT) != 0)
    while(testStream.numOfLines < exp.length) {
    try {
    Thread.sleep(1000);
    } catch (InterruptedException e) {
    throw new RuntimeException(e);
    List output = fileToList(className + "Output.txt");
    if((flags & IGNORE_ORDER) == IGNORE_ORDER)
    OutputVerifier.verifyIgnoreOrder(output, exp);
    else if((flags & AT_LEAST) == AT_LEAST)
    OutputVerifier.verifyAtLeast(output,
    arrayToList(exp));
    else
    OutputVerifier.verify(output, arrayToList(exp));
    // Clean up the output file - see c06:Detergent.java
    testStream.openOutputFile();
    public void expect(Object[] expected) {
    expect(expected, EXACT);
    public void expect(Object[] expectFirst,
    String fname, int flags) {
    List expected = fileToList(fname);
    for(int i = 0; i < expectFirst.length; i++)
    expected.add(i, expectFirst[i]);
    expect(expected.toArray(), flags);
    public void expect(Object[] expectFirst, String fname) {
    expect(expectFirst, fname, EXACT);
    public void expect(String fname) {
    expect(new Object[] {}, fname, EXACT);
    } ///:~

    What do you have in the C:\TIJCode\ directory? Does the directory structure mimic the package structure for the stuff you're importing?

  • Cannot resolve symbol..Swing / MDI

    I'm somewhat new to Java.
    I have an MDI app that I am creating. The main routine is in DeskTop.java.
    When DeskTop.class is run:
    1)Main creates a generic UserID class from userID.java( has two private strings and 4 methods to get userid, passwd, and set userid, passwd).
    This info will be used throughout the app to connect to various MySQL Dbs.
    2)Main creates the main application JFrame and a JMenu.
    One of the JMenuItems, named Logon creates a JInternalFrame (basically a login box with userid and password field and JButton called continue. An ActionPerformed is added to a continue JButton.
    There are many other JInternalFrames on the menu that have various DB functions.
    I need to have the action performed on the ActionEvent of the continue button access the UserID class and it's setUserID() and setPasswd() methods and set the (uid, pw) fields in the object. Yet anytime I try to access this object from the Logon object, I get a Cannot resolve symbol:
    This is a summary of the action performed on the continue button:
    uid = txt_userID.getText();
    userid = new String(uid).trim();
    pw = pw_password.getPassword();
    password = new String(pw).trim();
    UserID.setUserID(userid); /*UserID is the other object.Error is on*/
    UserID.setPasswd(password); /*the decimal point.*/
    All objects have a public constructor and the methods I am trying access are declared public.
    Files consist of (all in same directory):
    DeskTop.java (main JFRAME)
    PasswordBox.java ( JInternalFrame)
    UserIDPW.java (JInternalFrame)
    AddCompany.java (JInternalFrame)
    etc. ( other JInternalFrames)
    etc. ( other classes)
    Thanks for any input. If someone has a better method of making a MDI database app in Java, some info would be great.
    There will be other classes outside the gui. I am trying to build the business logic and the gui as seperate as I can.

    This may sound silly to ask, but without seeing all
    the code in this case you can imagine it's difficult
    to say - I presume that UserID is a class (ie a
    template for an object) rather than an object itself
    and that setUserID, setPasswd are static functions.
    The files you list dont include a UserID.java, so this
    means you haven't got a PUBLIC class called UserID
    (you may have one with private or package / friendly
    access) - hence you can't access it from outside. I am
    new myself - but this looks a likely candidate. [ I
    try to answer questions so that I can learn myself,
    but now I am off to bed!]Thank for the reply.
    The main function creates a public UserID object and it created the main gui JFrame DeskTop object. UserID has a public constructor and public methods.
    main function:
    public static void main(String args[]) {
    userIDPW userID = new userIDPassword();
    JFrame f = new DeskTop();
    Dimension screensize = Toolkit.getDefaultToolkit().getScreenSize();
    f.setSize(screensize);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setVisible(true);
    The DeskTop object has a JMenuitem in it called Login, it opens an InternalJFrame called PasswordBox.
    PasswordBox takes a userid and pw and then it needs to send the userid and pw to the userID object with two of its methods:
    Methods in userID object:
    public void setUserID(String userid)
    { this.userid = userid; }
    public void setPasswd(String passwd)
    ( this.passwd = passwd; }
    How doed one access this object (userID)? I have tried (from the PasswordBox) with no success:
    uid = txt_userID.getText();
    userid = new String(uid).trim();
    pw = pw_password.getPassword();
    password = new String(pw).trim();
    userID.setUserID(userid); --this fails, with Cannot resolve symbol
    userID.setPasswd(password); --this fails, with Cannot resolve symbol

  • Very annoying "cannot resolve symbol" error

    I have 2 classes, an Item class and a Storefront class. The Storefront class uses the Item class. The item class compiles fine but when I try to compile the Storefront.java class i get the following errors.
    C:\J21WORK\DAY6EXS>javac Storefront.java
    Storefront.java:16: cannot resolve symbol
    symbol : class Item
    location: class J21Work.Day6Exs.Storefront
    public Item getItem(int i) {
    ^
    Storefront.java:12: cannot resolve symbol
    symbol : class Item
    location: class J21Work.Day6Exs.Storefront
    Item it = new Item(id, name, price, quant);
    ^
    Storefront.java:12: cannot resolve symbol
    symbol : class Item
    location: class J21Work.Day6Exs.Storefront
    Item it = new Item(id, name, price, quant);
    ^
    Storefront.java:17: cannot resolve symbol
    symbol : class Item
    location: class J21Work.Day6Exs.Storefront
    return (Item)catalog.get(i);
    ^
    4 errors
    C:\J21WORK\DAY6EXS>
    the source code for Item.java is:
    package J21Work.Day6Exs;
    import java.util.*;
    public class Item implements Comparable {
    private String id;
    private String name;
    private double retail;
    private int quantity;
    private double price;
    Item(String idIn, String nameIn, String retailIn, String quanIn) {
    id = idIn;
    name = nameIn;
    retail = Double.parseDouble(retailIn);
    quantity = Integer.parseInt(quanIn);
    if (quantity > 400)
    price = retail * .5D;
    else if (quantity > 200)
    price = retail * .6D;
    else
    price = retail * .7D;
    price = Math.floor( price * 100 + .5 ) / 100;
    public int compareTo(Object obj) {
    Item temp = (Item)obj;
    if (this.price < temp.price)
    return 1;
    else if (this.price > temp.price)
    return -1;
    return 0;
    public String getId() {
    return id;
    public String getName() {
    return name;
    public double getRetail() {
    return retail;
    public int getQuantity() {
    return quantity;
    public double getPrice() {
    return price;
    the source code for Storefront.java is:
    package J21Work.Day6Exs;
    import java.util.*;
    public class Storefront {
    private LinkedList catalog = new LinkedList();
    public void addItem(String id, String name, String price,
    String quant) {
    Item it = new Item(id, name, price, quant);
    catalog.add(it);
    public Item getItem(int i) {
    return (Item)catalog.get(i);
    public int getSize() {
    return catalog.size();
    public void sort() {
    Collections.sort(catalog);
    my classpath is set to: .;C:\j2sdk1.4.1_01\lib\tools.jar;C:\J21Work\Day6Exs;.
    ne help wpuld be greatly appreciated..thanks everyone

    hi there partners i also having the same problems i looked each line very carefully but cant find the way out my code is :
    package com.dsta.aims.pinmailer.notifier;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.util.Properties;
    import com.activcard.aims.event.AIMSEvent;
    import com.activcard.aims.event.AIMSEventAdapter;
    import com.dsta.aims.pinmailer.AimsDeviceDb;
    public class PinMailerNotifier extends AIMSEventAdapter {
         // Plugin information
         private final static String version = "1.0";
         private final static String name = "com.dsta.aims.pinmailer";
         // The name of the properties file
         final static String PROPERTIES_FILE = "pin_mailer.properties";
         // The names of the properties we look for
         private final static String CONF_DATABASE_FILE="DatabaseFile";
         private final static String CONF_LOG_FILE="LogFile";
         // Default property values
         private final static String DEF_DATABASE_FILE="cuids.db";
         private final static String DEF_LOG_FILE=null;
         private AimsDeviceDb db;
         private String log_file;
         private String db_file;
         * Log function to send some output to a log file. This is really just needed
         * for debuging/testing when making changes to this plugin. Should not
         * be needed in production.
         * @param msg Message to log
         private void log(String msg)
              if (log_file == null) {
                   return;
              String newline = System.getProperty("line.separator");
              FileWriter fout ;
              try {
                   fout = new FileWriter(log_file, true);
                   fout.write(msg + newline);
                   fout.flush();
                   fout.close();
              } catch (IOException e1) {
                   // nothing
         public void init() {
              Properties conf = new Properties();
              try {
                   conf.load(getClass().getClassLoader().getResourceAsStream(PROPERTIES_FILE));
              } catch (Exception e) {
                   log("Unable to load properties file:" + PROPERTIES_FILE);
              log_file = conf.getProperty(CONF_LOG_FILE, DEF_LOG_FILE);
              db_file = conf.getProperty(CONF_DATABASE_FILE, DEF_DATABASE_FILE);
              log("Init " + name + "/" + version + ": database is " + db_file);
              String jdbc_name = "jdbc:sqlite:/" + db_file;
              db = new AimsDeviceDb();
              if (!db.openDatabase(jdbc_name)) {
                   log("Failed to open the database " + jdbc_name);
                   db = null;
                   // TODO: What should we do here?
              } else {
                   log("Opened the database " + jdbc_name);
         public void onDeviceEventReceived(AIMSEvent event) {
              log("--> Event for Device");
              // check that this is a device issue and/or unlock event
              if (event.getEventID() != AIMSEvent.EVENT_ISSUE_DEVICE &&
                   event.getEventID() != AIMSEvent.EVENT_UNLOCK_DEVICE) {
                        log("... wrong event type");
                        return;
              // check that the status is succesfull
              if (event.getStatus() != 0) {
                   log("... wrong status");
                   return;
              // If issue event check that it a permanent card
              if (event.getEventID() == AIMSEvent.EVENT_ISSUE_DEVICE &&
                   event.getAdditionalInfoNum1() != 0) {
                        log("... not a perm card");
                        return;
              // store event in database
              String device_id = event.getClientID();
              String device_type = event.getAdditionalInfoChar1();
              log("... Ok. Add to database" + device_id + "/" + device_type);
              db.insert(device_id, device_type);
         public void onUserEventReceived(AIMSEvent event) {
              log("--> Event for User");
         public void onRequestEventReceived(AIMSEvent event) {
              log("--> Event for Request");
         public void onCredentialEventReceived(AIMSEvent event) {
              log("--> Event for Credential");
         public void onEventReceived(AIMSEvent event) {
              log("--> Event");
         public void onAuthenticationEventReceived(AIMSEvent evt) {
              log("--> Event for Authentication");
         public String getVersion()     {
              return version;
         public String getName() {
              return name;
    and have such error :
    E:\unzip-pinmailer\com\dsta\aims\pinmailer\notifier\PinMailerNotifier.java:20: cannot resolve symbol
    symbol : class AIMSEvent
    location: package event
    import com.activcard.aims.event.AIMSEvent;
    ^
    E:\unzip-pinmailer\com\dsta\aims\pinmailer\notifier\PinMailerNotifier.java:21: cannot resolve symbol
    symbol : class AIMSEventAdapter
    location: package event
    import com.activcard.aims.event.AIMSEventAdapter;
    ^
    E:\unzip-pinmailer\com\dsta\aims\pinmailer\notifier\PinMailerNotifier.java:22: cannot resolve symbol
    symbol : class AimsDeviceDb
    location: package pinmailer
    import com.dsta.aims.pinmailer.AimsDeviceDb;
    ^
    E:\unzip-pinmailer\com\dsta\aims\pinmailer\notifier\PinMailerNotifier.java:34: cannot resolve symbol
    symbol : class AIMSEventAdapter
    location: class com.dsta.aims.pinmailer.notifier.PinMailerNotifier
    public class PinMailerNotifier extends AIMSEventAdapter {
    ^
    E:\unzip-pinmailer\com\dsta\aims\pinmailer\notifier\PinMailerNotifier.java:47: cannot resolve symbol
    symbol : class AimsDeviceDb
    location: class com.dsta.aims.pinmailer.notifier.PinMailerNotifier
         private AimsDeviceDb db;
    ^
    E:\unzip-pinmailer\com\dsta\aims\pinmailer\notifier\PinMailerNotifier.java:104: cannot resolve symbol
    symbol : class AIMSEvent
    location: class com.dsta.aims.pinmailer.notifier.PinMailerNotifier
         public void onDeviceEventReceived(AIMSEvent event) {
    ^
    E:\unzip-pinmailer\com\dsta\aims\pinmailer\notifier\PinMailerNotifier.java:138: cannot resolve symbol
    symbol : class AIMSEvent
    location: class com.dsta.aims.pinmailer.notifier.PinMailerNotifier
         public void onUserEventReceived(AIMSEvent event) {
    ^
    E:\unzip-pinmailer\com\dsta\aims\pinmailer\notifier\PinMailerNotifier.java:145: cannot resolve symbol
    symbol : class AIMSEvent
    location: class com.dsta.aims.pinmailer.notifier.PinMailerNotifier
         public void onRequestEventReceived(AIMSEvent event) {
    ^
    E:\unzip-pinmailer\com\dsta\aims\pinmailer\notifier\PinMailerNotifier.java:152: cannot resolve symbol
    symbol : class AIMSEvent
    location: class com.dsta.aims.pinmailer.notifier.PinMailerNotifier
         public void onCredentialEventReceived(AIMSEvent event) {
    ^
    E:\unzip-pinmailer\com\dsta\aims\pinmailer\notifier\PinMailerNotifier.java:159: cannot resolve symbol
    symbol : class AIMSEvent
    location: class com.dsta.aims.pinmailer.notifier.PinMailerNotifier
         public void onEventReceived(AIMSEvent event) {
    ^
    E:\unzip-pinmailer\com\dsta\aims\pinmailer\notifier\PinMailerNotifier.java:166: cannot resolve symbol
    symbol : class AIMSEvent
    location: class com.dsta.aims.pinmailer.notifier.PinMailerNotifier
         public void onAuthenticationEventReceived(AIMSEvent evt) {
    ^
    E:\unzip-pinmailer\com\dsta\aims\pinmailer\notifier\PinMailerNotifier.java:81: cannot resolve symbol
    symbol : method getClass ()
    location: class com.dsta.aims.pinmailer.notifier.PinMailerNotifier
                   conf.load(getClass().getClassLoader().getResourceAsStream(PROPERTIES_FILE));
    ^
    E:\unzip-pinmailer\com\dsta\aims\pinmailer\notifier\PinMailerNotifier.java:91: cannot resolve symbol
    symbol : class AimsDeviceDb
    location: class com.dsta.aims.pinmailer.notifier.PinMailerNotifier
              db = new AimsDeviceDb();
    ^
    E:\unzip-pinmailer\com\dsta\aims\pinmailer\notifier\PinMailerNotifier.java:108: cannot resolve symbol
    symbol : variable AIMSEvent
    location: class com.dsta.aims.pinmailer.notifier.PinMailerNotifier
              if (event.getEventID() != AIMSEvent.EVENT_ISSUE_DEVICE &&
    ^
    E:\unzip-pinmailer\com\dsta\aims\pinmailer\notifier\PinMailerNotifier.java:109: cannot resolve symbol
    symbol : variable AIMSEvent
    location: class com.dsta.aims.pinmailer.notifier.PinMailerNotifier
                   event.getEventID() != AIMSEvent.EVENT_UNLOCK_DEVICE) {
    ^
    E:\unzip-pinmailer\com\dsta\aims\pinmailer\notifier\PinMailerNotifier.java:121: cannot resolve symbol
    symbol : variable AIMSEvent
    location: class com.dsta.aims.pinmailer.notifier.PinMailerNotifier
              if (event.getEventID() == AIMSEvent.EVENT_ISSUE_DEVICE &&
    ^
    16 errors
    Tool completed with exit code 1
    plz plz reply me asap and thanx in advance what the hell is wrong with this code

  • Illegal start of expression and cannot resolve symbol HELP

    Can someone pls help me?
    These are the two problems:
    --------------------Configuration: j2sdk1.4.1_02 <Default>--------------------
    C:\Documents and Settings\Laila\My Documents\CMT2080\Coursework\Game\Mindboggler.java:291: illegal start of expression
    public void inputJButtonActionPerformed( ActionEvent event )
    ^
    C:\Documents and Settings\Laila\My Documents\CMT2080\Coursework\Game\Mindboggler.java:285: cannot resolve symbol
    symbol: method inputJButtonActionPerformed (java.awt.event.ActionEvent)
                   inputJButtonActionPerformed( event);
    Here is my code :
    //Mind boggler quiz
    //Marcelyn Samson
    import java.awt.*;
    import java.awt.event.*;
    import java.text.DecimalFormat;
    import javax.swing.*;
    import javax.swing.border.*;
    import java.lang.*;
    public class Mindboggler extends JFrame
              // JPanel for welcome window
              private JPanel welcomeJPanel;
              private JPanel presetJPanel;
         private JLabel titleJLabel;
         private JLabel quizJLabel;
         private JLabel girlJLabel, headJLabel;
         private JLabel introJLabel;
         private JButton startJButton;
         // JPanel for questionone window
         private JPanel questiononeJPanel;
         private JLabel textJLabel;
         private JPanel becksJPanel;
         private JButton oneJButton, twoJButton, threeJButton, fourJButton, nextJButton;
              //JPanel for questiontwo window
              private JPanel questiontwoJPanel;
              private JPanel orlandoJPanel;
              private JLabel q2JLabel;
              private JCheckBox lordJCheckBox;
              private JCheckBox faceJCheckBox;
              private JCheckBox piratesJCheckBox;
              private JButton next2JButton;
         private JButton inputJButton;
         //JPanel for questionthree
         private JPanel questionthreeJPanel;
         private JPanel howmuchJPanel;
         private JLabel howmuchJLabel;
         private JLabel nameJLabel;
         private JTextField nameJTextField;
         private JLabel moneyJLabel;
         private JTextField moneyJTextField;
         private JButton next3JButton;
         //Publics
         public JPanel welcomeJFrame, questionJFrame, questiontwoJFrame, questionthreeJFrame;
         //contentPane
              public Container contentPane;
              //no argument constructor
              public Mindboggler()
                   createUserInterface();
              //create and position components
              private void createUserInterface()/////////////////////////; semo colon do not edit copy paste
                   //get contentPane and set layout to null
                   contentPane = getContentPane();
                   contentPane.setLayout ( null );
                   welcome();
                   //set properties of applications window
                   setTitle( "Mindboggler" ); // set JFrame's title bar string
              setSize( 600, 400 ); // set width and height of JFrame
              setVisible( true ); // display JFrame on screen
              } // end method createUserInterface
              public void welcome(){
                        // set up welcomeJPanel
                   welcomeJPanel = new JPanel();
                   welcomeJPanel.setLayout( null );
                   welcomeJPanel.setBounds(0, 0, 600, 400);
                   welcomeJPanel.setBackground( Color.GREEN );
                   // set up textJLabel
                   titleJLabel = new JLabel();
                   titleJLabel.setText( "Mind Boggler" );
                   titleJLabel.setLocation( 30, 10);
                   titleJLabel.setSize( 550, 70);
                   titleJLabel.setFont( new Font( "SansSerif", Font.PLAIN, 30 ) );
                   titleJLabel.setHorizontalAlignment( JLabel.CENTER );
                   welcomeJPanel.add( titleJLabel );
                   // set up presetJPanel
                   presetJPanel = new JPanel();
                   presetJPanel.setLayout( null );
                   presetJPanel.setBounds( 150, 10, 300, 80 );
                   presetJPanel.setBackground( Color.GRAY );
                   welcomeJPanel.add( presetJPanel );
                   //setup Intro JLabel
                   introJLabel = new JLabel();
                   introJLabel.setText( "Think, think, think. Can you get all the questions right?" );
                   introJLabel.setBounds( 40, 100, 500, 200 );
                   introJLabel.setFont( new Font( "SansSerif", Font.PLAIN, 18 ) );
                   introJLabel.setHorizontalAlignment( JLabel.CENTER );
                   welcomeJPanel.add(introJLabel);
                   //set up head JLabel
                   headJLabel = new JLabel();
                   headJLabel.setIcon( new ImageIcon( "head.jpeg") );
                   headJLabel.setBounds( 540, 5, 40, 160 );
                   headJLabel.setHorizontalAlignment( JLabel.CENTER );
                   welcomeJPanel.add(headJLabel);
                        //setup girlJLabel
                   girlJLabel = new JLabel();
                   girlJLabel.setIcon( new ImageIcon( "girl.Jjpeg") );
                   girlJLabel.setBounds( 5, 10, 60, 100 );
                   girlJLabel.setHorizontalAlignment( JLabel.CENTER );
                   welcomeJPanel.add(girlJLabel);
                        //set up startJbutton
                   startJButton = new JButton();
                   startJButton.setText( "Start" );
                   startJButton.setBounds(250, 300, 100, 30);
                   startJButton.setFont( new Font( "SansSerif", Font.BOLD, 14) );
                   welcomeJPanel.add(startJButton);
                   contentPane.add(welcomeJPanel);
                   startJButton.addActionListener(
                        new ActionListener(){
                             public void actionPerformed(ActionEvent e){
                                  question();
              public void question()
                   //set up question one JPanel
                   welcomeJPanel.setVisible(false);
                   questiononeJPanel = new JPanel();
         questiononeJPanel.setLayout( null );
              questiononeJPanel.setBounds(0, 0, 600,400);
              questiononeJPanel.setBackground( Color.GREEN );
              // set up textJLabel
              textJLabel = new JLabel();
              textJLabel.setText( "Who did Beckham supposedly cheat with?" );
              textJLabel.setLocation( 20, 20);
              textJLabel.setSize( 550, 70);
              textJLabel.setFont( new Font( "SansSerif", Font.BOLD, 20 ) );
              textJLabel.setHorizontalAlignment( JLabel.CENTER );
              questiononeJPanel.add( textJLabel );
                   // set up presetJPanel
              becksJPanel = new JPanel();
              becksJPanel.setLayout( null );
              becksJPanel.setBorder( new TitledBorder(
         "Question 1" ) );
              becksJPanel.setBounds( 10, 10, 570, 80 );
              becksJPanel.setBackground( Color.GRAY );
              questiononeJPanel.add( becksJPanel );
                   // set up oneJButton
              oneJButton = new JButton();
              oneJButton.setBounds( 10, 120, 300, 40 );
              oneJButton.setText( "Britney Spears" );
              oneJButton.setBackground( Color.ORANGE );
              questiononeJPanel.add( oneJButton );
              // set up twoJButton
              twoJButton = new JButton();
              twoJButton.setBounds( 10, 180, 300, 40 );
              twoJButton.setText( "Meg Ryan" );
              twoJButton.setBackground( Color.ORANGE );
              questiononeJPanel.add( twoJButton );
              // set up threeJButton
              threeJButton = new JButton();
              threeJButton.setBounds( 10, 240, 300, 40 );
              threeJButton.setText( "Rebecca Loos" );
              threeJButton.setBackground( Color.ORANGE );
              questiononeJPanel.add( threeJButton );
              // set up fourJButton
              fourJButton = new JButton();
              fourJButton.setBounds( 10, 300, 300, 40 );
              fourJButton.setText( "Angelina Jolie" );
              fourJButton.setBackground( Color.ORANGE );
              questiononeJPanel.add( fourJButton );
                   // set up nextJButton
                   nextJButton = new JButton();
                   nextJButton.setBounds ( 375, 300, 150, 40 );
                   nextJButton.setText("Next");
                   nextJButton.setBackground( Color.GRAY );
                   questiononeJPanel.add( nextJButton );
                   contentPane.add(questiononeJPanel);
              nextJButton.addActionListener(
                        new ActionListener(){
                             public void actionPerformed(ActionEvent e){
                                  questiontwo();
              public void questiontwo()
                   //set up question two JPanel
                   questiononeJPanel.setVisible(false);
                   questiontwoJPanel=new JPanel();
                   questiontwoJPanel.setLayout(null);
                   questiontwoJPanel.setBounds(0, 0, 600, 400);
                   questiontwoJPanel.setBackground( Color.GREEN );
                   // set up q2JLabel
              q2JLabel = new JLabel();
              q2JLabel.setBounds( 20, 20, 550, 70 );
              q2JLabel.setText( "What films has Orlando Bloom starred in?" );
              q2JLabel.setFont(new Font( "SansSerif", Font.BOLD, 20 ) );
         q2JLabel.setHorizontalAlignment( JLabel.CENTER );
    questiontwoJPanel.add(q2JLabel);
    //set up orlandoJPanel
    orlandoJPanel = new JPanel();
    orlandoJPanel.setLayout(null);
    orlandoJPanel.setBorder( new TitledBorder("Question 2"));
    orlandoJPanel.setBounds( 10, 10, 570, 80);
    orlandoJPanel.setBackground(Color.GRAY);
    questiontwoJPanel.add(orlandoJPanel);
    // set up lordJCheckBox
              lordJCheckBox = new JCheckBox();
              lordJCheckBox.setBounds( 16, 112, 200, 24 );
              lordJCheckBox.setText( "1. Lord of The Rings" );
              questiontwoJPanel.add( lordJCheckBox );
                   // set up faceJCheckBox
              faceJCheckBox = new JCheckBox();
              faceJCheckBox.setBounds( 16, 159, 200, 24 );
              faceJCheckBox.setText( "2. Face Off" );
              questiontwoJPanel.add( faceJCheckBox );
              // set up piratesJCheckBox
              piratesJCheckBox = new JCheckBox();
              piratesJCheckBox.setBounds( 16, 206, 200, 24 );
              piratesJCheckBox.setText( "3. Pirates of The Caribean" );
              questiontwoJPanel.add( piratesJCheckBox );
              // set up inputJButton
              inputJButton = new JButton();
              inputJButton.setBounds(20, 256, 200, 21 );
              inputJButton.setText( "Input answer" );
              questiontwoJPanel.add( inputJButton );
    inputJButton.addActionListener(
         new ActionListener()
              //event handler called when user clicks inputJButton
              public void actionPerformed( ActionEvent event )
                   inputJButtonActionPerformed( event);
    //show JOptionMessages when user clicks on JCheckBoxes and inputJButton
    public void inputJButtonActionPerformed( ActionEvent event )
         //display error message if no JCheckBoxes is checked
         if ( ( !lordJCheckBox.isSelected() && !faceJCheckBox.isSelected() && !piratesJCheckBox.isSelected() ) )
              //display error message
              JOptionPane.showMessageDialog( null, "Please check two boxes", JOptionPane.ERROR_MESSAGE );
         // if lordjcheckbox and pirates is selected = right
         else
              if ( ( lordJCheckBox.isSelected() && piratesJCheckBox.isSelected() ))
                   JOptionPane.showMessageDialog(null, "Thats RIGHT!");
              //if others are selected = wrong
              else
                   if ( (lordJCheckBox.isSelected() && faceJCheckBox.isSelected() ))
                        JOptionPane.showMessageDialog(null, "Thats WRONG");
                   else
                        ( (faceJCheckBox.isSelected() && piratesJCheckBox.isSelected() ))
                             JOptionPane.showMessageDialog(null, "Thats WRONG");
    // set up nest2JButton
              next2JButton = new JButton();
              next2JButton.setBounds( 155, 296, 94, 24 );
              next2JButton.setText( "Next" );
              questiontwoJPanel.add( next2JButton );
    contentPane.add(questiontwoJPanel);
    next2JButton.addActionListener(
         new ActionListener(){
              public void actionPerformed(ActionEvent e){
                   questionthree();
    } // end questiontwo
    public void questionthree()
         //setup questionthree JPanel
         questiontwoJPanel.setVisible(false);
         questionthreeJPanel = new JPanel();
         questionthreeJPanel.setLayout(null);
         questionthreeJPanel.setBounds(0, 0, 600, 400);
         questionthreeJPanel.setBackground( Color.GREEN);
              // main method
              public static void main( String[] args )
              Mindboggler application = new Mindboggler();
              application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
              } // end method main
    }// end class
    WOULD BE VERY GEATFUL

    Just want to say thank you by the way for trying to help. Ive moved public void inputJButtonActionPerformed( ActionEvent event ) outside of brackets. Now i have a different problem on it. Sorry about this.
    PROBLEM: --------------------Configuration: <Default>--------------------
    C:\Documents and Settings\Laila\My Documents\CMT2080\Coursework\Game\Mindboggler.java:353: 'else' without 'if'
    else ( ( !lordJCheckBox.isSelected() && !faceJCheckBox.isSelected && !piratesJCheckBox.isSelected() ) )
    ^
    1 error
    Process completed.
    MY CODE:
    //Mind boggler quiz
    //Marcelyn Samson
    import java.awt.*;
    import java.awt.event.*;
    import java.text.DecimalFormat;
    import javax.swing.*;
    import javax.swing.border.*;
    import java.lang.*;
    public class Mindboggler extends JFrame
              // JPanel for welcome window
              private JPanel welcomeJPanel;
              private JPanel presetJPanel;
         private JLabel titleJLabel;
         private JLabel quizJLabel;
         private JLabel girlJLabel, headJLabel;
         private JLabel introJLabel;
         private JButton startJButton;
         // JPanel for questionone window
         private JPanel questiononeJPanel;
         private JLabel textJLabel;
         private JPanel becksJPanel;
         private JButton oneJButton, twoJButton, threeJButton, fourJButton, nextJButton;
              //JPanel for questiontwo window
              private JPanel questiontwoJPanel;
              private JPanel orlandoJPanel;
              private JLabel q2JLabel;
              private JCheckBox lordJCheckBox;
              private JCheckBox faceJCheckBox;
              private JCheckBox piratesJCheckBox;
              private JButton next2JButton;
         private JButton inputJButton;
         //JPanel for questionthree
         private JPanel questionthreeJPanel;
         private JPanel howmuchJPanel;
         private JLabel howmuchJLabel;
         private JLabel nameJLabel;
         private JTextField nameJTextField;
         private JLabel moneyJLabel;
         private JTextField moneyJTextField;
         private JButton next3JButton;
         //Publics
         public JPanel welcomeJFrame, questionJFrame, questiontwoJFrame, questionthreeJFrame;
         //contentPane
              public Container contentPane;
              //no argument constructor
              public Mindboggler()
                   createUserInterface();
              //create and position components
              private void createUserInterface()/////////////////////////; semo colon do not edit copy paste
                   //get contentPane and set layout to null
                   contentPane = getContentPane();
                   contentPane.setLayout ( null );
                   welcome();
                   //set properties of applications window
                   setTitle( "Mindboggler" ); // set JFrame's title bar string
              setSize( 600, 400 ); // set width and height of JFrame
              setVisible( true ); // display JFrame on screen
              } // end method createUserInterface
              public void welcome(){
                        // set up welcomeJPanel
                   welcomeJPanel = new JPanel();
                   welcomeJPanel.setLayout( null );
                   welcomeJPanel.setBounds(0, 0, 600, 400);
                   welcomeJPanel.setBackground( Color.GREEN );
                   // set up textJLabel
                   titleJLabel = new JLabel();
                   titleJLabel.setText( "Mind Boggler" );
                   titleJLabel.setLocation( 30, 10);
                   titleJLabel.setSize( 550, 70);
                   titleJLabel.setFont( new Font( "SansSerif", Font.PLAIN, 30 ) );
                   titleJLabel.setHorizontalAlignment( JLabel.CENTER );
                   welcomeJPanel.add( titleJLabel );
                   // set up presetJPanel
                   presetJPanel = new JPanel();
                   presetJPanel.setLayout( null );
                   presetJPanel.setBounds( 150, 10, 300, 80 );
                   presetJPanel.setBackground( Color.GRAY );
                   welcomeJPanel.add( presetJPanel );
                   //setup Intro JLabel
                   introJLabel = new JLabel();
                   introJLabel.setText( "Think, think, think. Can you get all the questions right?" );
                   introJLabel.setBounds( 40, 100, 500, 200 );
                   introJLabel.setFont( new Font( "SansSerif", Font.PLAIN, 18 ) );
                   introJLabel.setHorizontalAlignment( JLabel.CENTER );
                   welcomeJPanel.add(introJLabel);
                   //set up head JLabel
                   headJLabel = new JLabel();
                   headJLabel.setIcon( new ImageIcon( "head.jpeg") );
                   headJLabel.setBounds( 540, 5, 40, 160 );
                   headJLabel.setHorizontalAlignment( JLabel.CENTER );
                   welcomeJPanel.add(headJLabel);
                        //setup girlJLabel
                   girlJLabel = new JLabel();
                   girlJLabel.setIcon( new ImageIcon( "girl.Jjpeg") );
                   girlJLabel.setBounds( 5, 10, 60, 100 );
                   girlJLabel.setHorizontalAlignment( JLabel.CENTER );
                   welcomeJPanel.add(girlJLabel);
                        //set up startJbutton
                   startJButton = new JButton();
                   startJButton.setText( "Start" );
                   startJButton.setBounds(250, 300, 100, 30);
                   startJButton.setFont( new Font( "SansSerif", Font.BOLD, 14) );
                   welcomeJPanel.add(startJButton);
                   contentPane.add(welcomeJPanel);
                   startJButton.addActionListener(
                        new ActionListener(){
                             public void actionPerformed(ActionEvent e){
                                  question();
              public void question()
                   //set up question one JPanel
                   welcomeJPanel.setVisible(false);
                   questiononeJPanel = new JPanel();
         questiononeJPanel.setLayout( null );
              questiononeJPanel.setBounds(0, 0, 600,400);
              questiononeJPanel.setBackground( Color.GREEN );
              // set up textJLabel
              textJLabel = new JLabel();
              textJLabel.setText( "Who did Beckham supposedly cheat with?" );
              textJLabel.setLocation( 20, 20);
              textJLabel.setSize( 550, 70);
              textJLabel.setFont( new Font( "SansSerif", Font.BOLD, 20 ) );
              textJLabel.setHorizontalAlignment( JLabel.CENTER );
              questiononeJPanel.add( textJLabel );
                   // set up presetJPanel
              becksJPanel = new JPanel();
              becksJPanel.setLayout( null );
              becksJPanel.setBorder( new TitledBorder(
         "Question 1" ) );
              becksJPanel.setBounds( 10, 10, 570, 80 );
              becksJPanel.setBackground( Color.GRAY );
              questiononeJPanel.add( becksJPanel );
                   // set up oneJButton
              oneJButton = new JButton();
              oneJButton.setBounds( 10, 120, 300, 40 );
              oneJButton.setText( "Britney Spears" );
              oneJButton.setBackground( Color.ORANGE );
              questiononeJPanel.add( oneJButton );
              // set up twoJButton
              twoJButton = new JButton();
              twoJButton.setBounds( 10, 180, 300, 40 );
              twoJButton.setText( "Meg Ryan" );
              twoJButton.setBackground( Color.ORANGE );
              questiononeJPanel.add( twoJButton );
              // set up threeJButton
              threeJButton = new JButton();
              threeJButton.setBounds( 10, 240, 300, 40 );
              threeJButton.setText( "Rebecca Loos" );
              threeJButton.setBackground( Color.ORANGE );
              questiononeJPanel.add( threeJButton );
              // set up fourJButton
              fourJButton = new JButton();
              fourJButton.setBounds( 10, 300, 300, 40 );
              fourJButton.setText( "Angelina Jolie" );
              fourJButton.setBackground( Color.ORANGE );
              questiononeJPanel.add( fourJButton );
                   // set up nextJButton
                   nextJButton = new JButton();
                   nextJButton.setBounds ( 375, 300, 150, 40 );
                   nextJButton.setText("Next");
                   nextJButton.setBackground( Color.GRAY );
                   questiononeJPanel.add( nextJButton );
                   contentPane.add(questiononeJPanel);
              nextJButton.addActionListener(
                        new ActionListener(){
                             public void actionPerformed(ActionEvent e){
                                  questiontwo();
              public void questiontwo()
                   //set up question two JPanel
                   questiononeJPanel.setVisible(false);
                   questiontwoJPanel=new JPanel();
                   questiontwoJPanel.setLayout(null);
                   questiontwoJPanel.setBounds(0, 0, 600, 400);
                   questiontwoJPanel.setBackground( Color.GREEN );
                   // set up q2JLabel
              q2JLabel = new JLabel();
              q2JLabel.setBounds( 20, 20, 550, 70 );
              q2JLabel.setText( "What films has Orlando Bloom starred in?" );
              q2JLabel.setFont(new Font( "SansSerif", Font.BOLD, 20 ) );
         q2JLabel.setHorizontalAlignment( JLabel.CENTER );
    questiontwoJPanel.add(q2JLabel);
    //set up orlandoJPanel
    orlandoJPanel = new JPanel();
    orlandoJPanel.setLayout(null);
    orlandoJPanel.setBorder( new TitledBorder("Question 2"));
    orlandoJPanel.setBounds( 10, 10, 570, 80);
    orlandoJPanel.setBackground(Color.GRAY);
    questiontwoJPanel.add(orlandoJPanel);
    // set up lordJCheckBox
              lordJCheckBox = new JCheckBox();
              lordJCheckBox.setBounds( 16, 112, 200, 24 );
              lordJCheckBox.setText( "1. Lord of The Rings" );
              questiontwoJPanel.add( lordJCheckBox );
                   // set up faceJCheckBox
              faceJCheckBox = new JCheckBox();
              faceJCheckBox.setBounds( 16, 159, 200, 24 );
              faceJCheckBox.setText( "2. Face Off" );
              questiontwoJPanel.add( faceJCheckBox );
              // set up piratesJCheckBox
              piratesJCheckBox = new JCheckBox();
              piratesJCheckBox.setBounds( 16, 206, 200, 24 );
              piratesJCheckBox.setText( "3. Pirates of The Caribean" );
              questiontwoJPanel.add( piratesJCheckBox );
              // set up inputJButton
              inputJButton = new JButton();
              inputJButton.setBounds(20, 256, 200, 21 );
              inputJButton.setText( "Input answer" );
              questiontwoJPanel.add( inputJButton );
    inputJButton.addActionListener(
         new ActionListener()
              //event handler called when user clicks inputJButton
              public void actionPerformed( ActionEvent event )
                   inputJButtonActionPerformed( event);
    // set up nest2JButton
              next2JButton = new JButton();
              next2JButton.setBounds( 155, 296, 94, 24 );
              next2JButton.setText( "Next" );
              questiontwoJPanel.add( next2JButton );
    contentPane.add(questiontwoJPanel);
    next2JButton.addActionListener(
         new ActionListener(){
              public void actionPerformed(ActionEvent e){
                   questionthree();
    } // end questiontwo
    public void questionthree()
         //setup questionthree JPanel
         questiontwoJPanel.setVisible(false);
         questionthreeJPanel = new JPanel();
         questionthreeJPanel.setLayout(null);
         questionthreeJPanel.setBounds(0, 0, 600, 400);
         questionthreeJPanel.setBackground( Color.GREEN);
         //setup howmuchJLabel
         howmuchJLabel = new JLabel();
         howmuchJLabel.setText("I'm a student and would be very greatful if you could donate some money as it would help me very much.");
         howmuchJLabel.setBounds(20, 20, 550, 70);
         howmuchJLabel.setFont(new Font("SansSerif",Font.BOLD,14));
         howmuchJLabel.setHorizontalAlignment(JLabel.CENTER);
         questionthreeJPanel.add(howmuchJLabel);
         //setup howmuchJPanel
         howmuchJPanel = new JPanel();
         howmuchJPanel.setLayout(null);
         howmuchJPanel.setBorder( new TitledBorder("Question 3"));
         howmuchJPanel.setBounds(10, 10, 570, 80);
         howmuchJPanel.setBackground( Color.GRAY);
         questionthreeJPanel.add(howmuchJPanel);
         //setup nameJLabel
         nameJLabel = new JLabel();
         nameJLabel.setText("Name");
         nameJLabel.setBounds(10, 160, 150, 24);
         nameJLabel.setFont(new Font("SansSerif",Font.BOLD,12));
         questionthreeJPanel.add(nameJLabel);
         //setup nameJTextField
         nameJTextField = new JTextField();
         nameJTextField.setBounds(125, 160, 200, 24 );
         questionthreeJPanel.add(nameJTextField);
         contentPane.add(questionthreeJPanel);
         //show JOptionMessages when user clicks on JCheckBoxes and inputJButton
    public void inputJButtonActionPerformed( ActionEvent event )
         //display error message if no JCheckBoxes is checked
         else ( ( !lordJCheckBox.isSelected() && !faceJCheckBox.isSelected && !piratesJCheckBox.isSelected() ) )
              //display error message
              JOptionPane.showMessageDialog( null, "Please check two boxes", JOptionPane.ERROR_MESSAGE );
         // if lordjcheckbox and pirates is selected = right
         else
              if ( ( lordJCheckBox.isSelected() && piratesJCheckBox.isSelected() ))
                   JOptionPane.showMessageDialog(null, "Thats RIGHT!");
              //if others are selected = wrong
              else
                   if ( (lordJCheckBox.isSelected() && faceJCheckBox.isSelected() ))
                        JOptionPane.showMessageDialog(null, "Thats WRONG");
                   else
                        ( (faceJCheckBox.isSelected() && piratesJCheckBox.isSelected() ))
                             JOptionPane.showMessageDialog(null, "Thats WRONG");
              // main method
              public static void main( String[] args )
              Mindboggler application = new Mindboggler();
              application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
              } // end method main
    }// end class

  • Getting error message Cannot Resolve Symbol when trying to compile a class

    Hello All -
    I am getting an error message cannot resolve symbol while trying to compile a java class that calls another java class in the same package. The called class compiles fine, but the calling class generates
    the following error message:
    D:\Apache Tomcat 4.0\webapps\examples\WEB-INF\classes\cal>javac
    ConnectionPool.java
    ConnectionPool.java:158: cannot resolve symbol
    symbol : class PooledConnection
    location: class cal.ConnectionPool
    private void addConnection(PooledConnection value) {
    ^
    ConnectionPool.java:144: cannot resolve symbol
    symbol : class PooledConnection
    location: class cal.ConnectionPool
    PooledConnection pcon = new PooledConnection(con);
    ^
    ConnectionPool.java:144: cannot resolve symbol
    symbol : class PooledConnection
    location: class cal.ConnectionPool
    PooledConnection pcon = new PooledConnection(con);
    The code is listed as follows for PooledConnection.java (it compiles fine)
    package cal;
    import java.sql.*;
    public class PooledConnection {
    // Real JDBC Connection
    private Connection connection = null;
    // boolean flag used to determine if connection is in use
    private boolean inuse = false;
    // Constructor that takes the passed in JDBC Connection
    // and stores it in the connection attribute.
    public PooledConnection(Connection value) {
    if ( value != null ) {
    connection = value;
    // Returns a reference to the JDBC Connection
    public Connection getConnection() {
    // get the JDBC Connection
    return connection;
    // Set the status of the PooledConnection.
    public void setInUse(boolean value) {
    inuse = value;
    // Returns the current status of the PooledConnection.
    public boolean inUse() {
    return inuse;
    // Close the real JDBC Connection
    public void close() {
    try {
    connection.close();
    catch (SQLException sqle) {
    System.err.println(sqle.getMessage());
    Now the code for ConnectionPool.java class that gives the cannot
    resolve symbol error
    package cal;
    import java.sql.*;
    import java.util.*;
    public class ConnectionPool {
    // JDBC Driver Name
    private String driver = null;
    // URL of database
    private String url = null;
    // Initial number of connections.
    private int size = 0;
    // Username
    private String username = new String("");
    // Password
    private String password = new String("");
    // Vector of JDBC Connections
    private Vector pool = null;
    public ConnectionPool() {
    // Set the value of the JDBC Driver
    public void setDriver(String value) {
    if ( value != null ) {
    driver = value;
    // Get the value of the JDBC Driver
    public String getDriver() {
    return driver;
    // Set the URL Pointing to the Datasource
    public void setURL(String value ) {
    if ( value != null ) {
    url = value;
    // Get the URL Pointing to the Datasource
    public String getURL() {
    return url;
    // Set the initial number of connections
    public void setSize(int value) {
    if ( value > 1 ) {
    size = value;
    // Get the initial number of connections
    public int getSize() {
    return size;
    // Set the username
    public void setUsername(String value) {
    if ( value != null ) {
    username = value;
    // Get the username
    public String getUserName() {
    return username;
    // Set the password
    public void setPassword(String value) {
    if ( value != null ) {
    password = value;
    // Get the password
    public String getPassword() {
    return password;
    // Creates and returns a connection
    private Connection createConnection() throws Exception {
    Connection con = null;
    // Create a Connection
    con = DriverManager.getConnection(url,
    username, password);
    return con;
    // Initialize the pool
    public synchronized void initializePool() throws Exception {
    // Check our initial values
    if ( driver == null ) {
    throw new Exception("No Driver Name Specified!");
    if ( url == null ) {
    throw new Exception("No URL Specified!");
    if ( size < 1 ) {
    throw new Exception("Pool size is less than 1!");
    // Create the Connections
    try {
    // Load the Driver class file
    Class.forName(driver);
    // Create Connections based on the size member
    for ( int x = 0; x < size; x++ ) {
    Connection con = createConnection();
    if ( con != null ) {
    // Create a PooledConnection to encapsulate the
    // real JDBC Connection
    PooledConnection pcon = new PooledConnection(con);
    // Add the Connection to the pool.
    addConnection(pcon);
    catch (Exception e) {
    System.err.println(e.getMessage());
    throw new Exception(e.getMessage());
    // Adds the PooledConnection to the pool
    private void addConnection(PooledConnection value) {
    // If the pool is null, create a new vector
    // with the initial size of "size"
    if ( pool == null ) {
    pool = new Vector(size);
    // Add the PooledConnection Object to the vector
    pool.addElement(value);
    public synchronized void releaseConnection(Connection con) {
    // find the PooledConnection Object
    for ( int x = 0; x < pool.size(); x++ ) {
    PooledConnection pcon =
    (PooledConnection)pool.elementAt(x);
    // Check for correct Connection
    if ( pcon.getConnection() == con ) {
    System.err.println("Releasing Connection " + x);
    // Set its inuse attribute to false, which
    // releases it for use
    pcon.setInUse(false);
    break;
    // Find an available connection
    public synchronized Connection getConnection()
    throws Exception {
    PooledConnection pcon = null;
    // find a connection not in use
    for ( int x = 0; x < pool.size(); x++ ) {
    pcon = (PooledConnection)pool.elementAt(x);
    // Check to see if the Connection is in use
    if ( pcon.inUse() == false ) {
    // Mark it as in use
    pcon.setInUse(true);
    // return the JDBC Connection stored in the
    // PooledConnection object
    return pcon.getConnection();
    // Could not find a free connection,
    // create and add a new one
    try {
    // Create a new JDBC Connection
    Connection con = createConnection();
    // Create a new PooledConnection, passing it the JDBC
    // Connection
    pcon = new PooledConnection(con);
    // Mark the connection as in use
    pcon.setInUse(true);
    // Add the new PooledConnection object to the pool
    pool.addElement(pcon);
    catch (Exception e) {
    System.err.println(e.getMessage());
    throw new Exception(e.getMessage());
    // return the new Connection
    return pcon.getConnection();
    // When shutting down the pool, you need to first empty it.
    public synchronized void emptyPool() {
    // Iterate over the entire pool closing the
    // JDBC Connections.
    for ( int x = 0; x < pool.size(); x++ ) {
    System.err.println("Closing JDBC Connection " + x);
    PooledConnection pcon =
    (PooledConnection)pool.elementAt(x);
    // If the PooledConnection is not in use, close it
    if ( pcon.inUse() == false ) {
    pcon.close();
    else {
    // If it is still in use, sleep for 30 seconds and
    // force close.
    try {
    java.lang.Thread.sleep(30000);
    pcon.close();
    catch (InterruptedException ie) {
    System.err.println(ie.getMessage());
    I am using Sun JDK Version 1.3.0_02" and Apache/Tomcat 4.0. Both the calling and the called class are in the same directory.
    Any help would be greatly appreciated.
    tnx..
    addi

    Is ConnectionPool in this "cal" package as well as PooledConnection? From the directory you are compiling from it appears that it is. If it is, then you are compiling it incorrectly. To compile ConnectionPool (and PooledConnection similarly), you must change the current directory to the one that contains cal and type
    javac cal/ConnectionPool.

Maybe you are looking for

  • Blue screen on client/must kill session?

    About all 3 or 4 month the following problem occurs: The application starts a simple update on a table with only one row, but without commit, to continue in one transaction. Just now the application crashes (without obvious reason) or the client (a P

  • R12 with 11gR1

    Dear Hussein, As you know i am doing this upgrade. Now my current situation will be R12.1.1 with 10.2.0.5. If i want to upgrade my EBS database base to 11gR1 can i use the 11gR1 that came with R12.1.1 while installing code tree for upgrade. I mean i

  • ITunes 6.0 - IDriver.exe - Application Error

    I installed iTunes 6.0 on 3 Windows XP SP 2 computers today. All upgrading from iTunes 5.0 On 2 of the computers I got error messages pasted below during the QuickTime part of the installation. I dismissed the errors and the installation "completed s

  • Row count for tables from 2 different databases

    Hi, i wrote a query to get counts from all the tables in one schema to another schema. this generates the select count (*) from tables and gives me the counts, but i want to get the counts such as table1 -- 100 -- DB1 table1 - 110 table2 - 230 - DB2

  • Can I manually create a folder in //Library/Scripts?

    I came across an article that provides a link to an AppleScript script that allows a person to manage multiple iWeb projects/sites and it is at: http://www.macosxhints.com/article.php?story=20060126122633213 I saved the script to ~/Library/Scripts/Ap