Cannot resolve symbol, yet another one

Well i've looked into this one more then once... i know the code is good but i still get the error...
Thanks for any help!
D:\java\appletSort.java:62: cannot resolve symbol
symbol  : variable i
location: class appletSort
                    if(data.equals(namn))
^
1 error
Tool completed with exit code 1
     //data f�r v�rdet i inruta
     String data=inruta.getText();
     //rensa utruta
     utruta.setText("");
     //inruta testas med alla tidigare inskrivna poster
     for(int i=0;namn[i]!=null;i++);
          //om "data" finns i posten, skriv ut
(62)     if(data.equals(namn[i]))
               utruta.append(data+"\n");
          else
               //felmeddelande om s�kningen inte gav n�gra tr�ffar
               utruta.setText("S�kningen gav inga tr�ffar");

hehe =P oops, thx alot i totally missed that one, well... that happens =P

Similar Messages

  • Yet another cannot resolve symbol

    I'm having a similar problem to many others that have posted here but having tried every suggestion I'm still stuck.
    My Platform: java 2 1.4.1_01 on WinNT 4.0 SP 6a.
    I've created a class Career which compiles without any problems. I have also created a CareerList class which takes an array of Career objects as an attribute, and it's here that the 'cannot resolve symbol' error occurs.
    CareerList.java:10: cannot resolve symbol
    symbol : class Career
    location: class CareerList
    private Career[] careers;
    I have calls to Career objects occuring 4 times within CareerList and get this error occurs wherever the Career class is called, whether it's an array or an individual object.
    It appears that it cannot find the Career class, although it is there. I am running javac from the directory where all the required classes are held and have also tinkered with the classpath settings.
    I have set the Path variable inside the System Variables to point to <java_home>\bin, and have also tried setting the CLASSPATH inside User Variables to the directory where the class files are stored. This has not solved the problem.
    There does not appear to be any typo's within the code.
    Any ideas what it could be would be greatly appreciated as I've been stuck at this point for a couple of days.

    If you want the root directory of some package(s) to be c:\java\programs\c and the root directory of other package(s) to be c:\java\programs\d, then you have to have those directories in the Classpath - that's how classes are found. This will work but it means adding to your classpath with (nearly) each package.
    Or, you could make c:\java\programs the root directory of all packages.
    Or, you could use the -classpath option of javac and java so you would only include needed directories.
    Or, you could just use the current directory (.) as your classpath.
    You can use all or any combination of the above options as well. I use the second and fourth options, but I do not program for a living so my needs are simple.

  • 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

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

  • 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" when compiling a class that calls methods

    I am currently taking a Intro to Java class. This problem has my instructor baffled. If I have two classes saved in separate files, for example:
    one class might contain the constructor with get and set statements,
    the other class contains the main() method and calls the constructor.
    The first file compiles clean. When I compile the second file, I get the "cannot resolve symbol error" referring to the first class.
    If I copy both files to floppy and take them to school. I can compile and run them with no problem.
    If I copy the constructor file to the second file and delete the "public" from the class declaration of the constructor, it will compile and run at home.
    At home, I am running Windows ME. At school, Windows 2000 Professional.
    The textbook that we are using came with a CD from which I downloaded the SDK and Runtime Environment. I have tried uninstalling and reinstalling. I have also tried downloading directly from the Sun website and still the error persists.
    I came across a new twist tonight. I copied class files from the CD to my hard drive. 4 separate files. 3 of which are called by the 4th.
    I can run these with no problem.
    Any ideas, why I would have compile errors????
    Thanks!!

    Oooops ... violated....
    Well first a constructor should have the same name as the class name so in our case what we have actually created is a static method statementOfPhilosophy() in class SetUpSite and not a constructor.
    Now why does second class report unresolved symbol ???
    Look at this line
    Class XYZ=new XYZ();
    sounds familiar, well this is what is missing from your second class, since there is no object how can it call a method ...
    why the precompiled classes run is cuz they contain the right code perhaps so my suggestion to you is,
    1) Review the meaning and implementation of Constructors
    2) Ask your instructor to do the same ( no pun intended ... )
    3) Check out this for understanding PATH & CLASSPATH http://www.geocities.com/gaurav007_2000/java/
    4) Look at the "import" statement, when we have code in different files and we need to incorporate some code in another it is always a good idea to use import statement, that solves quite a few errors.
    5) Finally forgive any goof up on this reply, I have looked at source code after 12 months of hibernation post dot com doom ... so m a bit rusty... shall get better soon though :)
    warm regards and good wishes,
    Gaurav
    CW :-> Mother of all computer languages.
    I HAM ( Radio-Active )
    * OS has no significance in this error
    ** uninstalling and reinstalling ? r u nuttttttts ??? don't ever do that again unless your compiler fails to start, as long as it is giving a valid error it is working man ... all we need to do is to interpret the error and try to fix the code not the machine or compiler.

  • "cannot resolve symbol" error when using super.paintComponent

    I am trying to override the paintComponent method in a class extending a JFrame, but when I call super.paintComponent(g) from inside the overridden method I get the error
    QubicGUI.java:63: cannot resolve symbol
    symbol : method paintComponent (java.awt.Graphics)
    location: class javax.swing.JFrame
    super.paintComponent(g);
    ^
    1 error
    I can't see where I am deviating from examples I know work. It is a very small program, so I have included it here:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.io.IOException;
    import javax.imageio.ImageIO;
    import java.net.URL;
    class QubicGUI extends JFrame
         private int width;
         private int height;
         private Image background;
         public int getWidth()
         {     return width;     }
         public int getHeight()
         {     return height;     }
         public boolean isOpaque()
    return true;
         public QubicGUI()
              super("Qubic"); //set title
              // The following gets the default screen device for the purpose of finding the
              // current settings of height and width of the screen
         GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
              GraphicsDevice device = environment.getDefaultScreenDevice();
              DisplayMode display = device.getDisplayMode();
              width = display.getWidth();
              height = display.getHeight();
              // Here we set the window to cover the entire screen with a black background, and
              // remove the decorations. (This includes the title bar and close, minimize and
              // maximize buttons and the border)
              setUndecorated(false);
              setVisible(true);
              setSize(width,height);
              setResizable(false);
              setBackground(Color.black);
              // Initializes the background Image
              Image background = Toolkit.getDefaultToolkit().getImage("background.gif");
              // This is included for debugging with a decorated window.
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    } // end constructor
              public void paintComponent(Graphics g)
                   super.paintComponent(g);     
              } // end paintComponenet
    } // end QubicGUI

    Two things I want to know:
    1. I was trying to access a variable as JLabel
    myLabel; defined in the constructor of a class from
    the constructor of another class. I got this error
    message - "Cannot access non-static variable from a
    static context". Why(When both are non-static am I
    getting the message as static context)?Post some code. It's hard to pinpoint a syntax error like that without seeing the code.
    Also, there may be cleaner ways of doing what you want without having classes sharing labels.
    2. I am using a map to set the attributes of a font.
    One of the key-value pair of the map is
    TextAttributesHashMap.put(TextAttribute.FOREGROUND,Colo
    .BLUE);
    But when I using the statement g.drawString("First
    line of the address", 40, 200); the text being
    displayed is in black and not blue. Why?You need to use the drawString that takes an AttributedCharacterIterator:
    import java.awt.*;
    import java.awt.font.*;
    import java.text.*;
    import javax.swing.*;
    public class Example  extends JPanel {
        public static void main(String[] args)  {
            JFrame f = new JFrame("Example");
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            Container cp = f.getContentPane();
            cp.add(new Example());
            f.setSize(400,300);
            f.setLocationRelativeTo(null);
            f.setVisible(true);
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            String text = "Every good boy does fine always";
            AttributedString as = new AttributedString(text);
            as.addAttribute(TextAttribute.FAMILY, "Lucida Bright");
            as.addAttribute(TextAttribute.SIZE, new Float(16));
            as.addAttribute(TextAttribute.FOREGROUND, Color.BLUE, 0, 5);
            as.addAttribute(TextAttribute.FOREGROUND, Color.GREEN, 6, 10);
            as.addAttribute(TextAttribute.FOREGROUND, Color.RED, 11, 14);
            as.addAttribute(TextAttribute.FOREGROUND, Color.YELLOW, 15, 19);
            as.addAttribute(TextAttribute.FOREGROUND, Color.MAGENTA, 20, 24);
            as.addAttribute(TextAttribute.FOREGROUND, Color.CYAN, 25, 31);
            g.drawString(as.getIterator(), 10, 20);

  • Cannot resolve symbol..Swing / MDI

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

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

  • Cannot resolve symbol trouble

    Hi everyone!
    I'm trying to get started with J2ME programming, which is actually going great so far, except that I've hit a wall.
    I need to use floating point numbers, which aren't supported when using MIDP, so I'm trying to use an addon, namely henson.midp (http://henson.newmail.ru/j2me/Float.htm).
    I've saved the .java file to the correct directory, and it is of course being compiled along with the other files, however, I can only create .Float variables and not access functions, it seems.
    henson.midp.Float f; // OK
    f = henson.midp.Float(1234); // cannot resolve symbol error, arrow pointing at the dot between 'henson' and 'midp'
    I suppose I'm doing something wrong, but what? :)
    Help would be greatly appreciated.
    /Confused java newbie

    More trouble on the way, it seems!
    Because of some trouble I'm having with the henson class, I figured I'd try another one, so I downloaded 'Real' (http://gridbug.ods.org/Real.html) again, and tried a simple
    Real a = new Real("0.5");... as used in the sample, and also by myself yesterday.
    Well guess what, more cannot resolve symbol trouble.
    C:\...\src\CurrEx.java:123: cannot resolve symbol
    symbol  : class Real
    location: class CurrEx
                             Real a = new Real("0.5");
                                            ^
    C:\...\src\CurrEx.java:123: cannot resolve symbol
    symbol  : class Real
    location: class CurrEx
                             Real a = new Real("0.5");
                                                         ^
    2 errors
    com.sun.kvem.ktools.ExecutionException
    Build failedAgain, the source file is in the correct directory and it is getting compiled along with the rest, and I'm pretty sure that at least the code (1 line) is correct this time.

  • JSP page "cannot resolve symbol"

    Hi,
    I'm using j2sdk1.4.2_01 and tomcat-5.0.13. I'm developing within Eclipse 3.0.0 with the Tomcat plugin.
    In my project ("Agenda2") i only created one class ("Persona"), that is correctely compiled (%TOMCAT_HOME%\webapps\Agenda2\WEB-INF\src\Persona.java results in %TOMCAT_HOME%\webapps\Agenda2\WEB-INF\classes\Persona.class, and 0 problems are shown in the Problems list.
    In %TOMCAT_HOME%\webapps\Agenda2 i have my Edit.jsp, that begins with these lines:
    <%@ page language="java" contentType="text/html" %>
    <HTML>
    <HEAD>
    <TITLE>Edit</TITLE>
    </HEAD>
    <BODY>
    <jsp:useBean id="personaAtt" class="Persona">
        <jsp:setProperty name="personaAtt" property="*" />
    </jsp:useBean>
    ....When i call the JSP from the browser, i get this error:
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 8 in the jsp file: /Edit.jsp
    Generated servlet error:
        [javac] Compiling 1 source file
    C:\Programmi\Java\tomcat-5.0.13\webapps\Agenda2\work\org\apache\jsp\Edit_jsp.java:48: cannot resolve symbol
    symbol  : class Persona
    location: class org.apache.jsp.Edit_jsp
          Persona personaAtt = null;
          ^The error message mentions line 8, which is the one following <BODY>, that is
    <jsp:useBean id="personaAtt" class="Persona">My impression is that there is some path problem, but despite my tries i can't get it.
    The folders tree under %TOMCAT_HOME%\webapps\Agenda2\ is:
    -WEB-INF
    --classes
    --lib
    --src
    -work
    --org
    ---apache
    ----jspDoes anybody can see the problem ?

    Thanks! I'm going to try to put the class into a package as both you have suggested, and i'll post here the result.
    In the meantime i have a related newbie question:
    putting the class into a package, is this kind of a workaround, or it's the "normal thing" ?
    I mean, is it mandatory to put classes into a package in order to import them from JSP pages ?
    It was my understanding that it isn't mandatory, but - from your replies and many other posts in this forum - i'm starting to think that i'm wrong.

  • Solaris Deployment Failure for cannot resolve symbol on PersistentContainer

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

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

  • Cannot resolve symbol when the classes are in the same package

    i have one interface and two classes all in the same package. am getting " cannot resolve symbol", when the code refers to the interface or the class .
    the package name is collections.impl and
    the directory i used to store all the java files:
    c:\jdk\bin\collections\impl.
    isthere any othe option other than compiling all the files from the comand line at the same time?
    please help - i m new to java.

    If you have:
    I.java:
    package some;
    public interface I {
        void method();
    }A.java:
    package some;
    public class A implements I {
        public void method() {
            new B();
    }B.java:
    package some;
    public class B implements I {
        public void method() {
            new A();
    }in c:/temp/some for example
    you can compile your files with
    javac c:/temp/some/*.java
    It seems that you have errors in your code.
    Recheck it twice or use NetBeans IDE(http://www.netbeans.org) it will do this for you ;)

  • Cannot resolve symbol

    Hello,
    I'm brand new to Java. Why is it that the compiler will not recognize my return variable??
    Thanks
    import javax.swing.*;
    import java.text.*;
    class BookOrder
         public static void main(String[] values)
              String bookCode = JOptionPane.showInputDialog("Enter your book code");
              String getResults = getResults(bookCode);
              System.exit(0);
         //End of main
         private static String getResults(String bookCode)
              if(bookCode.equals("wp"))
                   {String codeLabel = "War and Peace";}
              else if(bookCode.equals("pr"))
                   {String codeLabel = "Politics and Religion";}
              return codeLabel;
    C:\jdk1.3.1\myClasses\BookOrder.java:21: cannot resolve symbol
    symbol : variable returnCode
    location: class BookOrder
              return returnCode;
    ^

    You are out of scope. If that does not make sense, then please pick up a book on basic programming skills and start reading in chapter one. But, here is how I would fix:
    import javax.swing.*;
    import java.text.*;
    class BookOrder
    public static void main(String[] values)
    String bookCode = JOptionPane.showInputDialog("Enter your book code");
    String getResults = getResults(bookCode);
    System.exit(0);
    //End of main
    private static String getResults(String bookCode)
    String codeLabel = "";
    if(bookCode.equals("wp"))
    {codeLabel = "War and Peace";}
    else if(bookCode.equals("pr"))
    {codeLabel = "Politics and Religion";}
    return codeLabel;
    }regards,
    jarshe

  • HELP PLEASE Cannot resolve symbol error

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

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

  • Error when activating - "cannot resolve symbol"

    Hi everybody!
    I created a WebDynpro DC referencing some other DC's, one of them containing some generated Enterprise Connector classes.
    A local build works fine, the WebDynpro looks and works as expected when deployed to our J2EE server. When I activate the associated activities, all DC except the WebDynpro DC compile o.k., but the WebDynpro compilation throws some "cannot resolve symbol" errors, the symbols being the generated classes from the Enterprise Connector DC.
    The Activation Log of this component shows that only one class of this DC is being compiled and packed into the public parts of the DC:
          [echo] Starting Java compiler
         [javac] Compiling 1 source file to /usr/sap/...somewhere.../classes
         [timer] Java compilation finished in 0.375 seconds
          [echo] Start XLF conversion
         [timer] XLF conversion finished in 0.001 seconds
    createPublicParts:
      [pppacker] Packing assembly public part 'mvRFCAss'
      [pppacker] Packed   0 files for entity mvRFCObjects.util (Java Package/Class, mvRFCObjects/util)
      [pppacker] Packed   2 files for entity mvRFCObjects (Java Package/Class, mvRFCObjects)
      [pppacker] Packed 2 entities for assembly public part 'mvRFCAss'
         [timer] Packing of assembly public part 'mvRFCAss' finished in 0.059 seconds
      [pppacker] Packing compilation public part 'mvRFCComp'
      [pppacker] Packed   0 files for entity GeschaeftsPartnerRFC_PortType (Java Class/Class, mvRFCObjects)
      [pppacker] Packed   0 files for entity Z_Ecm_Input (Java Class/Class, mvRFCObjects)
      [pppacker] Packed   0 files for entity Z_Ecm_Output (Java Class/Class, mvRFCObjects)
      [pppacker] Packed   0 files for entity Ztgd_EcmType (Java Class/Class, mvRFCObjects)
      [pppacker] Packed   0 files for entity Ztgd_EcmType_List (Java Class/Class, mvRFCObjects/util)
      [pppacker] Packed   2 files for entity MVTestSapAccess (Java Class/Class, mvRFCObjects)
      [pppacker] Packed 6 entities for compilation public part 'mvRFCComp'
         [timer] Packing of compilation public part 'mvRFCComp' finished in 0.095 seconds
    Any hint on what produces such an error or what information you'd need so say something ?
    Thanks!

    After messing around a bit, we finally deleted both assembly and compilation public parts of all the referenced DC's, created new ones and reestablished the references exactly as defined previously, and now it works properly. Strange thing, though...

Maybe you are looking for