Oracle jdbc drivers - cannot resolve symbol

while i'm not new to java, i am new to jdbc. need to connect a java app to an oracle database (hosted by a 3rd party). i have all the connection info. i've crafted a test program, but cannot get it to compile.
here's the code:
import java.sql.*;
public class SimpleJDBC
     public static void main(String[] args) throws SQLException, ClassNotFoundException
     Class.forName(oracle.jdbc.driver.OracleDriver);
     System.out.println("Driver loaded");
     Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@database.host:1521:class"); //, "username", "password");
     System.out.println("Database connected");
     Statement statement = conn.createStatement();
     ResultSet results = statement.executeQuery("select first_name, last_name from user_tbl where last_name = 'Kendall'");
     while(results.next())
          System.out.println(results.getString(1) + "\t" + results.getString(2));
     conn.close();
}i've set the classpath to the location of the ojdbc14.jar, and it shows in the classpath when i do a "set" on the cmd line. i've tried it in netbeans, eclipse, and straight cmd line.
i always come up with the same message (cannot resolve symbol) on the line where i call Class.forName(oracle.jdbc.driver.OracleDriver);.
i've tried compiling and setting the classpath at the same time. i added the ojdbc14.jar to the compile/build paths in both the ides. i even tried using the old classes12.jar. nothing has worked.
i can't figure out what else there is. within the ides, the intellisense will actually let me put that line in (piece by piece), but then it shows an error.
any suggestions?

Place the string name of the driver in quotes.
- Saish

