[Basic For Loop] "cannot find symbol" in ForUpdate part

Dear All,
I wonder why the following is an error:
     for ( int x=0; x < 10; x = y ) {
          int y = x + 1;
     }The formal specification is
for ( ForInitopt ; Expressionopt ; ForUpdateopt ) Statement
However, as specified in http://java.sun.com/docs/books/jls/third_edition/html/statements.html#14.14, and if you disassemble the bytecode,
"ForUpdate" part is always evaluated after the included statement,
In other words, it is evaluated as:
     for ( ForInitopt ; Expressionopt ; ) {
          Statement(s);
          ForUpdateopt
     }Or
     for ( int x=0; x < 10;  ) {
          int y = x + 1;
          x = y;
     }So, the only reason I find "cannot find symbol" reasonable is just human convinience, but not technically correct.
What do you think?
Many thanks.

Very good asif but once again you have not answered
the question.
why?My answer may be partialy correct.But you answer is fully correct.
And don't appreciate me.I'm not good at programming(in Java) like you.
The variable y has been declared inside the loop so
you cannot access in the loop header.
int y = 0;
for ( int x=0; x < 10; x = y ) {
y =  x + 1;
/code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Similar Messages

  • Cannot find symbol for some jms methods

    Hi, I'm new to JMS and am having trouble compiling the HelloWorld example. I am able to create a connection but for some reason I cannot create a session from the same connection. I am however able to call some of the other methods such as getClientID, start, and close. Below is a copy of what i have compiled so far (which is basically a copy of the example code), the error message I get, and what I have CLASSPATH set to. If my CLASSPATH is not set correctly, I would assume none of the code would compile which is very confusing. Any help is appreciated, thanks!
    //Step 1:
    //Import the JMS API classes.
    import javax.jms.ConnectionFactory;
    import javax.jms.Connection;
    import javax.jms.Session;
    import javax.jms.MessageProducer;
    import javax.jms.MessageConsumer;
    import javax.jms.Queue;
    import javax.jms.Session;
    import javax.jms.Message;
    import javax.jms.TextMessage;
    import javax.jms.*;
    //Import the classes to use JNDI.
    import javax.naming.*;
    import java.util.*;
    public class HelloWorldMessage
    public static void main(String[] args){
         System.out.println("Hello World!");
         try{
    Queue myQueue;
         // Instantiate a Oracle GlassFish(tm) Server Message Queue ConnectionFactory administered object
         com.sun.messaging.ConnectionFactory myConnFactory = new com.sun.messaging.ConnectionFactory();
         // Create a connection to the Oracle GlassFish(tm) Server Message Queue Message Service.
         Connection myConn = myConnFactory.createConnection();
         myConn.getClientID();
         // Create a session within the connection.
         Session mySess = myConn.createSession(false, Session.AUTO_ACKNOWLEDGE);
         myQueue = new com.sun.messaging.Queue("world");
         myConn.close();
         catch(Exception jmse){
         System.out.println("Exception occurred : " + jmse.toString());
    jmse.printStackTrace();
    # javac HelloWorldMessage.java
    HelloWorldMessage.java:39: cannot find symbol
    symbol : method createSession(boolean,int)
    location: interface javax.jms.Connection
         Session mySess = myConn.createSession(false, Session.AUTO_ACKNOWLEDGE);
         ^
    1 error
    # echo $CLASSPATH
    .:/usr/java/default/j2sdkee1.3/lib/j2ee.jar:/usr/java/default/j2sdkee1.3/lib/:/root/MessageQueue/mq/lib/fscontext.jar:/usr/lib/jvm-exports/java-1.6.0-openjdk-1.6.0.0.x86_64/jndi.jar:/root/MessageQueue/mq/lib/jms.jar:/root/MessageQueue/mq/lib/imq.jar:/root/MessageQueue/mq/lib/jaxm-api.jar:/root/MessageQueue/mq/lib/imqxm.jar:/root/MessageQueue/mq/lib/imqservlet.jar
    Edited by: 883631 on Sep 6, 2011 4:03 PM

    You have an old j2ee.jar from 1.3 in your CLASSPATH.
    Can you move jms.jar and imq.jar in front of that old j2ee.jar?
    Thx/

  • Issue with - "cannot find symbol - variable JOptionPane"

    need some help, got the below loop and want it to be able to loop by the number input by the input dialog. when i compile it i get an error in BlueJ. the error is "cannot find symbol - variable JOptionPane". Any help. have tried a few things however cannot get this to work at all. any suggestions?
    public void numberLoop()
    String qA = JOptionPane.showInputDialog(null,"How many times should this be completed (e.g. 1,2,3,4)?","Question",JOptionPane.QUESTION_MESSAGE);
    int qA2 = Integer.parseInt(qA);
    for (int startNum = 1; startNum <= qA2; startNum++)
    System.out.println(startNum + " squared is " + (startNum * startNum));
    }

    never mind i fixed it. forgot the below.
    import javax.swing.JOptionPane;
    LOL

  • Cannot find symbol error with ArrayList

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

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

  • "Cannot find Symbol" error message

    I have a "cannot find symbol" error message on line 5 below in
    the driver class.
    Thank you for your assistance
    1 public class GameLauncher
    2 {
    3  public static void main(String[] args)
    4 {
    5   GuessGame game = new GuessGame();
    6   game.startGame();
    7 }
    8}
    public class GuessGame
      public void startGame()
      Player p1;
      Player p2;
      Player p3;
      int guessp1 = 0;
      int guessp2 = 0;
      int guessp3 = 0;
      boolean p1isRight = false;
      boolean p2isRight = false;
      boolean p3isRight = false;
      int targetNumber = (int) (Math.random() * 10);
      System.out.println(" I'm thinking of a number between 0 and 9....");
      while(true)
        p1.guess();
        p2.guess();
        p3.guess();
        guessp1 = p1.number;
        System.out.println("Player one guessed " + guessp1);
        guessp2 = p2.number;
        System.out.println("Player two guessed " + guessp2);
        guessp3 = p3.number;
        System.out.println("Player three guessed " + guessp3);
        if (guessp1 == targetNumber)
          p1isRight = true;
        if (guessp2 == targetNumber)
          p2isRight = true;
        if (guessp3 == targetNumber)
          p3isRight = true;
        if ( p1isRight || p2isRight || p3isRight)
          System.out.println("We have a winner ! ");
          System.out.println("Player one got it right? " + p1isRight);
          System.out.println("Player two got it right? " + p2isRight);
          System.out.println("Player three got it right? " + p3isRight);
          System.out.println("Game is over ! ");
          break; //game is over so break out of loop
        else
          //we must keep going because no one guessed the number !
          System.out.println(" Players will have to try again ! ");
        } // end of if/else
      } // end of loop
    } // end of startGame() method
    } //end of class
    public class Player
      int number = 0;   // the guess is stored here
      public void guess()
        System.out.println(" I'm guessing " + number);
    ---------------------------------------------------------------  

    Thank you . You were right . I didn't set up the classes correctly.
    I corrected a few other errors and the program runs ok !
    Below is the corrected code and the output
    public class GameLauncher
      public static void main(String[] args)
       GuessGame game = new GuessGame();
       game.startGame();
    /* One possible set of output is
    I'm thinking of a number between 0 and 3....
    I'm guessing 1
    I'm guessing 3
    I'm guessing 0
    Player one guessed 1
    Player two guessed 3
    Player three guessed 0
    We have a winner !
    Player one got it right? true
    Player two got it right? false
    Player three got it right? false
    Game is over !
    public class Player
      int number = 0;   // the guess is stored here
      public void guess()
        number = (int)(Math.random() * 4);
        System.out.println(" I'm guessing " + number);
    public class GuessGame
      public void startGame()
        int x = 0;
      Player p1 = new Player();
      Player p2 = new Player();
      Player p3 = new Player();
      int guessp1 = 0;
      int guessp2 = 0;
      int guessp3 = 0;
      boolean p1isRight = false;
      boolean p2isRight = false;
      boolean p3isRight = false;
      int targetNumber = (int) (Math.random() * 4);
      System.out.println("\n I'm thinking of a number between 0 and 3....\n");
      while(x <5)
        p1.guess();
        p2.guess();
        p3.guess();
        guessp1 = p1.number;
        System.out.println("\nPlayer one guessed " + guessp1);
        guessp2 = p2.number;
        System.out.println("Player two guessed " + guessp2);
        guessp3 = p3.number;
        System.out.println("Player three guessed " + guessp3);
        if (guessp1 == targetNumber)
          p1isRight = true;
        if (guessp2 == targetNumber)
          p2isRight = true;
        if (guessp3 == targetNumber)
          p3isRight = true;
        if ( p1isRight || p2isRight || p3isRight)
          System.out.println("\nWe have a winner ! ");
          System.out.println("Player one got it right? " + p1isRight);
          System.out.println("Player two got it right? " + p2isRight);
          System.out.println("Player three got it right? " + p3isRight);
          System.out.println("Game is over ! ");
          break; //game is over so break out of loop
        else
          //we must keep going because no one guessed the number !
          System.out.println(" Players will have to try again ! ");
        } // end of if/else
        x = x + 1;
      } // end of loop
    } // end of startGame() method
    } //end of class 

  • Cannot find symbol: trying to index a method output

    The problem appears at the end of the code
    import java.util.*;
    public class Dreieck
      //Die Seiten des Dreiecks
      //Sides of triangle
       Object[] n= new Object[3];
       Object[] m= new Object[3];
       Object[] o= new Object[3];
      //Jede Seite erhält enthält 2 Eckpuckte und das anliegende Dreieck
      // Each side contains 2 corner ponts and the adjacent triangle
        Dreieck ( Punkt a, Punkt b, Punkt c, Dreieck e, Dreieck f, Dreieck g) {
        n[1]=a; n[2]=b; n[3]=e;
        m[1]=b; m[2]=c; m[3]=f;
        o[1]=c; o[2]=a; o[3]=g;
         int[] getside(Dreieck asker){
          if (n[3]== asker)
           return ((Punkt) m[2]).getposition();
         else if (m[3]== asker)
            return ((Punkt) o[2]).getposition();
         else if (o[3]== asker)
           return  ((Punkt) n[2]).getposition();
         // nur zum compilieren hinzugefügt
         else
          return ((Punkt) n[1]).getposition();
        int skaprod(int[] vec, int[] tor){
          return ((vec[1] * tor[1]) + (vec[2] * tor[2])) * Math.abs((vec[1] * tor[1]) + (vec[2] * tor[2])) /(((vec[1]*vec[1]) + (vec[2]*vec[2])) *((tor[1]*tor[1])+(tor[2]*tor[2])));
        int revskaprod(int[] vec, int[] tor){
          return ((vec[1] * (-tor[1])) + (vec[2] * (-tor[2]))) * Math.abs((vec[1] * (-tor[1])) + (vec[2] * (-tor[2]))) /(((vec[1]*vec[1]) + (vec[2]*vec[2])) *(((-tor[1])*(-tor[1]))+((-tor[2])*(-tor[2]))));
        void evertCheck(){
          int[] eins = ((Punkt) n[1]).getposition();
          int[] zwei = ((Punkt) n[2]).getposition();
          int[] drei = ((Punkt)  m[2]).getposition();
          int[] seiteA= {eins[1] -zwei[1],eins[2] -zwei[2]};
          int[] seiteB= {zwei[1] -drei[1],zwei[2] -drei[2]};
          int[] seiteC= {drei[1] -eins[1],drei[2]-eins[2]};
          int[] nachA1= {(e.asker(this))[1] -zwei[1],(e.asker(this))[2] -zwei[2]};
          //int[] NachB1=
          //int[] NachC1=
          //int[] NachA2=
          //int[] NachB2=
          //int[] NachC2=
    } Dreieck(triangle) is an incomplete class refering to the class Punkt(point):
    import java.util.*;
    public class Punkt
      int[] position = new int [2];
      LinkedList nachbarn = new LinkedList();
      Punkt(int a, int b){
      position[1]=a; position[2]=b; }
      int[] getposition() { return position; }
      void changeposition(int c,int d) {
       position[1]+=c; position[2]+=d; }
        }Anm: nachbarn = neighbours
    I am trying to calculate the vectors, to calculate the scalar products, to get the cos of the angle, to check for certain conditions occuring XD
    This class is part of an idea for a certain 2D physics system, basically instead of using collision checks or forcefields I connect the points with a network of lines
    and only let the points interact with their direct neighbours while also allowing "signals"to travel trough connections.
    Why do I do this? So that the O(n)= n (the needed processing power is only linearly dependant on number of points)
    Whats the challenge? Well its not easy to find conditions for reconnections so that points that are connected are relaitvely near to each other.
    Why such imprecision? Game phsysics does not always have to be precise besides when I operate with a large number of points things smoothen up statistically.
    Game physics? I have some interest in artificial life this system is part of me trying to write an artificial life simulation.
    Of course my current version is pretty clumsy but i hope it can be streamlined for processing power.

    I guess you interpreted "post" as this topic, when I meant the reply I gave you, then it would make sense you assume I have withold information.
    Cause there really is no specific information for me to provide, it was a simple forward problem of a cannot find symbol error.
    (I know that help can only be provided with enough information, thats why I gave you the whole code stated my intentions in the title as well as additional text etc., so you say thats the wrong "kind" of information?)
    As for your argument against compiling I must admit I do not understand it cause its a copy, paste and click action to compile the code.
    Ah but well thats not so important did not want to ruin your mood actually found the solution :)
    int[] nachA1= {(((Dreieck) n[3]).getside(this))[1] -zwei[1], (((Dreieck) n[3]).getside(this))[2]-zwei[2]};Edited by: casualPhilosoph on Jan 23, 2009 2:28 PM

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

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

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

  • Newbie question: cannot find symbol symbol: class STRING

    I've just decided to teach myself some java, and on my first try something's going wrong and I don't know what it is.
    I'm currently doing this tutorial: http://java.sun.com/docs/books/tutorial/uiswing/learn/example1.html
    and everything is good until I try to compile it and I get this error in the cmd
    HelloWorldSwing.java:30: cannot find symbol
    cannot find symbol
    symbol: class STRING
    everything has been written verbatim from the tutorial, including "import javax.swing.*;"
    What's wrong with it and how do I fix it?

    Hi,
    I saw the coding that You had given a link in your post. Change the following
        public static void main(String[] args) {bye for now
    sat

  • Cannot find symbol class

    I am having a "Cannot find symbol" problem. My Java is a bit rusty so I'm not exactly sure what it could be. I have two classes, City and SisterCities. The SisterCities references the City class. The City class compiles fine. Both classes are part of the same package. However, when I compile SisterCities, I get the error. Could you please tell me how to get the second class to recognize the first (import, extends, not really sure. I've tried alot) Here are those two classes so far...
    ****** City ********
    package hw01;
    public class City
         public final String name;
         public final String country;
         public final City [] sisters;
    public City (String name, String country)
              // throw new RuntimeException ("Not implemented yet.");
              this.name = name;
              this.country = country;
              this.sisters = new City [0];
    public City (String name, String country, City [] sisters)
              // throw new RuntimeException ("Not implemented yet.");
              this.name = name;
              this.country = country;
              this.sisters = new City [sisters.length];
              for (int i = 0; i < sisters.length; i++) {
                   this.sisters[i] = sisters;
    public void setSisters (City [] sisters)
              // throw new RuntimeException ("Not implemented yet.");
              for (int i = 0; i < sisters.length; i++) {
                   this.sisters[i] = sisters[i];
    public String getName ()
              // throw new RuntimeException ("Not implemented yet.");
              return this.name;
    public String getCountry ()
              // throw new RuntimeException ("Not implemented yet.");
              return this.country;
    public City [] getSisters ()
              // throw new RuntimeException ("Not implemented yet.");
              return this.sisters;
    ******** SisterCities *********
    package hw01;
    import java.util.LinkedList;
    public class SisterCities
         public final LinkedList cityList;
    public SisterCities ()
              // throw new RuntimeException ("Not implemented yet.");
    public void addCity (City city)
              // throw new RuntimeException ("Not implemented yet.");
              this.cityList.add(city);
    public int getNumCities ()
              // throw new RuntimeException ("Not implemented yet.");
    public City getCity (int i)
              // throw new RuntimeException ("Not implemented yet.");

    final attribute members like "cityList" must be initialised when they're declared or inside the constructors
    if you want to compile, you'll also have to uncomment the "throws" in your methods (or return a value)
    (pay attention to the error messages the compiler gives you and paste them all when posting questions)

  • Cannot find symbol class entry

    .\ListGraph.java:26: cannot find symbol
    symbol : class Entry
    location: class Map
    for(Map.Entry<Stad,List<ListEdge>> me : nodes.entrySet())
    ^
    1 error
    this is what i get when i try to compile this code, its the lowest part thats getting errors:
    import java.util.*;
    import java.util.Map.*;
    import java.util.Map.Entry;
    class ListGraph{
         private HashMap<Stad,List<ListEdge>> nodes =
              new HashMap<Stad,List<ListEdge>>();
         public void addNode(Stad ny){
              nodes.put(ny, new ArrayList<ListEdge>());
         public void connect(Stad from, Stad to, String n, int v){
              List<ListEdge> fromList = nodes.get(from);
              List<ListEdge> toList = nodes.get(to);
              ListEdge e1 = new ListEdge(to, n, v);
              fromList.add(e1);
              ListEdge e2 = new ListEdge(from, n, v);
              toList.add(e2);
         public String toString(){
              String ret = "";
              for(Map.Entry<Stad,List<ListEdge>> me : nodes.entrySet())
                   ret += me.getKey()+": "+me.getValue()+"\n";
              return ret;
    }

    Bananen123 wrote:
    .\ListGraph.java:26: cannot find symbol
    symbol : class Entry
    location: class MapI don't get the same error, so I'm not sure what code you are actually trying to compile. Do you happen to have defined another class named Map in the default package?
    Also, please use code tags when posting code. Example: import java.util.*;
    import java.util.Map.*;
    import java.util.Map.Entry;
    class ListGraph{
        private HashMap<Stad,List<ListEdge>> nodes =
            new HashMap<Stad,List<ListEdge>>();
        public void addNode(Stad ny){
            nodes.put(ny, new ArrayList<ListEdge>());
        public void connect(Stad from, Stad to, String n, int v){
            List<ListEdge> fromList = nodes.get(from);
            List<ListEdge> toList = nodes.get(to);
            ListEdge e1 = new ListEdge(to, n, v);
            fromList.add(e1);
            ListEdge e2 = new ListEdge(from, n, v);
            toList.add(e2);
        public String toString(){
            String ret = "";
            for(Map.Entry<Stad,List<ListEdge>> me : nodes.entrySet())
                ret += me.getKey()+": "+me.getValue()+"\n";
            return ret;
    class Stad {}
    class ListEdge{ ListEdge(Stad s, String str, int i) {} }~

  • Cannot find Symbol :class CLOB

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

    you have mentioned about the class "studentList" but that class is not to be found in the code you have pasted. its instead "ListTest". And the "menu" function seems to b a part of "ListTest" class. Can you provide the structure of the classes "studentList" and "Student" so that the problem can be more clearly understood?
    also you are using the variable "Stdin" in the line int choice = Stdin.readInteger(); where as you have not declared this variable.
    in the "switch" statement you are calling two different functions for the same case "3" where as it should be "case 3" and "case 4" respectively.
    in the "main" you are calling the "menu" function without any parameter while you actually want to pass argument of type "studentList".

  • Java Error : cannot find symbol , symbol : class (jdk 1.6.0)

    Dear All,
    Please help me.
    I am running javac from a .bat file and i set the classpath in the bat file as follows.
    echo on
    :start
    set classpath = "C:\Program Files\Java\jdk1.6.0\bin;"
    set classpath = "C:\Program Files\Java\jdk1.6.0\jre\..\lib\tools.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\rt.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\i18n.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\sunrsasign.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\jce.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.6.0\jre\classes;C:\Program Files\Java\jdk1.6.0\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\ext\ldapsec.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\ext\mysql-connector-java-5.0.0-beta-bin.jar;C:\Program Files\Java\jdk1.6.0\jre\lib\ext\sunjce_provider.jar; C:\Program Files\Java\jdk1.6.0\ideset\system;C:\Program Files\Java\jdk1.6.0\ideset\system;C:\Program Files\Java\jdk1.6.0\studio\system;C:\Program Files\Java\jdk1.6.0\studio\modules\ext\j2ee-1.3.jar;C:\Program Files\Java\jdk1.6.0\studio\modules\ext\jaas-1.0.jar;C:\Program Files\Java\jdk1.6.0\studio\modules\autoload\activation.jar;C:\Program Files\Java\jdk1.6.0\studio\modules\ext\jms-1.0.2b.jar;C:\Program Files\Java\jdk1.6.0\studio\modules\ext\jta-spec1_0_1.jar;C:\Program Files\Java\jdk1.6.0\studio\modules\autoload\mail.jar;C:\Program Files\Java\jdk1.6.0\studio\modules\ext\AbsoluteLayout.jar;C:\Program Files\Java\jdk1.6.0\studio\modules\ext\sql.jar;C:\Program Files\Java\jdk1.6.0\studio\modules\ext\rowset.jar;C:\Program Files\Java\jdk1.6.0\studio\lib\ext\jdbc20x.zip;C:\Program Files\Java\jdk1.6.0\studio\modules\ext\servlet-2.3.jar;C:\Program Files\Java\jdk1.6.0\studio\beans\TimerBean.jar;c:\Program Files\Java\jdk1.6.0\ideset\tomcat401_base;C:\sms\com\;"
    cd C:\sms
    javac mainP.java
    pause
    i have few class files which are inherited to the main program using ' import com.Connection; '
    i am getting errors like
    mainP.java:482: cannot find symbol
    symbol : class Connection
    location: class mainP
    Connection connection = new Connection(ipAddress, port);
    I think it is because of some classpath error.
    please advice me.......
    Viju

    Actually, you have NO CLUE what he's trying to doActually he said what he is trying to do in his posting. It's no mystery. But that's all the information that's available. If you know something that isn't posted here why not say so?
    Your reply was a snide, rude, "You're stupid for doing it that way" answerMy reply was neither snide nor rude and implied none of what you impute to it. It was a proper and constructive suggestion. You are entitled to disagree with it, but that doesn't justify this immoderate outburst.
    Bottom line is, you chose to be nastyBottom line is you're just making this up. You are imputing motives to me without evidence. Don't do that.
    You are the type of person that makes searching forums and posting questions for assistance a near waste of time.I doubt that you'll find many regulars here that would agree with that assertion. When you have made over 16,000 posts here over ten years as I have, come back and we'll discuss it some more.
    Go back to grade school and ...I suggest you try it yourself. You're not adding anything except noise to the discussion. Try curbing your temper, and while you're at it have a good look at the Code of Conduct for these forums. You're verging on personal abuse here.
    And, additionally, I've used ANT in the past. Batch files are FAR AND AWAY easier to set up.In your opinion. I disagree entirely, and I have eleven years' experience with Java to back it up.
    As for CLASSPATH, I haven't done anything about setting it beyond installing the JDK since about 1999, and it has a dot in it as we speak.

  • "cannot find symbol" error - password checker class

    I had to make a program to check a password to make sure it had two letters, at least eight characters, and only numbers and letters. I'm pretty sure I have all of the checking correct but I can't make use of the method I made to do it. here is my code:
              if(password.LegalPassword())     
                   System.out.println("You enterend a valid password!");
              else
                   System.out.println("You have entered an invalid password!");
    class LegitPassword
                   //constructor
         public LegitPassword(String userPassword)
         public boolean LegalPassword (String userPassword)
                   int digitCounter = 0;
                   for(int i = 0; i < userPassword.length(); i++)
                             //is character a letter or number?
                        if(!(Character.isDigit(userPassword.charAt(i))) || !(Character.isLetter(userPassword.charAt(i))))
                             return false;
                             //is the password at least 8 characters?
                        if(userPassword.length() <= 8)
                             return false;
                             //count the digits
                        if(Character.isDigit(userPassword.charAt(i)))
                             digitCounter ++;
                   if(digitCounter <= 2)
                             return false;
         return true;
              }oh, and the exact error is:
    PasswordChecker.java:27: cannot find symbol
    symbol  : method LegalPassword()
    location: class java.lang.String
              if(password.LegalPassword())     
                         ^

    Here is the full code so that you can see how I declared password...
         public class PasswordChecker
              static Scanner console = new Scanner(System.in);
              public static void main(String[] args)
              String password;
              System.out.println("Please enter a new password.");
              System.out.println("Remember: Passwords must be at least eight characters"
                   + " consisting of only numbers and letters with at minimal two numbers.");
              System.out.print("Password: ");
                   password = console.nextLine();
              //LegitPassword thePassword = new LegitPassword(password);
              if(password.LegalPassword())     
                   System.out.println("You enterend a valid password!");
              else
                   System.out.println("You have entered an invalid password!");
    class LegitPassword
         public boolean LegalPassword (String userPassword)
                   int digitCounter = 0;
                   for(int i = 0; i < userPassword.length(); i++)
                             //is character a letter or number?
                        if(!(Character.isDigit(userPassword.charAt(i))) || !(Character.isLetter(userPassword.charAt(i))))
                             return false;
                             //is the password at least 8 characters?
                        if(userPassword.length() <= 8)
                             return false;
                             //count the digits
                        if(Character.isDigit(userPassword.charAt(i)))
                             digitCounter ++;
                   if(digitCounter <= 2)
                             return false;
         return true;
    }The error:
    PasswordChecker.java:27: cannot find symbol
    symbol  : method LegalPassword()
    location: class java.lang.String
              if(password.LegalPassword())Are you suggesting I change the method, LegalPassword, to accept no parameters?

  • "cannot find symbol class studentList" error

    Hi I get this error
    "cannot find symbol class studentList", but this class is at the same file and also it is in the same folder. so what's wrong .. and I checked the spelling it's the same.
    I should create an object named myList of type studentList
    and second, I call method menu() and pass it myList as actual parameter.
    so I called the function menu which is should be in the main too
    like this
    myList.menu();
    and menu method accepts as parameter an object of type studentList. and display the menu for the user to choose..
    here is part my program:
    public class ListTest
    {  public void menu(Student L) // accepts parameter
                   System.out.println("");
                System.out.println("Choose a number between 1 to 4");
                      System.out.println("1-Print Info of A Student ");          
                System.out.println("2-Print Info of All Students ");                          
               System.out.println("3-Display grade of A Specific student");                           
                System.out.println("4-Exit");
                System.out.println("");        
              int choice = Stdin.readInteger();
              while (choice != 5)
             switch (choice) {
                 case 1:
             L.PrintAStudent(int L);
             break;
              case 2:
            L.PrintAll();
            break;     
              case 3:
              L.DisplayGPA();
              break;
                 case 3:
                System.exit(0);
               break;
               default:
               System.out.println("wrong Number");
              System.out.println("Enter a number between 1 to 4 ");
               System.out.println("Enter 4 to Exit");
                break;
                System.out.println("");
                System.out.println("Choose a number between 1 to 4");
                System.out.println("1-Print Info of A Student ");          
                System.out.println("2-Print Info of All Students ");                          
               System.out.println("3-Display grade of A Specific student");                           
                System.out.println("4-Exit");
                System.out.println(""); 
                choice = Stdin.readInteger();
         }// end method menu
         public static void main(String args[ ])
         { studentList myList = new studentList();//myList object is created
    myList.menu();
                             }//end main
    }// end of class ListTest
              

    you have mentioned about the class "studentList" but that class is not to be found in the code you have pasted. its instead "ListTest". And the "menu" function seems to b a part of "ListTest" class. Can you provide the structure of the classes "studentList" and "Student" so that the problem can be more clearly understood?
    also you are using the variable "Stdin" in the line int choice = Stdin.readInteger(); where as you have not declared this variable.
    in the "switch" statement you are calling two different functions for the same case "3" where as it should be "case 3" and "case 4" respectively.
    in the "main" you are calling the "menu" function without any parameter while you actually want to pass argument of type "studentList".

  • Cannot find symbol class error

    hi there ,
    i am creating a min class that links several classes and i am doing the following
    public class Main{
         public static void main(String[] args){
         classOne a = new classOne();
    classTwo b = new classTwo();
    classThree c = new classThree();
    // more classes with the same as above
    i am saving all the classes in the same folder , and i am having this error twice with each line that i creat an instance for a class
    cannot find symbol
    symbol : class classOne

    are your classes all in the same package? do you in fact use packages?
    Your best bet to get help here is by creating a Short, Self Contained, Correct (Compilable), Example or SSCCE. This is a small application that you create that is compilable and runnable, and demonstrates your error, but contains no extraneous, unnecessary code that is not associated with your problem. To see more about this and how to create this, please look at this link:
    http://homepage1.nifty.com/algafield/sscce.html
    Remember, this code must be compilable and runnable.
    Also, if you do post your code, please use code tags so that your code will be well-formatted and readable. To do this, either highlight your code block and press the "code" button at the top above the message block or place the tag &#91;code&#93; at the top of your block of code and the tag &#91;/code&#93; at the bottom, like so:
    &#91;code&#93;
       // your code block goes here
    &#91;/code&#93;

Maybe you are looking for