Cannot resolve symbol : import

I've never had this type of error while doing a compile before.
Does this mean that java doesn't know where to find my org.nipr.gateway_ws.utils.ConnectionPoolSingleton?
    [javac] Compiling 1 source file to C:\Data\StateProcessWebService\Server\build\war\WEB-INF\classes
    [javac] C:\Data\StateProcessWebService\Server\src\org\nipr\StateProcess\impl\StateProcessImpl.java:20: cannot resolve symbol
    [javac] symbol  : class ConnectionPoolSingleton
    [javac] location: package utils
    [javac] import org.nipr.gateway_ws.utils.ConnectionPoolSingleton;
    [javac] ^
    [javac] C:\Data\StateProcessWebService\Server\src\org\nipr\StateProcess\impl\StateProcessImpl.java:265: cannot resolve symbol
    [javac] symbol  : variable ConnectionPoolSingleton
    [javac] location: class org.nipr.StateProcess.impl.StateProcessImpl
    [javac] ConnectionPooler pool = ConnectionPoolSingleton.instance( "stateProcess" );
    [javac] ^

Cool. Thanks.
I freaked when I first saw that. I added the missing java file and it compiled just fine.

Similar Messages

  • Cannot resolve symbol error even with class imported

    Hi
    I'm trying to print out a java.version system property but keep getting a
    cannot resolve symbol error
    symbol: class getProperty
    location: class java.lang.System
    I've looked at the API and getProperty() is a method of lang.System
    Can anyone throw any light?
    thanks
    import java.lang.System;
    class PropertiesTest {
        public static void main(String[] args) {
                String v = new System.getProperty("java.version");
                 System.out.println(v);
    }

    Thanks Jos
    It compiles but I now get a runtime error
    Exception in thread "main"
    java.lang.NoClassDefFoundError:PropertiesTest
    What do you reckon is the problem?
    thanks
    java -cp .;<any other directories or jars>
    YourClassNameYou get a NoClassDefFoundError message because the
    JVM (Java Virtual Machine) can't find your class. The
    way to remedy this is to ensure that your class is
    included in the classpath. The example assumes that
    you are in the same directory as the class you're
    trying to run.I know it's a bad habit but I've put this file (PropertiesTest.java) and the compiled class (PropertiesTest.class) both in my bin folder which contains the javac compiler

  • Import javax.ejb.EJBHome; cannot resolve symbol

    Hi i wonder if anyone can help me. I have read alot of the posts regarding this issue and have tried everything to do with the paths and environmental variables and even reinstalled everything.
    import javax.ejb.EJBHome; cannot resolve symbol
    This is the problem i keep getting and here are the paths that i set:
    SET PATH=c:\j2sdkee1.3\bin;c:\jdk1.3.1_01\bin;c:\jakarta-ant-1.3\bin
    SET ANT_HOME=c:\jakarta-ant-1.3
    SET JAVA_HOME=c:\jdk1.3.1_01
    SET J2EE_HOME=c:\j2sdkee1.3
    SET CLASSPATH=c:\j2sdkee1.3\lib\j2ee.jar;c:\jakarta-ant-1.3\lib\ant.jar;c:\jdk1.3.1_01\lib\tools.jar
    What am i doing wrong???

    Im not sure, everything looks ok to me, but here is what i tried:
    I wrote this little test class, and compiled it
    import javax.ejb.EJBHome;
    public class test
    public test()
    I got the same error you did (or similar)
    D:\>javac test.java
    test.java:1: package javax.ejb does not exist
    import javax.ejb.EJBHome;
    ^
    1 error
    then I added the j2ee.jar to my classpath and everything worked fine.
    here are my env vars:
    JAVA_HOME=d:\dev\jdk
    J2EE_HOME=d:\dev\j2sdkee
    CLASSPATH=...;%J2EE_HOME%\lib\j2ee.jar
    If I were you I would double check all the paths you have set up then try a simple case like the one above. If your running NT/2000 make sure the JAVA_HOME, J2EE_HOME and CLASSPATH are system variables not user variables. Another thing you can try is adding the j2ee.jar to the classpath with the -classpath compiler switch.
    javac -classpath %CLASSPATH%;d:\dev\j2sdkee\lib\j2ee.jar test.java
    Other than those things I'm not sure
    Good Luck

  • 'Cannot Resolve Symbol' error when importing custom class

    I get this error...
    c:\mydocu~1\n307\auto.java:14: cannot resolve symbol
    symbol: class Box
    import Box;
    ^
    when I try to compile auto.java, the applet that's supposed to import the class Box, which I built to be like a message box in VB. Here is the code for Box...
    import java.awt.*;
    import java.awt.event.*;
    public class Box extends Window{
         Label lblMsg = new Label();
         Button cmdOk = new Button("OK");
         Panel pnlSouth = new Panel();
         EventHandler ehdlr=new EventHandler(this);
         public Box(Frame parent){
              super(parent);
              setLayout(new BorderLayout());
              add(lblMsg, BorderLayout.NORTH);
              add(pnlSouth, BorderLayout.SOUTH);
              pnlSouth.setLayout(new FlowLayout());
              pnlSouth.add(cmdOk);
              cmdOk.addActionListener(ehdlr);
              this.addWindowListener(ehdlr);
         public void speak(String msg){
              lblMsg.setText(msg);
              this.setLocation(200,200);
              this.setSize(200,200);
              this.setVisible(true);
         private class EventHandler extends WindowAdapter
                        implements ActionListener{
              Window theWindow;
              public EventHandler(Window a){
                   theWindow=a;
              public void actionPerformed(ActionEvent e){
                   theWindow.setVisible(false);
    AND HERE IS THE CODE FOR AUTO...
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import Box;
    public class auto extends Applet implements ActionListener{
         Panel pnlCenter=new Panel();
         Panel pnlSouth=new Panel();
         Panel pnlNorth=new Panel();
         Panel pnlCenterleft=new Panel();
         Panel pnlCenterright=new Panel();
         Button cmdSubmit=new Button("Submit");
         Button cmdNext=new Button("Next");
         Button cmdPrev=new Button("Previous");
         Label lblLoc=new Label("LOCATION:");
         Label lblDate=new Label("DATE:");
         Label lblMile=new Label("MILEAGE:");
         Label lblCost=new Label("COST:");
         Label lblDesc=new Label("DESCRIPTION:");
         Label lblFind=new Label("FIND LOCATION:");
         Label lblDisp=new Label();
         TextField txtLoc=new TextField();
         TextField txtDate=new TextField();
         TextField txtMile=new TextField();
         TextField txtCost=new TextField();
         TextArea txtDesc=new TextArea();
         TextField txtFind=new TextField();
         Box bxOne = new Box((Frame(this).getParent()));
         /*by declaring these four variables here, they are instance level, meaning they are
         available to the whole applet*/
         String textFile="auto.txt";
         String list[] = new String[100];
         String sort[] = new String[100];
         int counter=0;
         int count=0;
         String currentLine="";
         int i;
         int sortcount;
         public void init(){
              this.setLayout(new BorderLayout());
              this.add(pnlNorth, BorderLayout.NORTH);
              this.add(pnlCenter, BorderLayout.CENTER);
              this.add(pnlSouth, BorderLayout.SOUTH);
              pnlNorth.setLayout(new FlowLayout());
              pnlNorth.add(new Label("VIEW RECORDS"));
              pnlCenter.setLayout(new GridLayout(1,2));
              pnlCenter.add(pnlCenterleft);
              pnlCenter.add(pnlCenterright);
              pnlCenterleft.setLayout(new GridLayout(0,1));
              pnlCenterleft.add(lblLoc);
              pnlCenterleft.add(lblDate);
              pnlCenterleft.add(lblMile);
              pnlCenterleft.add(lblCost);
              pnlCenterleft.add(lblDesc);
              pnlCenterleft.add(lblFind);
              pnlCenterright.setLayout(new GridLayout(0,1));
              pnlCenterright.add(txtLoc);
              pnlCenterright.add(txtDate);
              pnlCenterright.add(txtMile);
              pnlCenterright.add(txtCost);
              pnlCenterright.add(txtDesc);
              pnlCenterright.add(txtFind);
              pnlSouth.setLayout(new FlowLayout());
              pnlSouth.add(cmdPrev);
              pnlSouth.add(lblDisp);
              pnlSouth.add(cmdSubmit);
              pnlSouth.add(cmdNext);
              lblDisp.setText("0 of 0");
              cmdPrev.addActionListener(this);
              cmdNext.addActionListener(this);
              cmdSubmit.addActionListener(this);
         public void actionPerformed(ActionEvent e){
              String command=e.getActionCommand();
              if (command.equals("Next")){
                   if(txtLoc.getText().equals("")){
                        reader();
                        transfer();
                        writer();
                        bxOne.speak("Viewing all records");
                   }else{
                        if(counter<count-2){
                             counter++;
                             writer();
                        }else{
                             //don't move
              } else if (command.equals("Previous")){
                   if(txtLoc.getText().equals("")){
                        //do nothing
                   }else{
                        if(counter>0){
                             counter--;
                             writer();
                        }else{
                             //don't move
              } else {
                   txtLoc.setText("");
                   txtDate.setText("");
                   txtMile.setText("");
                   txtCost.setText("");
                   txtDesc.setText("");
                   reader();
                   sorter();
                   writer();
         private void writer(){
              StringTokenizer stCurrent=new StringTokenizer(sort[counter], "\t");
              txtLoc.setText(stCurrent.nextToken());
              txtDate.setText(stCurrent.nextToken());
              txtMile.setText(stCurrent.nextToken());
              txtCost.setText(stCurrent.nextToken());
              txtDesc.setText(stCurrent.nextToken());
              lblDisp.setText(String.valueOf(counter+1) + " of " + String.valueOf(count-1));
         private void reader(){
              try{
                   URL textURL=new URL(getDocumentBase(), textFile);
                   InputStream issIn=textURL.openStream();
                   InputStreamReader isrIn=new InputStreamReader(issIn);
                   BufferedReader brIn=new BufferedReader(isrIn);
                   while(currentLine!=null){
                        currentLine=brIn.readLine();
                        list[count]=currentLine;
                        count++;
              }catch(MalformedURLException exc){
              System.out.println("MalformedURLException Error");
              }catch(IOException exc){
              System.out.println("IOException Error");
              }catch(NullPointerException exc){
              System.out.println("NullPointerException Error");
         private void transfer(){
              for(i=0;i<count;i++){
                   sort=list[i];
         private void sorter(){
              sortcount=0;
              String find=txtFind.getText();
              System.out.println(String.valueOf(count));
              for(i=0;i<count-1;i++){
                   StringTokenizer st=new StringTokenizer(list[i], "\t");
                   String next=st.nextToken();
                   if (find.equals(next)){
                        sort[sortcount]=list[i];
                        sortcount++;
              count=sortcount+1;
    Any help is greatly appreciated.
    2Willis4

    Hi agian,
    I looked closer at your code, I think if you play around with directories and paths, you'll get it, and I think also when you import, you have to have put the class in a package...? Maybe? Blind leading the blind here! So at the top of your box class you have to say something like
    package org.blah.lala
    and you have to have that directory structure for the class files org/blah/lala/Box.class
    Does that make sense?
    And then when you import you say:
    import org.blah.lala.Box
    (I think)
    I cna only imagine that this 'help' I am giving you would be hilarious to a more experienced programmer!
    Anyway, best of luck.

  • "Cannot resolve symbol" error when importing a package

    I'm new to Java and have been trying to make use of a toolikt which uses an imported package. Basically my problem is that I've been trying to compile a file called CookBook.java which contains the following import statements at the top of the file:
    package gate;
    import java.util.*;
    import java.net.*;
    import java.io.*;
    import junit.framework.*;
    import gate.*;
    import gate.util.*;
    import gate.creole.*;
    import gate.creole.nerc.*;
    I then compile this using the following command line:
    /cygdrive/c/jdk1.3.1_01/bin/javac.exe      \
         -classpath "C:\cygwin\home\stevens1\gate_src\gate\build\gate.jar" \
         -extdirs "C:\cygwin\home\stevens1\gate_src\gate\lib\ext"     \
         -d . CookBook.java
    (The extdirs command is required, acording to the manual, because the toolkit is implemented as two files for security reasons: gate.jar and guk.jar) These two flags should point to all the .jar files required by the application.
    However, that command produces the following errors:
    CookBook.java:140: cannot resolve symbol
    symbol : method assertTrue (java.lang.String,boolean)
    location: class gate.CookBook
    assertTrue(
    ^
    CookBook.java:146: cannot resolve symbol
    symbol : variable GateConstants
    location: class gate.CookBook
    GateConstants.ORIGINAL_MARKUPS_ANNOT_SET_NAME);
    ^
    CookBook.java:152: cannot resolve symbol
    symbol : method assertTrue (java.lang.String,boolean)
    location: class gate.CookBook
    assertTrue(
    ^
    One thing I've not been clear on is whether the files (CookBook.java) need to be in a directory with a special name. I've tried playing about with different ones but without much success.
    Any suggestions to help a completely confused Java rookie would really be apreciated!
    thanks in advance
    mark

    I then compile this using the following command line:
    /cygdrive/c/jdk1.3.1_01/bin/javac.exe \
    -classpath "C:\cygwin\home\stevens\gate_src\gate\build\gate.jar" \
    -extdirs "C:\cygwin\home\stevens1\gate_src\gate\lib\ext" \
    -d . CookBook.javaThere are a couple of issues with your compile...
    Most notably, by setting the classpath to your build jar, you are compiling against old classes. If you set your classpath rather to the base of your package hierarchy, then javac will to some degree review and recompile dependencies, against your current source files. If you specify a target directory with -d, class files will be examined in this location if they aren't in the class path (And their source file is not in the compile-path)
    Also, if you are compiling packages, I've found a good practice to be to compile from the base of the package structure, so your command will be more likejavac \
    -classpath . \
    -extdirs "C:\cygwin\home\stevens1\gate_src\gate\lib\ext" \
    gate\\CookBook.javaIt seems to make it easier for the compiler to 'correctly' look up dependencies.
    Hope that helps, at least a little,
    -Troy

  • Import java.util.Formatter - cannot resolve symbol

    I use j2sdk1.4.2_04
    when I try to compile my program using Formatter, it response error "cannot resolve symbol"
    Pls help!

    Where did you get this java.util.Formatter from? If you check the official 1.4.2 API for Java, that class does not exisit! However, java.util.logging.Formatter, does exisit...
    http://java.sun.com/j2se/1.4.2/docs/api/
    If you ment: java.util.logging.Formatter have you checked the API to make sure you are using it correctly???
    HTH.

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

  • Cannot resolve symbol: class EJBObject

    Using javac I get this compile error on this file Calculator.java
    Calculator.java:1: cannot resolve symbol
    symbol : class EJBObject
    location: package ejb
    import javax.ejb.EJBObject;
    ^
    Calculator.java:5: cannot resolve symbol
    symbol : class EJBObject
    location: interface Calculator
    public interface Calculator extends EJBObject {
    Source code for Calculator.java
    import javax.ejb.EJBObject;
    import java.rmi.*;
    public interface Calculator extends EJBObject {
         public long add (int x, int y) throws RemoteException;
         public long subtract (int x, int y) throws RemoteException;

    This code is from a book, so I will assume its a classpath problem. My
    classpath looks like:
    "C\QTJava.zip".;%J2EE_HOME%\lib\j2ee.jar;%J2EE_HOME%\lib\locale
    Also the following enviorment varibales have been set to:
    J2EE_HOME
    C:\Development\Java\j2sdkee1.3.1
    JAVA_HOME
    C:\Development\Java\jdk1.3.1
    Path
    %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Common Files\Adaptec Shared\System;%JAVA_HOME%\bin;%J2EE_HOME%\bin
    I can run j2EE, like "j2EE -verbose" (no problems)
    also run cloudscape, like "cloudscape -start" (no problems)
    also can run deploytool, like "deploytool" (no problems, & deploy sample ear files from cd book)
    Your help is appreicated.

  • Cannot resolve symbol class graphics

    does anyone know what the error
    cannot resolve symbol class graphics means?
    with this code i can't seem to call the graphics method to draw the line....any reason why?
    import javax.swing.*;
    import java.*;
    public class LineDraw extends JFrame {
        public static void main(String[] args) {
            LineDraw ld = new LineDraw();
            ld.setSize(500,500);
            ld.setVisible(true);
            ld.enterVariables();
        public void init(){
        private int x1;
        private int x2;
        private int y1;
        private int y2;
        public void paint(Graphics g) {
            g.GetGraphics(g);
            super.paintComponent(g);
            g.drawLine(x1, y1, x2, y2);
        public void enterVariables() {
            x1 = Integer.parseInt(JOptionPane.showInputDialog("Enter x1:"));
            y1 = Integer.parseInt(JOptionPane.showInputDialog("Enter y1:"));
            x2 = Integer.parseInt(JOptionPane.showInputDialog("Enter x2:"));
            y2 = Integer.parseInt(JOptionPane.showInputDialog("Enter y2:"));
            repaint();
    }

    well the exact error message is ...by the way now that i think about it
    if the graphics method shoudl not be part of the JFrame class then what method would i use to draw 2D Graphics?
    --------------------Configuration: <Default>--------------------
    C:\Documents and Settings\c1s5\My Documents\LineDraw.java:21: cannot resolve symbol
    symbol : class Graphics
    location: class LineDraw
    public void paint(Graphics g)
    ^
    1 error
    Process completed.
    and the exact code is
    import javax.swing.*;
    import java.*;
    public class LineDraw extends JFrame {
        public static void main(String[] args) {
            LineDraw ld = new LineDraw();
            ld.setSize(1024,500);
            ld.setVisible(true);
            ld.enterVariables();
        private int x1;
        private int x2;
        private int y1;
        private int y2;
        public void paint(Graphics g)
            super.paintComponent(g);
            g.drawLine(x1, y1, x2, y2);
        public void enterVariables() {
            x1 = Integer.parseInt(JOptionPane.showInputDialog("Enter x1:"));
            y1 = Integer.parseInt(JOptionPane.showInputDialog("Enter y1:"));
            x2 = Integer.parseInt(JOptionPane.showInputDialog("Enter x2:"));
            y2 = Integer.parseInt(JOptionPane.showInputDialog("Enter y2:"));
            repaint();
    }

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

  • Cannot resolve symbol class Scanner (Error)

    For whatever reason I get the error message "cannot resolve symbol class Scanner" when trying to run this:
    import java.io.*;
    import java.util.*;
    public class NameReversal
         public static void main(String args[])
              System.out.print("Enter your name: ");
              Scanner Reader = new Scanner(System.in);
              String first = Reader.next();
              String finl = Reader.next();
              int z = first.length();
              int v = finl.length();
              int y = z-1;
              int f = y-1;
              for(int i = y; i>=0; z--)
              System.out.print(first.charAt(1));
              System.out.print(" ");
              for(int p = f; p >= 0; p--)
              System.out.println(finl.charAt(p));
    }

    The Scanner class is in the JDK version 1.5 or later. You must be using an earlier version.

Maybe you are looking for

  • Acrobat Pro 7, Adobe Reader 8, and Filled out forms

    My head is spinning with all the "Acrobat features" that seem to be in Acrobat, but actually aren't. At least not in the version I always seem to have. I wish Adobe would be more diligent in explaining what features are are in which version and what

  • Problem in hierarchy input

    Dear All, I have a hierarchy on cost element infoobject... I am using this in a report and have restricted costelement with hierarchy variable..But when i execute report while giving input for cost element it shows hierarchy and cost elements which a

  • What is the evaluation order of Page Items

    I just wonder what the execution order of page item assignments are in the page rendering process. Sequence (+ Region), Type of items, more clever by checking dependencies ?? I couldn't find anything here, or looked with the wrong keywords. I just ne

  • Multiple validate events generated for a new matrix

    I have added a new tab to the item master form which has a matrix grid on it. This works fine until I attempt to move to the previous or next record whilst the new tab is visible. What happens then is that every column on every line of the matrix cau

  • Password Protect PDF's ??

    Hello, I currently have Adobe Reader XI and was wondering how, or what software is needed to be able to password protect pdf's so that we can securely send our clients information. Thanks!