Similar Messages

  • When i try to use max() & pow() in jdbc i get error "cannot resolve symbol"

    hi,
    when i tried to use pow() & max() in my jdbc programme i got compilation error "cannot resolve symbol".
    even i have imorted java.math
    this is the sample.
    pr1= (fy/(L*B*pow(10.0,-6.0))+((6*mx)/(L*B*B*pow(10.0,-6.0)))+((6*mz)/(B*L*L*pow(10.0,-6.0))));
    all of above are double.
    and with max();
    pr=max(pr1,pr2);
    all of above are double.
    please help.
    thanks in advance.
    satish

    hi
    Hartmut
    thanks hartmut;
    i am new in java so i have some problems, but thanks for helping me.
    please help me again.
    as i have already posted another probleme which i have with selecting 1000 rows 1 by 1 from a table & manipulate 1 by 1 on that and then store all manipulated row to another table.
    when i tried to do so i am able to select only 600 rows and manipulate them & store them.
    i did not get any exception or any error.
    can this possible that microsoft access driver has not that much capacity to provide 1000 rows or it is problem with jdbc.
    please help.
    satish
    thanks again.

  • Cannot resolve symbol: class OracleDriver

    Attempting to compile a servlet on Apache Server using same jdeveloper jdbc libraries:
    classes12.jar & nls_charset12.jar
    Error message:
    $compilejava2.sh ProdJobs
    ProdJobs.java:361: cannot resolve symbol
    symbol : class OracleDriver
    location: package driver
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Am I missing something else?
    Jeffrey

    Enter this code into your program and then put the Oracle jar file that contains the driver in your run-time classpath.
    try {
      Class.forName("oracle.jdbc.driver.OracleDriver");
      catch(ClassNotFoundException cnfe) {
      // driver not found
    }The effect of this is that the classloader will load the Oracle driver for you then call it's static initiailizer that does a bunch of magic that results in the Java runtime knowing that there's a JDBC driver out there.
    It is a little weird - but that's the way it works.

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

  • Cannot resolve symbol : class odbc ERROR

    Hi Helper
    I am trying to compile a the following and I am getting the error
    C:\jdk\websiter>javac MainServlet.java
    MainServlet.java:86: cannot resolve symbol
    symbol : class odbc
    location: package jdbc
    Class.forName(sun.jdbc.odbc.JdbcOdbcDriver);
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.io.*;
    import java.util.*;
    * This is the servlet to send the user the names of all the sites present in the database
    public class MainServlet extends HttpServlet implements ServletConstants
    Connection m_con;
    PreparedStatement m_pstmt;
    ResultSet m_res;
    Vector m_vecsiteName;
    public void Init(ServletConfig config) throws ServletException {
         super.init(config);
    }// end of init()
    public void service(HttpServletRequest req, HttpServletResponse resp)
    throws ServletException, IOException {
              m_vecsiteName = new Vector();
         try {
         Class.forName(sun.jdbc.odbc.JdbcOdbcDriver);
    m_con = DriverManager.getConnection("jdbc:odbc:sitewd", "", "");
    How can i fix it? thanks
    VT

    Replace the Statement
    Class.forName(sun.jdbc.odbc.JdbcOdbcDriver);
    as
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

  • 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

  • Can't figure out why an object isn't visible - CANNOT RESOLVE SYMBOL

    I have a simple 3 class app, all in the same package. Classes are:
    - BjackServlet, BjackDAO, and Player
    I get the compile error (I'm using Ant):
    [javac] C:\Tomcat4118\src\webapps\hellobjack\src\mybjpack\BjackServlet.java
    59: cannot resolve symbol
    [javac] symbol : variable thePlayer
    [javac] location: class mybjpack.BjackServlet
    [javac] String gp = thePlayer.getPassword();
    The pertinent code from the 3 classes is below. The offending code is in bold. Why can't I see the object from the BjackServlet.doGet() method? I can see it from within BjackDAO.addPlayer() after the "thePlayer" object has been instantiated. Please help...thanks in advance!
    package mybjpack;
    import java.io.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.lang.*;
    public class BjackServlet extends HttpServlet {
         private BjackDAO theBlackjackDAO;
         public void init() throws ServletException {
              String driver = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
              String dbUrl = "jdbc:microsoft:sqlserver://localhost:1433";
              String dbuserid = "testlogin";
              String dbpass = "1climb1";
              String dbname = "ejh_blackjack1";
              String connectstring = "jdbc:microsoft:sqlserver://localhost:1433;User=testlogin;Password=1climb1;DatabaseName=ejh_blackjack1";
         try {
           theBlackjackDAO = new BjackDAO(driver, dbUrl, dbuserid, dbpass, dbname, connectstring);
         catch (IOException exc) {
              System.err.println(exc.toString());
         catch (ClassNotFoundException cnf) {
              System.err.println(cnf.toString());
         catch (SQLException seq) {
              System.err.println(seq.toString());
      public void doPost(HttpServletRequest request, HttpServletResponse response)
                throws ServletException, IOException {
        doGet(request, response);
      public void doGet(HttpServletRequest request, HttpServletResponse response)
                throws ServletException, IOException {
         String command = request.getParameter("command");
         if (command == null || (command.equals("stats"))) { //player wants to go to stats page
         else if (command.equals("Add")) { //a new player adds himself to the game site
              try {
              theBlackjackDAO.addPlayer(request, response);
              String gp = thePlayer.getPassword();
              System.out.println("the Player.getPassword method yields: " + gp);
              catch (Exception exc) {
                   System.err.println(exc.toString());
         else if (command.equals("enter")) { //an experienced player enters via index.html
         else if (command.equals("play")) {
    etc...
    package mybjpack;
    import java.io.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.lang.*;
    public class BjackDAO {
         private Connection myConn;
         public Player thePlayer;
         public BjackDAO(String driver, String dbUrl, String dbuserid, String dbpass, String dbname, String connectstring)
                   throws IOException, ClassNotFoundException, SQLException {
              System.out.println("Loading driver: " + driver);
              Class.forName(driver);
              System.out.println("Connection to: " + dbUrl);
              myConn = DriverManager.getConnection(connectstring);
              System.out.println("Connection successful! Database is " + dbname);
         public void addPlayer(HttpServletRequest request, HttpServletResponse response)
                   throws IOException, SQLException, NumberFormatException {
              //* read all the form values ...
              String ppass = request.getParameter("formpass");
              String puser = request.getParameter("formuser");
              int ppile = Integer.parseInt(request.getParameter("pile"));
              int pstatus = 1;
              int pbet = Integer.parseInt(request.getParameter("bet"));
              int paccount = Integer.parseInt(request.getParameter("account"));
              //* and write them to player object instance variables
              System.out.println("Player instantiation beginning...");
              Player thePlayer = new Player(pstatus, ppile, pbet, puser, paccount, ppass);
              String insertSql =
                   "INSERT INTO tbl_player (user_id, psswrd, account, default_pile, default_bet) "
                   + "VALUES ('" + puser + "', '" + ppass + "', '" + paccount + "', "
                   + "'" + ppile + "', '" + pbet + "')";
                   Statement myStmt = myConn.createStatement();
                   myStmt.execute(insertSql);
                   myStmt.close();
              return;
    package mybjpack;
    import java.io.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.lang.*;
    public class Player implements java.io.Serializable {
         private String ouser;
         public String opass;
         private int opile;
         private int oaccount;
         private int obet;
         private int ostatus;
         public Player(int theStatus, int thePile, int theBet,
                             String theUser, int theAccount, String thePass) {
              ouser = theUser;
              opass = thePass;
              opile = thePile;
              oaccount = theAccount;
              obet = theBet;
              ostatus = theStatus;
         public String getUser(){
              return ouser;
         public void setUser(String vuser){
              String ouser = vuser;
         public String getPassword(){
              return opass;
         public void setPassword(String vpass){
              String opass = vpass;
         public int getPile(){
              return opile;
         public void setPile(int vpile){
              int opile = vpile;
         public int getBet(){
              return obet;
         public void setBet(int vbet){
              int obet = vbet;
         public int getAccount(){
              return oaccount;
         public void setAccount(int vaccount){
              int oaccount = vaccount;
         public int getStatus(){
              return ostatus;
         public void setStatus(int vstatus){
              int ostatus = vstatus;

    First glance, try this
    String gp = theBlackjackDAO.thePlayer.getPassword();

  • Cannot resolve symbol error when compiling a class that calls another class

    I've read all the other messages that include "cannot resolve symbol", but no luck. I've got a small app - 3 classes all in the same package. BlackjackDAO and Player compile OK, but BlackjackServlet throws the "cannot resolve symbol" (please see pertinent code below)...
    I've tried lots: ant and javac compiling, upgrading my version of tomcat, upgrading my version of jdk/jre, making sure my servlet.jar is being seen by the compiler (at least as far as I can see from the -verbose feedback)...any help would be GREAT! Thanks in advance...
    classes: BlackjackServlet, BlackjackDAO, Player
    package: myblackjackpackage
    tomcat version: 4.1.1.8
    jdk version: j2sdk 1.4.0
    ant version: 1.4.1
    I get the same error message from Ant and Javac...
    C:\Tomcat4118\src\webapps\helloblackjack\src\myblackjackpackage>javac *.java -verbose
    C:\Tomcat4118\src\webapps\helloblackjack>ant all -verbose
    compile error:
    BlackjackServlet.java:55: cannot resolve symbol
    symbol: method addPlayer (javax.servlet.http.HttpServletRequest,javax.servlet.http.Http
    ServletResponse)
    location: class myblackjackpackage.BlackjackServlet
              addPlayer(request, response);
    ^
    My code is:
    package myblackjackpackage;
    import java.io.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.lang.*;
    /** controller servlet in a web based blackjack game application @author Ethan Harlow */
    public class BlackjackServlet extends HttpServlet {
         private BlackjackDAO theBlackjackDAO;
         public void init() throws ServletException {
    String driver = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
    String dbUrl = "jdbc:microsoft:sqlserver://localhost:1433";
    String userid = "testlogin";
    String passwrd = "testpass";
         try {
         theBlackjackDAO = new BlackjackDAO(driver, dbUrl, userid, passwrd);
         catch (IOException exc) {
              System.err.println(exc.toString());
         catch (ClassNotFoundException cnf) {
              System.err.println(cnf.toString());
         catch (SQLException seq) {
              System.err.println(seq.toString());
    public void doPost(HttpServletRequest request, HttpServletResponse response)
              throws ServletException, IOException {
    doGet(request, response);
    public void doGet(HttpServletRequest request, HttpServletResponse response)
              throws ServletException, IOException {
         String command = request.getParameter("command");
         if (command == null || (command.equals("stats"))) {
         else if (command.equals("add")) {
              try {
    //the following line is caught by compiler
              addPlayer(request, response);
              response.setContentType("text/html");
              PrintWriter out = response.getWriter();
              out.println("<html>");
              out.println("<body>");
              out.println("<p>Hi, your command was " + request.getParameter("command") + "!!!</p>");
              out.println("</body>");
              out.println("</html>");
              catch (Exception exc) {
                   System.err.println(exc.toString());
         else if (command.equals("play")) {
         else if (command.equals("bet")) {
         else if (command.equals("hit")) {
         else if (command.equals("stand")) {
         else if (command.equals("split")) {
         else if (command.equals("double")) {
         else if (command.equals("dealerdecision")) {
         else if (command.equals("reinvest")) {
         else if (command.equals("changebet")) {
         else if (command.equals("deal")) {
    package myblackjackpackage;
    import java.io.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.lang.*;
    public class BlackjackDAO {
         private Connection myConn;
         public BlackjackDAO(String driver, String dbUrl, String userid, String passwrd)
                   throws IOException, ClassNotFoundException, SQLException {
              System.out.println("Loading driver: " + driver);
              Class.forName(driver);
              System.out.println("Connection to: " + dbUrl);
              myConn = DriverManager.getConnection(dbUrl, userid, passwrd);
              System.out.println("Connection successful!");
         public void addPlayer(HttpServletRequest request, HttpServletResponse response)
                   throws IOException, SQLException {
    //I've commented out all my code while debugging, so I didn't include
    //any here     
    compiler feedback
    C:\Tomcat4118\src\webapps\helloblackjack\src\myblackjackpackage>javac *.java -verbose
    [parsing started BlackjackDAO.java]
    [parsing completed 90ms]
    [parsing started BlackjackServlet.java]
    [parsing completed 10ms]
    [parsing started Player.java]
    [parsing completed 10ms]
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/Object.class)]
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/sql/Connection.class)]
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/String.class)]
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/io/IOException.class)]
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/ClassNotFoundException.class)]
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/sql/SQLException.class)]
    [loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/http/HttpServletRequ
    est.class)]
    [loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/http/HttpServletResp
    onse.class)]
    [loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/http/HttpServlet.cla
    ss)]
    [loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/GenericServlet.class
    [loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/Servlet.class)]
    [loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/ServletConfig.class)
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/io/Serializable.class)]
    [loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/ServletException.cla
    ss)]
    [checking myblackjackpackage.BlackjackDAO]
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/Throwable.class)]
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/Exception.class)]
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/System.class)]
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/io/PrintStream.class)]
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/io/FilterOutputStream.class)]
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/io/OutputStream.class)]
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/Class.class)]
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/sql/DriverManager.class)]
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/util/Properties.class)]
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/Error.class)]
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/RuntimeException.class)]
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/StringBuffer.class)]
    [wrote BlackjackDAO.class]
    [checking myblackjackpackage.BlackjackServlet]
    [loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/ServletRequest.class
    BlackjackServlet.java:55: cannot resolve symbol
    symbol : method addPlayer (javax.servlet.http.HttpServletRequest,javax.servlet
    .http.HttpServletResponse)
    location: class myblackjackpackage.BlackjackServlet
    addPlayer(request, response);
    ^
    [loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/ServletResponse.clas
    s)]
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/io/PrintWriter.class)]
    [loading c:\j2sdk14003\jre\lib\rt.jar(java/io/Writer.class)]
    [checking myblackjackpackage.Player]
    [total 580ms]
    1 error
    C:\Tomcat4118\src\webapps\helloblackjack\src\myblackjackpackage>
    and here's the ant feedback...
    C:\Tomcat4118\src\webapps\helloblackjack>ant all -verbose
    Ant version 1.4.1 compiled on October 11 2001
    Buildfile: build.xml
    Detected Java version: 1.4 in: c:\j2sdk14003\jre
    Detected OS: Windows 2000
    parsing buildfile C:\Tomcat4118\src\webapps\helloblackjack\build.xml with URI =
    file:C:/Tomcat4118/src/webapps/helloblackjack/build.xml
    Project base dir set to: C:\Tomcat4118\src\webapps\helloblackjack
    Build sequence for target `all' is [clean, prepare, compile, all]
    Complete build sequence is [clean, prepare, compile, all, javadoc, deploy, dist]
    clean:
    [delete] Deleting directory C:\Tomcat4118\src\webapps\helloblackjack\build
    [delete] Deleting C:\Tomcat4118\src\webapps\helloblackjack\build\images\a_s.g
    if
    [delete] Deleting C:\Tomcat4118\src\webapps\helloblackjack\build\images\q_s.g
    if
    [delete] Deleting directory C:\Tomcat4118\src\webapps\helloblackjack\build\im
    ages
    [delete] Deleting C:\Tomcat4118\src\webapps\helloblackjack\build\index.html
    [delete] Deleting C:\Tomcat4118\src\webapps\helloblackjack\build\newplayer.ht
    ml
    [delete] Deleting C:\Tomcat4118\src\webapps\helloblackjack\build\WEB-INF\clas
    ses\myblackjackpackage\BlackjackDAO.class
    [delete] Deleting directory C:\Tomcat4118\src\webapps\helloblackjack\build\WE
    B-INF\classes\myblackjackpackage
    [delete] Deleting directory C:\Tomcat4118\src\webapps\helloblackjack\build\WE
    B-INF\classes
    [delete] Deleting C:\Tomcat4118\src\webapps\helloblackjack\build\WEB-INF\web.
    xml
    [delete] Deleting directory C:\Tomcat4118\src\webapps\helloblackjack\build\WE
    B-INF
    [delete] Deleting directory C:\Tomcat4118\src\webapps\helloblackjack\build
    prepare:
    [mkdir] Created dir: C:\Tomcat4118\src\webapps\helloblackjack\build
    [copy] images\a_s.gif added as C:\Tomcat4118\src\webapps\helloblackjack\bui
    ld\images\a_s.gif doesn't exist.
    [copy] images\q_s.gif added as C:\Tomcat4118\src\webapps\helloblackjack\bui
    ld\images\q_s.gif doesn't exist.
    [copy] index.html added as C:\Tomcat4118\src\webapps\helloblackjack\build\i
    ndex.html doesn't exist.
    [copy] newplayer.html added as C:\Tomcat4118\src\webapps\helloblackjack\bui
    ld\newplayer.html doesn't exist.
    [copy] WEB-INF\web.xml added as C:\Tomcat4118\src\webapps\helloblackjack\bu
    ild\WEB-INF\web.xml doesn't exist.
    [copy] omitted as C:\Tomcat4118\src\webapps\helloblackjack\build is up to
    date.
    [copy] images added as C:\Tomcat4118\src\webapps\helloblackjack\build\image
    s doesn't exist.
    [copy] WEB-INF added as C:\Tomcat4118\src\webapps\helloblackjack\build\WEB-
    INF doesn't exist.
    [copy] Copying 5 files to C:\Tomcat4118\src\webapps\helloblackjack\build
    [copy] Copying C:\Tomcat4118\src\webapps\helloblackjack\web\images\q_s.gif
    to C:\Tomcat4118\src\webapps\helloblackjack\build\images\q_s.gif
    [copy] Copying C:\Tomcat4118\src\webapps\helloblackjack\web\images\a_s.gif
    to C:\Tomcat4118\src\webapps\helloblackjack\build\images\a_s.gif
    [copy] Copying C:\Tomcat4118\src\webapps\helloblackjack\web\index.html to C
    :\Tomcat4118\src\webapps\helloblackjack\build\index.html
    [copy] Copying C:\Tomcat4118\src\webapps\helloblackjack\web\newplayer.html
    to C:\Tomcat4118\src\webapps\helloblackjack\build\newplayer.html
    [copy] Copying C:\Tomcat4118\src\webapps\helloblackjack\web\WEB-INF\web.xml
    to C:\Tomcat4118\src\webapps\helloblackjack\build\WEB-INF\web.xml
    compile:
    [mkdir] Created dir: C:\Tomcat4118\src\webapps\helloblackjack\build\WEB-INF\
    classes
    [javac] myblackjackpackage\BlackjackDAO.class skipped - don't know how to ha
    ndle it
    [javac] myblackjackpackage\BlackjackDAO.java added as C:\Tomcat4118\src\weba
    pps\helloblackjack\build\WEB-INF\classes\myblackjackpackage\BlackjackDAO.class d
    oesn't exist.
    [javac] myblackjackpackage\BlackjackServlet.java added as C:\Tomcat4118\src\
    webapps\helloblackjack\build\WEB-INF\classes\myblackjackpackage\BlackjackServlet
    .class doesn't exist.
    [javac] myblackjackpackage\Player.java added as C:\Tomcat4118\src\webapps\he
    lloblackjack\build\WEB-INF\classes\myblackjackpackage\Player.class doesn't exist
    [javac] Compiling 3 source files to C:\Tomcat4118\src\webapps\helloblackjack
    \build\WEB-INF\classes
    [javac] Using modern compiler
    [javac] Compilation args: -d C:\Tomcat4118\src\webapps\helloblackjack\build\
    WEB-INF\classes -classpath
    "C:\Tomcat4118\src\webapps\helloblackjack\build\WEB-I
    NF\classes;
    C:\tomcat4118\common\classes;
    C:\tomcat4118\common\lib\activation.jar;
    C:\tomcat4118\common\lib\ant.jar;
    C:\tomcat4118\common\lib\commons-collections.jar;
    C:\tomcat4118\common\lib\commons-dbcp.jar;
    C:\tomcat4118\common\lib\commons-logging-api.jar;
    C:\tomcat4118\common\lib\commons-pool.jar;
    C:\tomcat4118\common\lib\jasper-compiler.jar;
    C:\tomcat4118\common\lib\jasper-runtime.jar;
    C:\tomcat4118\common\lib\jdbc2_0-stdext.jar;
    C:\tomcat4118\common\lib\jndi.jar;
    C:\tomcat4118\common\lib\jta.jar;
    C:\tomcat4118\common\lib\mail.jar;
    C:\tomcat4118\common\lib\mysql_uncomp.jar;
    C:\tomcat4118\common\lib\naming-common.jar;
    C:\tomcat4118\common\lib\naming-factory.jar;
    C:\tomcat4118\common\lib\naming-resources.jar;
    C:\tomcat4118\common\lib\servlet.jar;
    C:\tomcat4118\common\lib\tools.jar;
    C:\j2sdk14003\lib\tools.jar;
    C:\tomcat4118\ant141\lib\servlet.jar;
    C:\tomcat4118\ant141\lib\jaxp.jar;
    C:\tomcat4118\ant141\lib\crimson.jar;
    C:\tomcat4118\ant141\lib\ant.jar;
    C:\Tomcat4118\src\webapps\helloblackjack;
    C:\mysql\jdbc_dvr\mm.mysql.jdbc-1.2c;
    C:\Program Files\SQLserverjdbcdriver\lib\msbase.jar;
    C:\Program Files\SQLserverjdbcdriver\lib\msutil.jar;
    C:\Program Files\SQLserverjdbcdriver\lib\mssqlserver.jar"
    -sourcepath C:\Tomcat4118\src\webapps\helloblackjack\src -g -O
    [javac] Files to be compiled:
    C:\Tomcat4118\src\webapps\helloblackjack\src\myblackjackpackage\BlackjackDAO
    .java
    C:\Tomcat4118\src\webapps\helloblackjack\src\myblackjackpackage\BlackjackSer
    vlet.java
    C:\Tomcat4118\src\webapps\helloblackjack\src\myblackjackpackage\Player.java
    [javac] C:\Tomcat4118\src\webapps\helloblackjack\src\myblackjackpackage\Blac
    kjackServlet.java:55: cannot resolve symbol
    [javac] symbol : method addPlayer (javax.servlet.http.HttpServletRequest,j
    avax.servlet.http.HttpServletResponse)
    [javac] location: class myblackjackpackage.BlackjackServlet
    [javac] addPlayer(request, response);
    [javac] ^
    [javac] 1 error
    BUILD FAILED
    C:\Tomcat4118\src\webapps\helloblackjack\build.xml:212: Compile failed, messages
    should have been provided.
    at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:559)
    at org.apache.tools.ant.Task.perform(Task.java:217)
    at org.apache.tools.ant.Target.execute(Target.java:184)
    at org.apache.tools.ant.Target.performTasks(Target.java:202)
    at org.apache.tools.ant.Project.executeTarget(Project.java:601)
    at org.apache.tools.ant.Project.executeTargets(Project.java:560)
    at org.apache.tools.ant.Main.runBuild(Main.java:454)
    at org.apache.tools.ant.Main.start(Main.java:153)
    at org.apache.tools.ant.Main.main(Main.java:176)
    Total time: 1 second
    C:\Tomcat4118\src\webapps\helloblackjack>

    yes!
    early on i tried: BlackjackDAO.addPlayer(request, response);
    instead of: theBlackjackDAO.addPlayer(request, response);
    you rock - thanks a ton

  • 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

  • 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

  • Missing method body and cannot resolve symbol

    I keep getting these two errors when trying to compile. I know that I need to call my fibonacci and factorial functions from the main function. Is this why I am getting the missing method body error? How do I correct this?
    Am I getting the cannot resolve symbol because I have to set the num and fact to equal something?
    Thanks
    public class Firstassignment
    public static void main(String[]args)
         System.out.println();
    public static void fibonacci(String[]args);
         int even=1;
         int odd=1;
         while (odd<=100);
         System.out.println(even);
         int temp = even;
         even = odd;
         odd = odd + temp;
    public static void factorial (String[]args);
         for (int count=1;
         count<=num;
         count++);
         fact = fact * count;
         outputbox.printLine("Factorial of" + num + "is" + fact);

    Hey... :o)
    the problem is that you've put semicolons at the end of the function signature, like this:
    public static void fibonacci(String[]args);
    }that should happen only when the function is abstract... so ur function should actually look like this:
    public static void fibonacci(String[]args)
    }also, i think you've missed out on the declarations (like what are fact and num??)....

  • "cannot resolve symbol" in a Timer !!!Please Help!!!

    I am doing a program for a class which involves timers. I am using JCreator and when i try to construct a new timer, the compiler points to the "new" in the line:
    Timer T1=new Timer(interval, ActionListener);
    ^
    This is what it looks like and the error reads: cannot resolve symbol; constructor Timer.
    please tell me if yiou have any information or suggestions as to how this error might be remedied.

    Sure, here it is:
    import java.awt.event.*;
    import javax.swing.Timer;
    import javax.swing.JOptionPane;
    import java.util.*;
    interface ActionListener
         void actionPerformed(ActionEvent event);     
    class Ploid
         public static void main(String[] args)
              class Car implements ActionListener
                   int mpg=30;
                   int mph=35;
                   int gtank=20;
                   int interval;
                   int changer;
                   int totalmiles;
                   Car(int x)
                        interval=x;
                   public void actionPerformed(ActionEvent event)
                        for(int c=0;c<(interval/1000);c++)
                             totalmiles=totalmiles+mph;
                        int hyt=mpg*gtank;
                        if(totalmiles>hyt)
                             int y=totalmiles-hyt;
                             totalmiles=totalmiles-y;
                             System.out.println(totalmiles);
                        else
                             System.out.println(totalmiles);
    class SUV implements ActionListener
         int mpg=15;
         int mph=55;
         int gtank=30;
         int interval;
         int changer;
         int totalmiles;
         SUV(int x)
              interval=x;
              public void actionPerformed(ActionEvent event)
                   for(int c=0;c<(interval/1000);c++)
                        totalmiles=totalmiles+mph;
                   int hyt=mpg*gtank;
                   if(totalmiles>hyt)
                        int y=totalmiles-hyt;
                        totalmiles=totalmiles-y;
                        System.out.println(totalmiles);
                   else
                        System.out.println(totalmiles);
    class Semi implements ActionListener
         int mpg=60;
         int mph=80;
         int gtank=50;
         int interval;
         int changer;
         int totalmiles;
         Semi(int x)
              interval=x;
         public void actionPerformed(ActionEvent event)
              for(int c=0;c<(interval/1000);c++)
                   totalmiles=totalmiles+mph;
              int hyt=mpg*gtank;
              if(totalmiles>hyt)
                   int y=totalmiles-hyt;
                   totalmiles=totalmiles-y;
                   System.out.println(totalmiles);
              else
                   System.out.println(totalmiles);
              String flag="y";
              String trav=JOptionPane.showInputDialog("How long do you want to drive?(1000=1 hour)");
              int t1=Integer.parseInt(trav);
              Car listen=new Car(t1);
              SUV listener2=new SUV(t1);
              Semi listener3=new Semi(t1);
              final int t2=t1/1000;
              final int t3=t1/t2;
              ActionListener listener=null;
              Timer T1=new Timer(t3, listener);
              Timer T2=new Timer(t3, listener);
              Timer T3=new Timer(t3, listener);
              while(flag.equals("y"))
                   T1.start();
                   T2.start();
                   T3.start();
                   String g=JOptionPane.showInputDialog("Do you want to drive again?");
                   if((g.equals("y"))||(g.equals("Y")))
                        System.out.println("Let's Drive!");
                   else
                        flag=g;
                   System.exit(0);
    }Here is the errors:
    [errors]
    A:\Ploid2.java:116: cannot resolve symbol
    symbol : constructor Timer (int,ActionListener)
    location: class javax.swing.Timer
              Timer T1=new Timer(t3, listener);
    ^
    A:\Ploid2.java:117: cannot resolve symbol
    symbol : constructor Timer (int,ActionListener)
    location: class javax.swing.Timer
              Timer T2=new Timer(t3, listener);
    ^
    A:\Ploid2.java:118: cannot resolve symbol
    symbol : constructor Timer (int,ActionListener)
    location: class javax.swing.Timer
              Timer T3=new Timer(t3, listener);
    ^
    3 errors
    Process completed.
    [errors]
    ****There is the source code and the errors the compiler returns. That should be more help.****

  • Class error - cannot resolve symbol "MyDocumentListener"

    Hello,
    this is a groaner I'm sure, but I don't see the problem.
    Newbie-itis probably ...
    I'm not concerned with what the class does, but it would be nice for the silly thing to compile!
    What the heck am I missing for "MyDocumentListener" ?
    C:\divelog>javac -classpath C:\ CenterPanel.java
    CenterPanel.java:53: cannot resolve symbol
    symbol : class MyDocumentListener
    location: class divelog.CenterPanel
    MyDocumentListener myDocumentListener = new MyDocumentListener(); // define the listener class
    ^
    CenterPanel.java:53: cannot resolve symbol
    symbol : class MyDocumentListener
    location: class divelog.CenterPanel
    MyDocumentListener myDocumentListener = new MyDocumentListener(); // define the listener class
    ^
    2 errors
    package divelog;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.lang.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.filechooser.*;
    import javax.swing.text.*;
    public class CenterPanel extends JPanel implements ActionListener
    { // Opens class
    static private final String newline = "\n";
    private JTextArea comments;
    private JScrollPane scrollpane;
    private JButton saveButton, openButton;
    private JLabel whiteshark;
    private Box box;
    private BufferedReader br ;
    private String str;
    private JTextArea instruct;
    private File defaultDirectory = new File("C://divelog");
    private File fileDirectory = null;
    private File currentFile= null;
    public CenterPanel()
    { // open constructor CenterPanel
    setBackground(Color.white);
    comments = new JTextArea("Enter comments, such as " +
    "location, water conditions, sea life you observed," +
    " and problems you may have encountered.", 15, 10);
    comments.setLineWrap(true);
    comments.setWrapStyleWord(true);
    comments.setEditable(true);
    comments.setFont(new Font("Times-Roman", Font.PLAIN, 14));
    // add a document listener for changes to the text,
    // query before opening a new file to decide if we need to save changes.
    MyDocumentListener myDocumentListener = new MyDocumentListener(); // define the listener class
    comments.getDocument().addDocumentListener(myDocumentListener); // create the reference for the class
    // ------ Document listener class -----------
    class MyDocumentListener implements DocumentListener {
    public void insertUpdate(DocumentEvent e) {
    Calculate(e);
    public void removeUpdate(DocumentEvent e) {
    Calculate(e);
    public void changedUpdate(DocumentEvent e) {
    private void Calculate(DocumentEvent e) {
    // do something here
    scrollpane = new JScrollPane(comments);
    scrollpane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    saveButton = new JButton("Save Comments", new ImageIcon("images/Save16.gif"));
    saveButton.addActionListener( this );
    saveButton.setToolTipText("Click this button to save the current file.");
    openButton = new JButton("Open File...", new ImageIcon("images/Open16.gif"));
    openButton.addActionListener( this );
    openButton.setToolTipText("Click this button to open a file.");
    whiteshark = new JLabel("", new ImageIcon("images/gwhite.gif"), JLabel.CENTER);
    Box boxH;
    boxH = Box.createHorizontalBox();
    boxH.add(openButton);
    boxH.add(Box.createHorizontalStrut(15));
    boxH.add(saveButton);
    box = Box.createVerticalBox();
    box.add(scrollpane);
    box.add(Box.createVerticalStrut(10));
    box.add(boxH);
    box.add(Box.createVerticalStrut(15));
    box.add(whiteshark);
    add(box);
    } // closes constructor CenterPanel
    public void actionPerformed( ActionEvent evt )
    { // open method actionPerformed
    JFileChooser jfc = new JFileChooser();
    // these do not work !!
    // -- set the file types to view --
    // ExtensionFileFilter filter = new ExtensionFileFilter();
    // FileFilter filter = new FileFilter();
    //filter.addExtension("java");
    //filter.addExtension("txt");
    //filter.setDescription("Text & Java Files");
    //jfc.setFileFilter(filter);
         //Add a custom file filter and disable the default "Accept All" file filter.
    jfc.addChoosableFileFilter(new JTFilter());
    jfc.setAcceptAllFileFilterUsed(false);
    // -- open the default directory --
    // public void setCurrentDirectory(File dir)
    // jfc.setCurrentDirectory(new File("C://divelog"));
    jfc.setCurrentDirectory(defaultDirectory);
    jfc.setSize(400, 300);
    jfc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
    Container parent = saveButton.getParent();
    //========================= Test Button Actions ================================
    //========================= Open Button ================================
    if (evt.getSource() == openButton)
    int choice = jfc.showOpenDialog(CenterPanel.this);
    File file = jfc.getSelectedFile();
    /* a: */
    if (file != null && choice == JFileChooser.APPROVE_OPTION)
    String filename = jfc.getSelectedFile().getAbsolutePath();
    // -- compare the currentFile to the file chosen, alert of loosing any changes to currentFile --
    // If (currentFile != filename)
    // -- get the current directory name -------
    // public File getCurrentDirectory( );
    File f=new File(System.getProperty("user.dir"));
    fileDirectory = jfc.getCurrentDirectory();
    // -- remember the last directory used --
    if (defaultDirectory != fileDirectory)
    {defaultDirectory = fileDirectory;}
    try
    { //opens try         
    comments.getLineCount( );
    // -- clear the old data before importing the new file --
    comments.selectAll();
    comments.replaceSelection("");
    // -- get the new data ---
    br = new BufferedReader (new FileReader(file));
    while ((str = br.readLine()) != null)
    {//opens while
    comments.append(str);
    } //closes while
    } // close try
    catch (IOException ioe)
    { // open catch
    comments.append(newline +"Open command not successful:" + ioe + newline);
    } // close catch
    // ---- display the values of the directory variables -----------------------
    comments.append(
    newline + "The f directory variable contains: " + f +
    newline + "The fileDirectory variable contains: " + fileDirectory +
    newline + "The defaultDirectory variable contains: " + defaultDirectory );
    else
    comments.append("Open command cancelled by user." + newline);
    } //close if statement /* a: */
    //========================= Save Button ================================
    } else if (evt.getSource() == saveButton)
    int choice = jfc.showSaveDialog(CenterPanel.this);
    if (choice == JFileChooser.APPROVE_OPTION)
    File fileName = jfc.getSelectedFile();
    // -- get the current directory name -------
    // public File getCurrentDirectory( );
    File f=new File(System.getProperty("user.dir"));
    fileDirectory = jfc.getCurrentDirectory();
    // -- remember the last directory used --
    if (defaultDirectory != fileDirectory)
    {defaultDirectory = fileDirectory;}
    //check for existing files. Warn users & ask if they want to overwrite
    for(int i = 0; i < fileName.length(); i ++) {
    File tmp = null;
    tmp = (fileName);
    if (tmp.exists()) // display pop-up alert
    //public static int showConfirmDialog( Component parentComponent,
    // Object message,
    // String title,
    // int optionType,
    // int messageType,
    // Icon icon);
    int confirm = JOptionPane.showConfirmDialog(null,
    fileName + " already exists on " + fileDirectory
    + "\n \nContinue?", // msg
    "Warning! Overwrite File!", // title
    JOptionPane.OK_CANCEL_OPTION, // buttons displayed
                        // JOptionPane.ERROR_MESSAGE
                        // JOptionPane.INFORMATION_MESSAGE
                        // JOptionPane.PLAIN_MESSAGE
                        // JOptionPane.QUESTION_MESSAGE
    JOptionPane.WARNING_MESSAGE,
    null);
    if (confirm != JOptionPane.YES_OPTION)
    { //user cancels the file overwrite.
    try {
    jfc.cancelSelection();
    break;
    catch(Exception e) {}
    // ----- Save the file if everything is OK ----------------------------
    try
    { // opens try
    BufferedWriter bw = new BufferedWriter(new FileWriter(fileName));
    bw.write(comments.getText());
    bw.flush();
    bw.close();
    comments.append( newline + newline + "Saving: " + fileName.getName() + "." + newline);
    break;
    } // closes try
    catch (IOException ioe)
    { // open catch
    comments.append(newline +"Save command unsuccessful:" + ioe + newline);
    } // close catch
    } // if exists
    } //close for loop
    else
    comments.append("Save command cancelled by user." + newline);
    } // end-if save button
    } // close method actionPerformed
    } //close constructor CenterPanel
    } // Closes class CenterPanel

    There is no way to be able to see MyDocumentListener class in the way you wrote. The reason is because MyDocumentListener class inside the constructor itself. MyDocumentListener class is an inner class, not suppose to be inside a constructor or a method. What you need to do is simple thing, just move it from inside the constructor and place it between two methods.
    that's all folks
    Qusay

  • PLEASE HELP: cannot resolve symbol class

    it's showing me the error on the following lines 7 and 9
    it says cannot resolve symbol class Name and cannot resolve symbol class Phone
    I also have a package name addressBook and it contains two files Entry.java and Address.java
    Here is the code:
    import java.io.*;
    import addressBook.*;
    public class AddressDr
         public static void main(String[] args)throws IOException
              Name name;
              Address address;
              Phone phone;
              Entry entry;
              String first, last, middle, street, city, state, zip;
              int areaCode, number;
              BufferedReader in;
              in=new BufferedReader(new InputStreamReader(System.in));
              PrintWriter outFile;
              outFile=new PrintWriter(new FileWriter("Entries"));
              System.out.println("Quit entered fot the first name ends the " + "application.");
              System.out.print("Enter first name: ");
              first=in.readLine();
              while (first.compareTo("Quit") !=0)
                   System.out.print("Enter last name: ");
                   last=in.readLine();
                   System.out.print("Enter middle name: ");
                   middle=in.readLine();
                   name=new Name(first, last, middle);
                   System.out.print("Enter street address: ");
                   street=in.readLine();
                   System.out.print("Enter city: ");
                   city=in.readLine();
                   System.out.print("Enter state: ");
                   state=in.readLine();
                   System.out.print("Enter ZIP code: ");
                   zip=in.readLine();
                   address=new Address(street, city, state, zip);
                   System.out.print("Enter areaCode: ");
                   areaCode = Integer.parseInt(in.readLine());
                   System.out.print("Enter number: ");
                   number=Integer.parseInt(in.readLine());
                   phone=new Phone(areaCode, number);
                   entry= new Entry(name, address, phone);
                   entry.writeToFile(outFile);
                   System.out.print("Enter first name: ");
                   first=in.readLine();
              outFile.close();
    }

    OK. Here is how I did it.
    I have AddressDr which is Address driver.
    I have two files Address and Entry which in package addressBook.
    AddressDr:
    import java.io.*;
    import addressBook.*;
    public class AddressDr
         public static void main(String[] args)throws IOException
              Name name;
              Address address;
              Phone phone;
              Entry entry;
              String first, last, middle, street, city, state, zip;
              int areaCode, number;
              BufferedReader in;
              in=new BufferedReader(new InputStreamReader(System.in));
              PrintWriter outFile;
              outFile=new PrintWriter(new FileWriter("Entries"));
              System.out.println("Quit entered fot the first name ends the " + "application.");
              System.out.print("Enter first name: ");
              first=in.readLine();
              while (first.compareTo("Quit") !=0)
                   System.out.print("Enter last name: ");
                   last=in.readLine();
                   System.out.print("Enter middle name: ");
                   middle=in.readLine();
                   name=new Name(first, last, middle);
                   System.out.print("Enter street address: ");
                   street=in.readLine();
                   System.out.print("Enter city: ");
                   city=in.readLine();
                   System.out.print("Enter state: ");
                   state=in.readLine();
                   System.out.print("Enter ZIP code: ");
                   zip=in.readLine();
                   address=new Address(street, city, state, zip);
                   System.out.print("Enter areaCode: ");
                   areaCode = Integer.parseInt(in.readLine());
                   System.out.print("Enter number: ");
                   number=Integer.parseInt(in.readLine());
                   phone=new Phone(areaCode, number);
                   entry= new Entry(name, address, phone);
                   entry.writeToFile(outFile);
                   System.out.print("Enter first name: ");
                   first=in.readLine();
              outFile.close();
    Entry:
    package addressBook;
    import java.io.*;
    public class Entry
         Name name;
         Address address;
         Phone phone;
    public Entry(Name newName, Address newAddress, Phone phoneNumber)
         name = newName;
         address = newAddress;
         phone = phoneNumber;
    public Name knowName()
         return name;
    public Address knowAddress()
         return address;
    public Phone knowPhone()
         return phone;
    public void writeToFile(PrintWriter outFile)
         outFile.println(name.knowFirstName());
         outFile.println(name.knowLastName());
         outFile.println(name.knowMiddleName());
         oufFile.println(address.knowStreet());
         outFile.println(address.knowState());
         outFile.println(address.knowCity());
         outFile.println(address.knowZip());
         outFile.println(phone.knowAreaCode());
         outFile.println(phone.knowDigits());
    Address:
    package addressBook;
    public class Address
         String street;
         String city;
         String state;
         String zipCode;
         public Address(String newStreet, String newCity, String newState, String zip)
              street=newStreet;
              city=newCity;
              state=newState;
              zipCode=zip;
         public String knowStreet()
              return street;
         public String knowCity()
              return city;
         public String knowState()
              return state;
         public String knowZip()
              return zipCode;
    }

  • Recieving cannot resolve symbol symbol  : class Serializable

    I'm receiving the error:
    cannot resolve symbol symbol : class Serializable
    The class is as follows:
    //package cscie160.hw5;
    import java.io.Serializable
    * @author Eddie Brodie
    * @version %I%, %G%
    public class AccountInfo implements Serializable
         public int _accountNumber;
         public int _pin;
         public AccountInfo(int accountNumber, int pin)
              _accountNumber = accountNumber;
              _pin = pin;
    I've tried importing java.*
    I've also checked my classpath.
    Any ideas?

    Try taking the import statement out of the comment block; that might help

Maybe you are looking for

  • Why make a portal Iview visible or not, contained in a portal page?

    Hi, Within the framework of a gate(portal) SAP, I have to make visible or no Iview. This Iview is contained in a page. I get back the role (PCD Role) of this page but I do not manage to change the attribute of Iview to make him(it) invisible. Here is

  • In web intelligence rich client, I want not to display "#multivalue"

    HI, experts, I have one question. Is there any function to eliminate #multivalue? like ISERROR which can be used in xcelsius... Thanks.

  • Different Srokes For Different TV's

    I also have this question posted in the DVD SP Discussions as well, but this may be a Final Cut thing... I made a project and used DVD Studio Pro 3.0.0 to make the menu and burn the finished DVD... I have now played it on three different televisions

  • Performance issue with Combo Box in xcelsius 2008 SP3

    Hi Experts , I started working on xcelsius 2008 , Later we migrated to Xcelsius 2008 SP3 . After migrting , performace of combobox went down and combox is taking time to scroll down the values . Did any one face this issue . Please help me out . My c

  • Network Activity with material attachment Blocked

    I have a requirement as below: I need to create a network with standard set of activities (internal). But it should not be possible for users to do material attachment to the activities. Is it feasible ? Thanks is advance . regards Muraleedharan.R